mirror of
https://github.com/LorisYounger/VPet.ModMaker.git
synced 2024-08-30 18:22:21 +00:00
更新
This commit is contained in:
parent
ca1dc6d9dc
commit
1d4a0c4797
@ -1,10 +1,11 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace VPet.ModMaker.Models;
|
||||
|
||||
@ -44,8 +45,8 @@ public class ObservableEnumFlags<T>
|
||||
{
|
||||
if (Attribute.IsDefined(EnumType, typeof(FlagsAttribute)) is false)
|
||||
throw new Exception("此枚举类型未使用特性 [Flags]");
|
||||
AddCommand.ExecuteEvent += AddCommand_ExecuteEvent;
|
||||
RemoveCommand.ExecuteEvent += RemoveCommand_ExecuteEvent;
|
||||
AddCommand.ExecuteCommand += AddCommand_ExecuteEvent;
|
||||
RemoveCommand.ExecuteCommand += RemoveCommand_ExecuteEvent;
|
||||
}
|
||||
|
||||
public ObservableEnumFlags(T value)
|
||||
|
@ -15,7 +15,7 @@ using System.Windows.Media.Imaging;
|
||||
using VPet.ModMaker.Models.ModModel;
|
||||
using VPet_Simulator.Core;
|
||||
|
||||
namespace VPet.ModMaker.Models;
|
||||
namespace HKW.Models;
|
||||
|
||||
/// <summary>
|
||||
/// 拓展
|
||||
@ -275,12 +275,26 @@ public static class Extensions
|
||||
/// <typeparam name="T">值类型</typeparam>
|
||||
/// <param name="collection">集合</param>
|
||||
/// <returns>带有索引的枚举值</returns>
|
||||
public static IEnumerable<ItemInfo<T>> Enumerate<T>(this IEnumerable<T> collection)
|
||||
public static IEnumerable<ItemInfo<T>> EnumerateIndex<T>(this IEnumerable<T> collection)
|
||||
{
|
||||
var index = 0;
|
||||
foreach (var item in collection)
|
||||
yield return new(index++, item);
|
||||
}
|
||||
|
||||
public static void SetDataContext<T>(this Window window)
|
||||
where T : new()
|
||||
{
|
||||
window.DataContext = new T();
|
||||
window.Closed += (s, e) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
window.DataContext = null;
|
||||
}
|
||||
catch { }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1,4 +1,4 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
@ -1,4 +1,4 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
@ -1,4 +1,4 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using LinePutScript;
|
||||
using HKW.Models;
|
||||
using LinePutScript;
|
||||
using LinePutScript.Converter;
|
||||
using LinePutScript.Dictionary;
|
||||
using System;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using LinePutScript.Converter;
|
||||
using HKW.Models;
|
||||
using LinePutScript.Converter;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
@ -9,6 +9,7 @@ using System.Windows.Controls;
|
||||
using System.Windows;
|
||||
using VPet_Simulator.Windows.Interface;
|
||||
using VPet.ModMaker.Views;
|
||||
using HKW.Models;
|
||||
|
||||
namespace VPet.ModMaker.Models;
|
||||
|
||||
@ -37,7 +38,7 @@ public class ModMaker : MainPlugin
|
||||
Setting();
|
||||
};
|
||||
modset.Items.Add(menuset);
|
||||
Application.Current.Resources.MergedDictionaries.Add(Utils.ModMakerStyles);
|
||||
Application.Current.Resources.MergedDictionaries.Add(ModMakerInfo.NativeStyles);
|
||||
}
|
||||
|
||||
public override void Setting()
|
||||
|
@ -36,4 +36,9 @@ public static class ModMakerInfo
|
||||
/// 本体的宠物
|
||||
/// </summary>
|
||||
public static List<PetModel> Pets { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 本地风格
|
||||
/// </summary>
|
||||
public static NativeStyles NativeStyles { get; } = new();
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
@ -614,7 +615,7 @@ public class AnimeTypeModel
|
||||
static void SaveAnimes(string animePath, ObservableCollection<AnimeModel> animes)
|
||||
{
|
||||
Directory.CreateDirectory(animePath);
|
||||
foreach (var anime in animes.Enumerate())
|
||||
foreach (var anime in animes.EnumerateIndex())
|
||||
SaveImages(Path.Combine(animePath, anime.Index.ToString()), anime.Value);
|
||||
}
|
||||
}
|
||||
@ -627,7 +628,7 @@ public class AnimeTypeModel
|
||||
static void SaveImages(string imagesPath, AnimeModel model)
|
||||
{
|
||||
Directory.CreateDirectory(imagesPath);
|
||||
foreach (var image in model.Images.Enumerate())
|
||||
foreach (var image in model.Images.EnumerateIndex())
|
||||
{
|
||||
image.Value.Image.Value.SaveToPng(
|
||||
Path.Combine(
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using LinePutScript.Converter;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -1,4 +1,4 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using LinePutScript;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using LinePutScript;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using System;
|
||||
@ -304,7 +305,7 @@ public class FoodAnimeTypeModel
|
||||
)
|
||||
{
|
||||
var modeAnimePath = Path.Combine(animePath, mode.ToString());
|
||||
foreach (var anime in animes.Enumerate())
|
||||
foreach (var anime in animes.EnumerateIndex())
|
||||
{
|
||||
var indexPath = Path.Combine(modeAnimePath, anime.Index.ToString());
|
||||
Directory.CreateDirectory(indexPath);
|
||||
@ -329,7 +330,7 @@ public class FoodAnimeTypeModel
|
||||
var backLayPath = Path.Combine(indexPath, BackLayName);
|
||||
Directory.CreateDirectory(frontLayPath);
|
||||
Directory.CreateDirectory(backLayPath);
|
||||
foreach (var frontImage in anime.FrontImages.Enumerate())
|
||||
foreach (var frontImage in anime.FrontImages.EnumerateIndex())
|
||||
{
|
||||
frontImage.Value.Image.Value.SaveToPng(
|
||||
Path.Combine(
|
||||
@ -338,7 +339,7 @@ public class FoodAnimeTypeModel
|
||||
)
|
||||
);
|
||||
}
|
||||
foreach (var backImage in anime.BackImages.Enumerate())
|
||||
foreach (var backImage in anime.BackImages.EnumerateIndex())
|
||||
{
|
||||
backImage.Value.Image.Value.SaveToPng(
|
||||
Path.Combine(
|
||||
@ -377,7 +378,7 @@ public class FoodAnimeTypeModel
|
||||
new Sub("mode", mode.ToString()),
|
||||
new Sub("graph", Name.Value)
|
||||
};
|
||||
foreach (var foodLocation in anime.FoodLocations.Enumerate())
|
||||
foreach (var foodLocation in anime.FoodLocations.EnumerateIndex())
|
||||
{
|
||||
var sub = new Sub($"a{foodLocation.Index}");
|
||||
sub.info = foodLocation.Value.ToString();
|
||||
|
@ -1,4 +1,4 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using LinePutScript;
|
||||
using LinePutScript.Converter;
|
||||
using System;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -1,4 +1,4 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using LinePutScript;
|
||||
using LinePutScript.Converter;
|
||||
using LinePutScript.Localization.WPF;
|
||||
|
@ -1,4 +1,4 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using LinePutScript;
|
||||
using LinePutScript.Converter;
|
||||
using LinePutScript.Localization.WPF;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
@ -1,4 +1,4 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
@ -1,6 +1,6 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
|
||||
namespace VPet.ModMaker.Models;
|
||||
namespace HKW.Models;
|
||||
|
||||
/// <summary>
|
||||
/// 可观察的范围
|
||||
|
@ -4,11 +4,10 @@ using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
using VPet.ModMaker;
|
||||
|
||||
namespace VPet.ModMaker.Models;
|
||||
namespace HKW.Models;
|
||||
|
||||
/// <summary>
|
||||
/// 工具
|
||||
@ -26,8 +25,6 @@ public static class Utils
|
||||
public const int DecodePixelHeight = 250;
|
||||
public static char[] Separator { get; } = new char[] { '_' };
|
||||
|
||||
public static ModMakerStyles ModMakerStyles { get; } = new ModMakerStyles();
|
||||
|
||||
//public static BitmapImage LoadImageToStream(string imagePath)
|
||||
//{
|
||||
// BitmapImage bitmapImage = new();
|
||||
|
@ -7,9 +7,9 @@ using System.Windows;
|
||||
|
||||
namespace VPet.ModMaker;
|
||||
|
||||
public partial class ModMakerStyles : ResourceDictionary
|
||||
public partial class NativeStyles : ResourceDictionary
|
||||
{
|
||||
public ModMakerStyles()
|
||||
public NativeStyles()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
<ResourceDictionary
|
||||
x:Class="VPet.ModMaker.ModMakerStyles"
|
||||
x:Class="VPet.ModMaker.NativeStyles"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<ResourceDictionary.MergedDictionaries>
|
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace HKW.HKWUtils.Observable;
|
||||
|
||||
/// <summary>
|
||||
/// 异步执行命令事件
|
||||
/// </summary>
|
||||
public delegate Task AsyncExecuteEventHandler();
|
||||
|
||||
/// <summary>
|
||||
/// 异步执行命令事件
|
||||
/// </summary>
|
||||
/// <param name="parameter">值</param>
|
||||
public delegate Task AsyncExecuteEventHandler<T>(T parameter);
|
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace HKW.HKWUtils.Observable;
|
||||
|
||||
/// <summary>
|
||||
/// 执行事件
|
||||
/// </summary>
|
||||
public delegate void ExecuteEventHandler();
|
||||
|
||||
/// <summary>
|
||||
/// 执行事件
|
||||
/// </summary>
|
||||
/// <param name="parameter">参数</param>
|
||||
public delegate void ExecuteEventHandler<T>(T parameter);
|
@ -0,0 +1,11 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace HKW.HKWUtils.Observable;
|
||||
|
||||
/// <summary>
|
||||
/// 通知接收器
|
||||
/// </summary>
|
||||
/// <param name="sender">发送者</param>
|
||||
/// <param name="e">参数</param>
|
||||
public delegate void NotifyReceivedEventHandler(ICommand sender, CancelEventArgs e);
|
@ -1,20 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace HKW.HKWViewModels.SimpleObservable;
|
||||
namespace HKW.HKWUtils.Observable;
|
||||
|
||||
/// <summary>
|
||||
/// 可观察命令
|
||||
/// </summary>
|
||||
[DebuggerDisplay(
|
||||
"CanExecute = {CanExecuteProperty.Value}, EventCount = {ExecuteEvent.GetInvocationList().Length}, AsyncEventCount = {AsyncExecuteEvent.GetInvocationList().Length}"
|
||||
)]
|
||||
[DebuggerDisplay("\\{ObservableCommand, CanExecute = {CanExecuteProperty.Value}\\}")]
|
||||
public class ObservableCommand : ICommand
|
||||
{
|
||||
/// <summary>
|
||||
@ -68,7 +64,7 @@ public class ObservableCommand : ICommand
|
||||
/// <param name="parameter">参数</param>
|
||||
public async void Execute(object? parameter)
|
||||
{
|
||||
ExecuteEvent?.Invoke();
|
||||
ExecuteCommand?.Invoke();
|
||||
await ExecuteAsync();
|
||||
}
|
||||
|
||||
@ -78,11 +74,13 @@ public class ObservableCommand : ICommand
|
||||
/// <returns>等待</returns>
|
||||
private async Task ExecuteAsync()
|
||||
{
|
||||
if (AsyncExecuteEvent is null)
|
||||
if (AsyncExecuteCommand is null)
|
||||
return;
|
||||
CurrentCanExecute.Value = false;
|
||||
foreach (
|
||||
var asyncEvent in AsyncExecuteEvent.GetInvocationList().Cast<AsyncExecuteHandler>()
|
||||
var asyncEvent in AsyncExecuteCommand
|
||||
.GetInvocationList()
|
||||
.Cast<AsyncExecuteEventHandler>()
|
||||
)
|
||||
await asyncEvent.Invoke();
|
||||
CurrentCanExecute.Value = true;
|
||||
@ -128,9 +126,9 @@ public class ObservableCommand : ICommand
|
||||
|
||||
private void Notify_PropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
var temp = CanExecuteProperty.Value;
|
||||
NotifyCanExecuteReceived?.Invoke(ref temp);
|
||||
CanExecuteProperty.Value = temp;
|
||||
var args = new CancelEventArgs();
|
||||
NotifyCanExecuteReceived?.Invoke(this, args);
|
||||
CanExecuteProperty.Value = args.Cancel;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -143,35 +141,16 @@ public class ObservableCommand : ICommand
|
||||
/// <summary>
|
||||
/// 执行事件
|
||||
/// </summary>
|
||||
public event ExecuteHandler? ExecuteEvent;
|
||||
public event ExecuteEventHandler? ExecuteCommand;
|
||||
|
||||
/// <summary>
|
||||
/// 异步执行事件
|
||||
/// </summary>
|
||||
public event AsyncExecuteHandler? AsyncExecuteEvent;
|
||||
public event AsyncExecuteEventHandler? AsyncExecuteCommand;
|
||||
|
||||
/// <summary>
|
||||
/// 可执行通知接收器事件
|
||||
/// </summary>
|
||||
public event NotifyReceivedHandler? NotifyCanExecuteReceived;
|
||||
#endregion
|
||||
|
||||
#region Delegate
|
||||
/// <summary>
|
||||
/// 执行
|
||||
/// </summary>
|
||||
public delegate void ExecuteHandler();
|
||||
|
||||
/// <summary>
|
||||
/// 异步执行
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public delegate Task AsyncExecuteHandler();
|
||||
|
||||
/// <summary>
|
||||
/// 通知接收器
|
||||
/// </summary>
|
||||
/// <param name="value">引用值</param>
|
||||
public delegate void NotifyReceivedHandler(ref bool value);
|
||||
public event NotifyReceivedEventHandler? NotifyCanExecuteReceived;
|
||||
#endregion
|
||||
}
|
@ -1,21 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace HKW.HKWViewModels.SimpleObservable;
|
||||
namespace HKW.HKWUtils.Observable;
|
||||
|
||||
/// <summary>
|
||||
/// 带参数的可观察命令
|
||||
/// </summary>
|
||||
/// <typeparam name="T">参数类型</typeparam>
|
||||
[DebuggerDisplay(
|
||||
"CanExecute = {CanExecuteProperty.Value}, EventCount = {ExecuteEvent.GetInvocationList().Length}, AsyncEventCount = {AsyncExecuteEvent.GetInvocationList().Length}"
|
||||
)]
|
||||
[DebuggerDisplay("\\{ObservableCommand, CanExecute = {CanExecuteProperty.Value}\\}")]
|
||||
public class ObservableCommand<T> : ICommand
|
||||
where T : notnull
|
||||
{
|
||||
@ -61,19 +57,21 @@ public class ObservableCommand<T> : ICommand
|
||||
/// <inheritdoc cref="ObservableCommand.Execute(object?)"/>
|
||||
public async void Execute(object? parameter)
|
||||
{
|
||||
ExecuteEvent?.Invoke((T?)parameter!);
|
||||
await ExecuteAsync((T?)parameter!);
|
||||
ExecuteCommand?.Invoke((T)parameter!);
|
||||
await ExecuteAsync((T)parameter!);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="ObservableCommand.ExecuteAsync"/>
|
||||
/// <param name="parameter">参数</param>
|
||||
private async Task ExecuteAsync(T parameter)
|
||||
{
|
||||
if (AsyncExecuteEvent is null)
|
||||
if (AsyncExecuteCommand is null)
|
||||
return;
|
||||
CurrentCanExecute.Value = false;
|
||||
foreach (
|
||||
var asyncEvent in AsyncExecuteEvent.GetInvocationList().Cast<AsyncExecuteHandler>()
|
||||
var asyncEvent in AsyncExecuteCommand
|
||||
.GetInvocationList()
|
||||
.Cast<AsyncExecuteEventHandler<T>>()
|
||||
)
|
||||
await asyncEvent.Invoke(parameter);
|
||||
CurrentCanExecute.Value = true;
|
||||
@ -97,9 +95,9 @@ public class ObservableCommand<T> : ICommand
|
||||
|
||||
private void Notify_PropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
var temp = CanExecuteProperty.Value;
|
||||
NotifyCanExecuteReceived?.Invoke(ref temp);
|
||||
CanExecuteProperty.Value = temp;
|
||||
var args = new CancelEventArgs();
|
||||
NotifyCanExecuteReceived?.Invoke(this, args);
|
||||
CanExecuteProperty.Value = args.Cancel;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -107,29 +105,13 @@ public class ObservableCommand<T> : ICommand
|
||||
/// <inheritdoc cref="ObservableCommand.CanExecuteChanged"/>
|
||||
public event EventHandler? CanExecuteChanged;
|
||||
|
||||
/// <inheritdoc cref="ObservableCommand.ExecuteEvent"/>
|
||||
public event ExecuteHandler? ExecuteEvent;
|
||||
/// <inheritdoc cref="ObservableCommand.ExecuteCommand"/>
|
||||
public event ExecuteEventHandler<T>? ExecuteCommand;
|
||||
|
||||
/// <inheritdoc cref="ObservableCommand.AsyncExecuteEvent"/>
|
||||
public event AsyncExecuteHandler? AsyncExecuteEvent;
|
||||
/// <inheritdoc cref="ObservableCommand.AsyncExecuteCommand"/>
|
||||
public event AsyncExecuteEventHandler<T>? AsyncExecuteCommand;
|
||||
|
||||
/// <inheritdoc cref="ObservableCommand.NotifyCanExecuteReceived"/>
|
||||
public event NotifyReceivedHandler? NotifyCanExecuteReceived;
|
||||
#endregion
|
||||
|
||||
#region Delegate
|
||||
/// <inheritdoc cref="ObservableCommand.ExecuteHandler"/>
|
||||
/// <param name="value">值</param>
|
||||
public delegate void ExecuteHandler(T value);
|
||||
|
||||
/// <inheritdoc cref="ObservableCommand.AsyncExecuteHandler"/>
|
||||
/// <param name="value">值</param>
|
||||
public delegate Task AsyncExecuteHandler(T value);
|
||||
|
||||
/// <summary>
|
||||
/// 通知接收器
|
||||
/// </summary>
|
||||
/// <param name="value">引用值</param>
|
||||
public delegate void NotifyReceivedHandler(ref bool value);
|
||||
public event NotifyReceivedEventHandler? NotifyCanExecuteReceived;
|
||||
#endregion
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace HKW.HKWUtils.Observable;
|
||||
|
||||
/// <summary>
|
||||
/// 通知发送者属性改变接收器
|
||||
/// </summary>
|
||||
/// <param name="sender">发送者</param>
|
||||
/// <param name="eventSender">属性改变事件发送者</param>
|
||||
public delegate void NotifySenderPropertyChangedHandler<T>(
|
||||
ObservableValue<T> sender,
|
||||
INotifyPropertyChanged? eventSender
|
||||
);
|
@ -1,13 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HKW.HKWViewModels.SimpleObservable;
|
||||
namespace HKW.HKWUtils.Observable;
|
||||
|
||||
/// <summary>
|
||||
/// 可观察值
|
||||
@ -77,9 +73,11 @@ public class ObservableValue<T>
|
||||
private bool NotifyPropertyChanging(T oldValue, T newValue)
|
||||
{
|
||||
PropertyChanging?.Invoke(this, new(nameof(Value)));
|
||||
// 若全部事件取消改变 则取消改变
|
||||
var args = new ValueChangingEventArgs<T>(oldValue, newValue);
|
||||
ValueChanging?.Invoke(this, args);
|
||||
// 取消改变后通知UI更改
|
||||
if (args.Cancel)
|
||||
PropertyChanged?.Invoke(this, new(nameof(Value)));
|
||||
return args.Cancel;
|
||||
}
|
||||
|
||||
@ -188,6 +186,16 @@ public class ObservableValue<T>
|
||||
return Guid.Equals(other?.Guid) is true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 值相等
|
||||
/// </summary>
|
||||
/// <param name="other">其它可观察值</param>
|
||||
/// <returns>相等为 <see langword="true"/> 否则为 <see langword="false"/></returns>
|
||||
public bool ValueEquals(ObservableValue<T> other)
|
||||
{
|
||||
return Value?.Equals(other.Value) is true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断 <see cref="Value"/> 相等
|
||||
/// </summary>
|
||||
@ -227,101 +235,16 @@ public class ObservableValue<T>
|
||||
/// <summary>
|
||||
/// 值改变前事件
|
||||
/// </summary>
|
||||
public event ValueChangingEventHandler? ValueChanging;
|
||||
public event ValueChangingEventHandler<T>? ValueChanging;
|
||||
|
||||
/// <summary>
|
||||
/// 值改变后事件
|
||||
/// </summary>
|
||||
public event ValueChangedEventHandler? ValueChanged;
|
||||
public event ValueChangedEventHandler<T>? ValueChanged;
|
||||
|
||||
/// <summary>
|
||||
/// 通知接收事件
|
||||
/// </summary>
|
||||
public event NotifySenderPropertyChangedHandler? SenderPropertyChanged;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Delegate
|
||||
/// <summary>
|
||||
/// 值改变前事件
|
||||
/// </summary>
|
||||
/// <param name="sender">发送者</param>
|
||||
/// <param name="e">参数</param>
|
||||
public delegate void ValueChangingEventHandler(
|
||||
ObservableValue<T> sender,
|
||||
ValueChangingEventArgs<T> e
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// 值改变后事件
|
||||
/// </summary>
|
||||
/// <param name="sender">发送者</param>
|
||||
/// <param name="e">参数</param>
|
||||
public delegate void ValueChangedEventHandler(
|
||||
ObservableValue<T> sender,
|
||||
ValueChangedEventArgs<T> e
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// 通知发送者属性改变接收器
|
||||
/// </summary>
|
||||
/// <param name="source">源</param>
|
||||
/// <param name="sender">发送者</param>
|
||||
public delegate void NotifySenderPropertyChangedHandler(
|
||||
ObservableValue<T> source,
|
||||
INotifyPropertyChanged? sender
|
||||
);
|
||||
public event NotifySenderPropertyChangedHandler<T>? SenderPropertyChanged;
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 值改变前事件参数
|
||||
/// </summary>
|
||||
/// <typeparam name="T">值类型</typeparam>
|
||||
public class ValueChangingEventArgs<T> : CancelEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 旧值
|
||||
/// </summary>
|
||||
public T? OldValue { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 新值
|
||||
/// </summary>
|
||||
public T? NewValue { get; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
/// <param name="oldValue">旧值</param>
|
||||
/// <param name="newValue">新值</param>
|
||||
public ValueChangingEventArgs(T? oldValue, T? newValue)
|
||||
{
|
||||
OldValue = oldValue;
|
||||
NewValue = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 值改变后事件参数
|
||||
/// </summary>
|
||||
/// <typeparam name="T">值类型</typeparam>
|
||||
public class ValueChangedEventArgs<T> : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 旧值
|
||||
/// </summary>
|
||||
public T OldValue { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 新值
|
||||
/// </summary>
|
||||
public T NewValue { get; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
/// <param name="oldValue">旧值</param>
|
||||
/// <param name="newValue">新值</param>
|
||||
public ValueChangedEventArgs(T oldValue, T newValue)
|
||||
{
|
||||
OldValue = oldValue;
|
||||
NewValue = newValue;
|
||||
}
|
||||
}
|
@ -4,10 +4,8 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HKW.HKWViewModels.SimpleObservable;
|
||||
namespace HKW.HKWUtils.Observable;
|
||||
|
||||
/// <summary>
|
||||
/// 可观察值组合
|
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
|
||||
namespace HKW.HKWUtils.Observable;
|
||||
|
||||
/// <summary>
|
||||
/// 值改变后事件参数
|
||||
/// </summary>
|
||||
/// <typeparam name="T">值类型</typeparam>
|
||||
public class ValueChangedEventArgs<T> : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 旧值
|
||||
/// </summary>
|
||||
public T? OldValue { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 新值
|
||||
/// </summary>
|
||||
public T? NewValue { get; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
/// <param name="oldValue">旧值</param>
|
||||
/// <param name="newValue">新值</param>
|
||||
public ValueChangedEventArgs(T oldValue, T newValue)
|
||||
{
|
||||
OldValue = oldValue;
|
||||
NewValue = newValue;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
namespace HKW.HKWUtils.Observable;
|
||||
|
||||
/// <summary>
|
||||
/// 值改变后事件
|
||||
/// </summary>
|
||||
/// <param name="sender">发送者</param>
|
||||
/// <param name="e">参数</param>
|
||||
public delegate void ValueChangedEventHandler<T>(
|
||||
ObservableValue<T> sender,
|
||||
ValueChangedEventArgs<T> e
|
||||
);
|
@ -0,0 +1,29 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace HKW.HKWUtils.Observable;
|
||||
|
||||
/// <summary>
|
||||
/// 值改变前事件参数
|
||||
/// </summary>
|
||||
/// <typeparam name="T">值类型</typeparam>
|
||||
public class ValueChangingEventArgs<T> : CancelEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 旧值
|
||||
/// </summary>
|
||||
public T? OldValue { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 新值
|
||||
/// </summary>
|
||||
public T? NewValue { get; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
/// <param name="oldValue">旧值</param>
|
||||
/// <param name="newValue">新值</param>
|
||||
public ValueChangingEventArgs(T? oldValue, T? newValue)
|
||||
{
|
||||
OldValue = oldValue;
|
||||
NewValue = newValue;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
namespace HKW.HKWUtils.Observable;
|
||||
|
||||
/// <summary>
|
||||
/// 值改变前事件
|
||||
/// </summary>
|
||||
/// <param name="sender">发送者</param>
|
||||
/// <param name="e">参数</param>
|
||||
public delegate void ValueChangingEventHandler<T>(
|
||||
ObservableValue<T> sender,
|
||||
ValueChangingEventArgs<T> e
|
||||
);
|
@ -133,9 +133,19 @@
|
||||
<Compile Include="Models\ModModel\SelectTextModel.cs" />
|
||||
<Compile Include="Models\ModModel\WorkModel.cs" />
|
||||
<Compile Include="Resources\NativeResources.cs" />
|
||||
<Compile Include="SimpleObservable\ObservableCommandT.cs" />
|
||||
<Compile Include="ModMakerStyles.cs" />
|
||||
<Compile Include="SimpleObservable\ObservableValueGroup.cs" />
|
||||
<Compile Include="NativeStyles.cs" />
|
||||
<Compile Include="SimpleObservable\ObservableCommand\AsyncExecuteEventHandler.cs" />
|
||||
<Compile Include="SimpleObservable\ObservableCommand\ExecuteEventHandler.cs" />
|
||||
<Compile Include="SimpleObservable\ObservableCommand\NotifyReceivedEventHandler.cs" />
|
||||
<Compile Include="SimpleObservable\ObservableCommand\ObservableCommand.cs" />
|
||||
<Compile Include="SimpleObservable\ObservableCommand\ObservableCommandT.cs" />
|
||||
<Compile Include="SimpleObservable\ObservableValue\NotifySenderPropertyChangedHandler.cs" />
|
||||
<Compile Include="SimpleObservable\ObservableValue\ObservableValue.cs" />
|
||||
<Compile Include="SimpleObservable\ObservableValue\ObservableValueGroup.cs" />
|
||||
<Compile Include="SimpleObservable\ObservableValue\ValueChangedEventArgs.cs" />
|
||||
<Compile Include="SimpleObservable\ObservableValue\ValueChangedEventHandler.cs" />
|
||||
<Compile Include="SimpleObservable\ObservableValue\ValueChangingEventArgs.cs" />
|
||||
<Compile Include="SimpleObservable\ObservableValue\ValueChangingEventHandler.cs" />
|
||||
<Compile Include="ViewModels\ModEdit\AddCultureWindowVM.cs" />
|
||||
<Compile Include="ViewModels\ModEdit\AnimeEdit\FoodAnimeEditWindowVM.cs" />
|
||||
<Compile Include="ViewModels\ModEdit\AnimeEdit\AnimeEditWindowVM.cs" />
|
||||
@ -205,8 +215,6 @@
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="SimpleObservable\ObservableCommand.cs" />
|
||||
<Compile Include="SimpleObservable\ObservableValue.cs" />
|
||||
<Compile Include="Models\Utils.cs" />
|
||||
<Compile Include="Views\ModEdit\FoodEdit\FoodEditWindow.xaml.cs">
|
||||
<DependentUpon>FoodEditWindow.xaml</DependentUpon>
|
||||
@ -260,7 +268,7 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="Properties\DesignTimeResources.xaml">
|
||||
<Page Include="NativeStyles.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
<ContainsDesignTimeResources>true</ContainsDesignTimeResources>
|
||||
@ -385,5 +393,6 @@
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\food.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
@ -122,14 +123,14 @@ public class AnimeEditWindowVM
|
||||
|
||||
CurrentAnimeModel.ValueChanged += CurrentAnimeModel_ValueChanged;
|
||||
|
||||
PlayCommand.AsyncExecuteEvent += PlayCommand_AsyncExecuteEvent;
|
||||
StopCommand.ExecuteEvent += StopCommand_ExecuteEvent;
|
||||
AddAnimeCommand.ExecuteEvent += AddAnimeCommand_ExecuteEvent;
|
||||
RemoveAnimeCommand.ExecuteEvent += RemoveAnimeCommand_ExecuteEvent;
|
||||
AddImageCommand.ExecuteEvent += AddImageCommand_ExecuteEvent;
|
||||
RemoveImageCommand.ExecuteEvent += RemoveImageCommand_ExecuteEvent;
|
||||
ChangeImageCommand.ExecuteEvent += ChangeImageCommand_ExecuteEvent;
|
||||
ClearImageCommand.ExecuteEvent += ClearImageCommand_ExecuteEvent;
|
||||
PlayCommand.AsyncExecuteCommand += PlayCommand_AsyncExecuteEvent;
|
||||
StopCommand.ExecuteCommand += StopCommand_ExecuteEvent;
|
||||
AddAnimeCommand.ExecuteCommand += AddAnimeCommand_ExecuteEvent;
|
||||
RemoveAnimeCommand.ExecuteCommand += RemoveAnimeCommand_ExecuteEvent;
|
||||
AddImageCommand.ExecuteCommand += AddImageCommand_ExecuteEvent;
|
||||
RemoveImageCommand.ExecuteCommand += RemoveImageCommand_ExecuteEvent;
|
||||
ChangeImageCommand.ExecuteCommand += ChangeImageCommand_ExecuteEvent;
|
||||
ClearImageCommand.ExecuteCommand += ClearImageCommand_ExecuteEvent;
|
||||
|
||||
Anime.ValueChanged += Anime_ValueChanged;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using Panuon.WPF.UI;
|
||||
using System;
|
||||
@ -75,9 +76,9 @@ public class AnimePageVM
|
||||
CurrentPet.ValueChanged += CurrentPet_ValueChanged;
|
||||
Search.ValueChanged += Search_ValueChanged;
|
||||
|
||||
AddCommand.ExecuteEvent += Add;
|
||||
EditCommand.ExecuteEvent += Edit;
|
||||
RemoveCommand.ExecuteEvent += Remove;
|
||||
AddCommand.ExecuteCommand += Add;
|
||||
EditCommand.ExecuteCommand += Edit;
|
||||
RemoveCommand.ExecuteCommand += Remove;
|
||||
}
|
||||
|
||||
private void InitializeAllAnimes()
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
@ -210,27 +211,27 @@ public class FoodAnimeEditWindowVM
|
||||
|
||||
CurrentAnimeModel.ValueChanged += CurrentAnimeModel_ValueChanged;
|
||||
|
||||
PlayCommand.AsyncExecuteEvent += PlayCommand_AsyncExecuteEvent;
|
||||
StopCommand.ExecuteEvent += StopCommand_ExecuteEvent;
|
||||
ReplaceFoodImageCommand.ExecuteEvent += ChangeFoodImageCommand_ExecuteEvent;
|
||||
ResetFoodImageCommand.ExecuteEvent += ResetFoodImageCommand_ExecuteEvent;
|
||||
PlayCommand.AsyncExecuteCommand += PlayCommand_AsyncExecuteEvent;
|
||||
StopCommand.ExecuteCommand += StopCommand_ExecuteEvent;
|
||||
ReplaceFoodImageCommand.ExecuteCommand += ChangeFoodImageCommand_ExecuteEvent;
|
||||
ResetFoodImageCommand.ExecuteCommand += ResetFoodImageCommand_ExecuteEvent;
|
||||
|
||||
AddAnimeCommand.ExecuteEvent += AddAnimeCommand_ExecuteEvent;
|
||||
RemoveAnimeCommand.ExecuteEvent += RemoveAnimeCommand_ExecuteEvent;
|
||||
AddAnimeCommand.ExecuteCommand += AddAnimeCommand_ExecuteEvent;
|
||||
RemoveAnimeCommand.ExecuteCommand += RemoveAnimeCommand_ExecuteEvent;
|
||||
|
||||
AddFrontImageCommand.ExecuteEvent += AddFrontImageCommand_ExecuteEvent;
|
||||
RemoveFrontImageCommand.ExecuteEvent += RemoveFrontImageCommand_ExecuteEvent;
|
||||
ClearFrontImageCommand.ExecuteEvent += ClearFrontImageCommand_ExecuteEvent;
|
||||
ChangeFrontImageCommand.ExecuteEvent += ChangeFrontImageCommand_ExecuteEvent;
|
||||
AddFrontImageCommand.ExecuteCommand += AddFrontImageCommand_ExecuteEvent;
|
||||
RemoveFrontImageCommand.ExecuteCommand += RemoveFrontImageCommand_ExecuteEvent;
|
||||
ClearFrontImageCommand.ExecuteCommand += ClearFrontImageCommand_ExecuteEvent;
|
||||
ChangeFrontImageCommand.ExecuteCommand += ChangeFrontImageCommand_ExecuteEvent;
|
||||
|
||||
AddBackImageCommand.ExecuteEvent += AddBackImageCommand_ExecuteEvent;
|
||||
RemoveBackImageCommand.ExecuteEvent += RemoveBackImageCommand_ExecuteEvent;
|
||||
ClearBackImageCommand.ExecuteEvent += ClearBackImageCommand_ExecuteEvent;
|
||||
ChangeBackImageCommand.ExecuteEvent += ChangeBackImageCommand_ExecuteEvent;
|
||||
AddBackImageCommand.ExecuteCommand += AddBackImageCommand_ExecuteEvent;
|
||||
RemoveBackImageCommand.ExecuteCommand += RemoveBackImageCommand_ExecuteEvent;
|
||||
ClearBackImageCommand.ExecuteCommand += ClearBackImageCommand_ExecuteEvent;
|
||||
ChangeBackImageCommand.ExecuteCommand += ChangeBackImageCommand_ExecuteEvent;
|
||||
|
||||
AddFoodLocationCommand.ExecuteEvent += AddeFoodLocationCommand_ExecuteEvent;
|
||||
RemoveFoodLocationCommand.ExecuteEvent += RemoveFoodLocationCommand_ExecuteEvent;
|
||||
ClearFoodLocationCommand.ExecuteEvent += ClearFoodLocationCommand_ExecuteEvent;
|
||||
AddFoodLocationCommand.ExecuteCommand += AddeFoodLocationCommand_ExecuteEvent;
|
||||
RemoveFoodLocationCommand.ExecuteCommand += RemoveFoodLocationCommand_ExecuteEvent;
|
||||
ClearFoodLocationCommand.ExecuteCommand += ClearFoodLocationCommand_ExecuteEvent;
|
||||
}
|
||||
|
||||
private void ResetFoodImageCommand_ExecuteEvent()
|
||||
|
@ -1,4 +1,4 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -51,9 +52,9 @@ public class ClickTextPageVM
|
||||
{
|
||||
ShowClickTexts.Value = ClickTexts;
|
||||
Search.ValueChanged += Search_ValueChanged;
|
||||
AddCommand.ExecuteEvent += Add;
|
||||
EditCommand.ExecuteEvent += Edit;
|
||||
RemoveCommand.ExecuteEvent += Remove;
|
||||
AddCommand.ExecuteCommand += Add;
|
||||
EditCommand.ExecuteCommand += Edit;
|
||||
RemoveCommand.ExecuteCommand += Remove;
|
||||
}
|
||||
|
||||
private void Search_ValueChanged(
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
@ -32,10 +33,10 @@ public class FoodEditWindowVM
|
||||
|
||||
public FoodEditWindowVM()
|
||||
{
|
||||
AddImageCommand.ExecuteEvent += AddImage;
|
||||
ChangeImageCommand.ExecuteEvent += ChangeImage;
|
||||
AddImageCommand.ExecuteCommand += AddImage;
|
||||
ChangeImageCommand.ExecuteCommand += ChangeImage;
|
||||
AutoSetReferencePrice.ValueChanged += AutoSetReferencePrice_ValueChanged;
|
||||
SetReferencePriceCommand.ExecuteEvent += SetReferencePriceToPrice;
|
||||
SetReferencePriceCommand.ExecuteCommand += SetReferencePriceToPrice;
|
||||
Food.Value.ReferencePrice.ValueChanged += ReferencePrice_ValueChanged;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -31,9 +32,9 @@ public class FoodPageVM
|
||||
ShowFoods.Value = Foods;
|
||||
Search.ValueChanged += Search_ValueChanged;
|
||||
|
||||
AddCommand.ExecuteEvent += Add;
|
||||
EditCommand.ExecuteEvent += Edit;
|
||||
RemoveCommand.ExecuteEvent += Remove;
|
||||
AddCommand.ExecuteCommand += Add;
|
||||
EditCommand.ExecuteCommand += Edit;
|
||||
RemoveCommand.ExecuteCommand += Remove;
|
||||
}
|
||||
|
||||
private void Search_ValueChanged(
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
@ -351,7 +352,7 @@ public class I18nEditWindowVM
|
||||
{
|
||||
if (AllI18nDatas.TryGetValue(id.Value, out var outData))
|
||||
{
|
||||
foreach (var culture in I18nHelper.Current.CultureNames.Enumerate())
|
||||
foreach (var culture in I18nHelper.Current.CultureNames.EnumerateIndex())
|
||||
{
|
||||
if (outData.Datas[culture.Index].Group is null)
|
||||
{
|
||||
@ -385,7 +386,7 @@ public class I18nEditWindowVM
|
||||
sourceData.Id.Group?.Remove(sourceData.Id);
|
||||
if (AllI18nDatas.TryGetValue(e.OldValue, out var outData))
|
||||
{
|
||||
foreach (var culture in I18nHelper.Current.CultureNames.Enumerate())
|
||||
foreach (var culture in I18nHelper.Current.CultureNames.EnumerateIndex())
|
||||
{
|
||||
if (outData.Datas[culture.Index].Group is null)
|
||||
{
|
||||
@ -417,7 +418,7 @@ public class I18nEditWindowVM
|
||||
where T : class, new()
|
||||
{
|
||||
var data = AllI18nDatas[id.Value];
|
||||
foreach (var culture in I18nHelper.Current.CultureNames.Enumerate())
|
||||
foreach (var culture in I18nHelper.Current.CultureNames.EnumerateIndex())
|
||||
{
|
||||
if (data.Datas[culture.Index].Group is ObservableValueGroup<string> group)
|
||||
{
|
||||
@ -452,7 +453,7 @@ public class I18nEditWindowVM
|
||||
where T : class, new()
|
||||
{
|
||||
var data = AllI18nDatas[id.Value];
|
||||
foreach (var culture in I18nHelper.Current.CultureNames.Enumerate())
|
||||
foreach (var culture in I18nHelper.Current.CultureNames.EnumerateIndex())
|
||||
{
|
||||
var oldValue = data.Datas[culture.Index];
|
||||
var newValue = i18nValue(i18nModel.I18nDatas[culture.Value]);
|
||||
|
@ -1,4 +1,4 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -32,9 +33,9 @@ public class LowTextPageVM
|
||||
{
|
||||
ShowLowTexts.Value = LowTexts;
|
||||
Search.ValueChanged += Search_ValueChanged;
|
||||
AddCommand.ExecuteEvent += Add;
|
||||
EditCommand.ExecuteEvent += Edit;
|
||||
RemoveCommand.ExecuteEvent += Remove;
|
||||
AddCommand.ExecuteCommand += Add;
|
||||
EditCommand.ExecuteCommand += Edit;
|
||||
RemoveCommand.ExecuteCommand += Remove;
|
||||
}
|
||||
|
||||
private void Search_ValueChanged(
|
||||
|
@ -1,4 +1,4 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -18,6 +18,7 @@ using Panuon.WPF.UI;
|
||||
using VPet.ModMaker.Views.ModEdit.I18nEdit;
|
||||
using System.Globalization;
|
||||
using Ookii.Dialogs.Wpf;
|
||||
using HKW.Models;
|
||||
|
||||
namespace VPet.ModMaker.ViewModels.ModEdit;
|
||||
|
||||
@ -89,16 +90,16 @@ public class ModEditWindowVM
|
||||
{
|
||||
new I18nEditWindow();
|
||||
ModEditWindow = window;
|
||||
ChangeImageCommand.ExecuteEvent += ChangeImage;
|
||||
AddCultureCommand.ExecuteEvent += AddCulture;
|
||||
EditCultureCommand.ExecuteEvent += EditCulture;
|
||||
RemoveCultureCommand.ExecuteEvent += RemoveCulture;
|
||||
EditI18nCommand.ExecuteEvent += EditI18n;
|
||||
SetMainCultureCommand.ExecuteEvent += SetMainCulture;
|
||||
ChangeImageCommand.ExecuteCommand += ChangeImage;
|
||||
AddCultureCommand.ExecuteCommand += AddCulture;
|
||||
EditCultureCommand.ExecuteCommand += EditCulture;
|
||||
RemoveCultureCommand.ExecuteCommand += RemoveCulture;
|
||||
EditI18nCommand.ExecuteCommand += EditI18n;
|
||||
SetMainCultureCommand.ExecuteCommand += SetMainCulture;
|
||||
|
||||
SaveCommand.ExecuteEvent += Save;
|
||||
SaveToCommand.ExecuteEvent += SaveTo;
|
||||
SaveAsTranslationModCommand.ExecuteEvent += SaveAsTranslationMod;
|
||||
SaveCommand.ExecuteCommand += Save;
|
||||
SaveToCommand.ExecuteCommand += SaveTo;
|
||||
SaveAsTranslationModCommand.ExecuteCommand += SaveAsTranslationMod;
|
||||
}
|
||||
|
||||
private void SaveAsTranslationMod()
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
@ -27,8 +28,8 @@ public class MoveEditWindowVM
|
||||
#endregion
|
||||
public MoveEditWindowVM()
|
||||
{
|
||||
AddImageCommand.ExecuteEvent += AddImage;
|
||||
ChangeImageCommand.ExecuteEvent += ChangeImage;
|
||||
AddImageCommand.ExecuteCommand += AddImage;
|
||||
ChangeImageCommand.ExecuteCommand += ChangeImage;
|
||||
Image.ValueChanged += Image_ValueChanged;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -33,9 +34,9 @@ public class MovePageVM
|
||||
CurrentPet.ValueChanged += CurrentPet_ValueChanged;
|
||||
Search.ValueChanged += Search_ValueChanged;
|
||||
|
||||
AddCommand.ExecuteEvent += Add;
|
||||
EditCommand.ExecuteEvent += Edit;
|
||||
RemoveCommand.ExecuteEvent += Remove;
|
||||
AddCommand.ExecuteCommand += Add;
|
||||
EditCommand.ExecuteCommand += Edit;
|
||||
RemoveCommand.ExecuteCommand += Remove;
|
||||
}
|
||||
|
||||
private void CurrentPet_ValueChanged(
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
@ -27,8 +28,8 @@ public class PetEditWindowVM
|
||||
#endregion
|
||||
public PetEditWindowVM()
|
||||
{
|
||||
AddImageCommand.ExecuteEvent += AddImage;
|
||||
ChangeImageCommand.ExecuteEvent += ChangeImage;
|
||||
AddImageCommand.ExecuteCommand += AddImage;
|
||||
ChangeImageCommand.ExecuteCommand += ChangeImage;
|
||||
Image.ValueChanged += Image_ValueChanged;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -29,9 +30,9 @@ public class PetPageVM
|
||||
ShowPets.Value = Pets;
|
||||
Search.ValueChanged += Search_ValueChanged;
|
||||
|
||||
AddCommand.ExecuteEvent += Add;
|
||||
EditCommand.ExecuteEvent += Edit;
|
||||
RemoveCommand.ExecuteEvent += Remove;
|
||||
AddCommand.ExecuteCommand += Add;
|
||||
EditCommand.ExecuteCommand += Edit;
|
||||
RemoveCommand.ExecuteCommand += Remove;
|
||||
}
|
||||
|
||||
private void Search_ValueChanged(
|
||||
|
@ -1,4 +1,4 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
@ -37,7 +37,7 @@ public class SaveTranslationModWindowVM
|
||||
}
|
||||
CheckAll.ValueChanged += CheckAll_ValueChanged;
|
||||
CheckAll.SenderPropertyChanged += CheckAll_SenderPropertyChanged;
|
||||
SaveCommand.ExecuteEvent += Save;
|
||||
SaveCommand.ExecuteCommand += Save;
|
||||
}
|
||||
|
||||
private void CheckAll_ValueChanged(ObservableValue<bool?> sender, ValueChangedEventArgs<bool?> e)
|
||||
|
@ -1,4 +1,4 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -29,9 +30,9 @@ public class SelectTextPageVM
|
||||
{
|
||||
ShowSelectTexts.Value = SelectTexts;
|
||||
Search.ValueChanged += Search_ValueChanged;
|
||||
AddCommand.ExecuteEvent += Add;
|
||||
EditCommand.ExecuteEvent += Edit;
|
||||
RemoveCommand.ExecuteEvent += Remove;
|
||||
AddCommand.ExecuteCommand += Add;
|
||||
EditCommand.ExecuteCommand += Edit;
|
||||
RemoveCommand.ExecuteCommand += Remove;
|
||||
}
|
||||
|
||||
private void Search_ValueChanged(
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
@ -28,8 +29,8 @@ public class WorkEditWindowVM
|
||||
#endregion
|
||||
public WorkEditWindowVM()
|
||||
{
|
||||
AddImageCommand.ExecuteEvent += AddImage;
|
||||
ChangeImageCommand.ExecuteEvent += ChangeImage;
|
||||
AddImageCommand.ExecuteCommand += AddImage;
|
||||
ChangeImageCommand.ExecuteCommand += ChangeImage;
|
||||
Image.ValueChanged += Image_ValueChanged;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -33,9 +34,9 @@ public class WorkPageVM
|
||||
CurrentPet.ValueChanged += CurrentPet_ValueChanged;
|
||||
Search.ValueChanged += Search_ValueChanged;
|
||||
|
||||
AddCommand.ExecuteEvent += Add;
|
||||
EditCommand.ExecuteEvent += Edit;
|
||||
RemoveCommand.ExecuteEvent += Remove;
|
||||
AddCommand.ExecuteCommand += Add;
|
||||
EditCommand.ExecuteCommand += Edit;
|
||||
RemoveCommand.ExecuteCommand += Remove;
|
||||
}
|
||||
|
||||
private void CurrentPet_ValueChanged(
|
||||
|
@ -1,4 +1,4 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using LinePutScript;
|
||||
using LinePutScript.Converter;
|
||||
using LinePutScript.Localization.WPF;
|
||||
@ -12,6 +12,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using VPet.ModMaker.Models;
|
||||
using VPet.ModMaker.Views;
|
||||
using VPet.ModMaker.Views.ModEdit;
|
||||
@ -68,10 +69,10 @@ public class ModMakerWindowVM
|
||||
LoadHistories();
|
||||
ModMakerWindow = window;
|
||||
ShowHistories.Value = Histories;
|
||||
CreateNewModCommand.ExecuteEvent += CreateNewMod;
|
||||
LoadModFromFileCommand.ExecuteEvent += LoadModFromFile;
|
||||
ClearHistoriesCommand.ExecuteEvent += ClearHistories;
|
||||
RemoveHistoryCommand.ExecuteEvent += RemoveHistory;
|
||||
CreateNewModCommand.ExecuteCommand += CreateNewMod;
|
||||
LoadModFromFileCommand.ExecuteCommand += LoadModFromFile;
|
||||
ClearHistoriesCommand.ExecuteCommand += ClearHistories;
|
||||
RemoveHistoryCommand.ExecuteCommand += RemoveHistory;
|
||||
HistoriesSearchText.ValueChanged += HistoriesSearchText_ValueChanged;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using Panuon.WPF.UI;
|
||||
using System;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using LinePutScript.Localization.WPF;
|
||||
using HKW.Models;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using LinePutScript.Localization.WPF;
|
||||
using HKW.Models;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using HKW.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
@ -1,4 +1,4 @@
|
||||
using HKW.HKWViewModels.SimpleObservable;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using Panuon.WPF.UI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -93,7 +93,7 @@ public partial class I18nEditWindow : WindowX
|
||||
MaxWidth = 500,
|
||||
Header = culture,
|
||||
Binding = new Binding(dataPath) { Mode = BindingMode.TwoWay },
|
||||
ElementStyle = (Style)Utils.ModMakerStyles["TextBlock_Wrap"],
|
||||
ElementStyle = (Style)ModMakerInfo.NativeStyles["TextBlock_Wrap"],
|
||||
SortMemberPath = dataPath
|
||||
};
|
||||
DataGrid_Datas.Columns.Add(column);
|
||||
|
Loading…
Reference in New Issue
Block a user