AnimeEdit 实装 Muisc

This commit is contained in:
Hakoyu 2023-09-24 22:47:00 +08:00
parent 395e054f13
commit bdf2d130dd
22 changed files with 170 additions and 97 deletions

View File

@ -21,6 +21,8 @@ public class AnimeTypeModel
public static ObservableCollection<GameSave.ModeType> ModeTypes { get; } = public static ObservableCollection<GameSave.ModeType> ModeTypes { get; } =
new(Enum.GetValues(typeof(GameSave.ModeType)).Cast<GameSave.ModeType>()); new(Enum.GetValues(typeof(GameSave.ModeType)).Cast<GameSave.ModeType>());
public ObservableValue<string> Id { get; } = new();
public ObservableValue<string> Name { get; } = new(); public ObservableValue<string> Name { get; } = new();
public ObservableValue<GraphInfo.GraphType> GraphType { get; } = new(); public ObservableValue<GraphInfo.GraphType> GraphType { get; } = new();
@ -29,10 +31,18 @@ public class AnimeTypeModel
public ObservableCollection<AnimeModel> PoorConditionAnimes { get; } = new(); public ObservableCollection<AnimeModel> PoorConditionAnimes { get; } = new();
public ObservableCollection<AnimeModel> IllAnimes { get; } = new(); public ObservableCollection<AnimeModel> IllAnimes { get; } = new();
public AnimeTypeModel() { } public AnimeTypeModel()
{
Name.ValueChanged += (_, _) =>
{
Id.Value = $"{GraphType.Value}_{Name.Value}";
};
}
public AnimeTypeModel(AnimeTypeModel model) public AnimeTypeModel(AnimeTypeModel model)
: this()
{ {
Id.Value = model.Id.Value;
Name.Value = model.Name.Value; Name.Value = model.Name.Value;
GraphType.Value = model.GraphType.Value; GraphType.Value = model.GraphType.Value;
foreach (var anime in model.HappyAnimes) foreach (var anime in model.HappyAnimes)
@ -60,6 +70,11 @@ public class AnimeTypeModel
public AnimeTypeModel(GraphInfo.GraphType graphType, string path) public AnimeTypeModel(GraphInfo.GraphType graphType, string path)
{ {
Name.Value = Path.GetFileName(path);
if (graphType is GraphInfo.GraphType.Common)
Id.Value = $"{nameof(GraphInfo.GraphType.Common)}_{Name.Value}";
else
Id.Value = graphType.ToString();
GraphType.Value = graphType; GraphType.Value = graphType;
if ( if (
graphType graphType
@ -81,6 +96,7 @@ public class AnimeTypeModel
or GraphInfo.GraphType.Raised_Static or GraphInfo.GraphType.Raised_Static
or GraphInfo.GraphType.StateONE or GraphInfo.GraphType.StateONE
or GraphInfo.GraphType.StateTWO or GraphInfo.GraphType.StateTWO
or GraphInfo.GraphType.Common
) )
LoadMultiType(path); LoadMultiType(path);
else else
@ -177,13 +193,14 @@ public class AnimeTypeModel
AddAnime(IllAnimes, dir, type); AddAnime(IllAnimes, dir, type);
} }
} }
else else if (Enum.TryParse<GameSave.ModeType>(dirName, true, out var mode))
{ {
// 判断 Happy/A 型文件夹 // 判断 Happy/A 型文件夹
var mode = Enum.Parse(typeof(GameSave.ModeType), dirName, true);
foreach (var typePath in Directory.EnumerateDirectories(dir)) foreach (var typePath in Directory.EnumerateDirectories(dir))
{ {
var type = GetAnimatType(Path.GetFileName(typePath)[0]); var type = GetAnimatType(
Path.GetFileName(typePath).Split(Utils.Separator).First()[0]
);
if (mode is GameSave.ModeType.Happy) if (mode is GameSave.ModeType.Happy)
{ {
AddAnime(HappyAnimes, typePath, type); AddAnime(HappyAnimes, typePath, type);
@ -202,6 +219,36 @@ public class AnimeTypeModel
} }
} }
} }
else
{
var type = GetAnimatType(dirName[0]);
// 判断 A/Happy 文件夹
foreach (var modePath in Directory.EnumerateDirectories(dir))
{
mode = (GameSave.ModeType)
Enum.Parse(
typeof(GameSave.ModeType),
Path.GetFileName(modePath).Split(Utils.Separator).First(),
true
);
if (mode is GameSave.ModeType.Happy)
{
AddAnime(HappyAnimes, modePath, type);
}
else if (mode is GameSave.ModeType.Nomal)
{
AddAnime(NomalAnimes, modePath, type);
}
else if (mode is GameSave.ModeType.PoorCondition)
{
AddAnime(PoorConditionAnimes, modePath, type);
}
else if (mode is GameSave.ModeType.Ill)
{
AddAnime(IllAnimes, modePath, type);
}
}
}
} }
} }
@ -254,7 +301,7 @@ public class AnimeTypeModel
or GraphInfo.GraphType.Touch_Body or GraphInfo.GraphType.Touch_Body
or GraphInfo.GraphType.Sleep or GraphInfo.GraphType.Sleep
) )
SaveWithModeType(path, this); SaveMultiType(path, this);
else if ( else if (
GraphType.Value GraphType.Value
is GraphInfo.GraphType.Switch_Up is GraphInfo.GraphType.Switch_Up
@ -271,13 +318,22 @@ public class AnimeTypeModel
SaveRaise(path, this); SaveRaise(path, this);
else if (GraphType.Value is GraphInfo.GraphType.StateONE or GraphInfo.GraphType.StateTWO) else if (GraphType.Value is GraphInfo.GraphType.StateONE or GraphInfo.GraphType.StateTWO)
SaveState(path, this); SaveState(path, this);
else if (GraphType.Value is GraphInfo.GraphType.Common)
SaveCommon(path, this);
}
void SaveCommon(string path, AnimeTypeModel animeTypeModel)
{
var animePath = Path.Combine(path, animeTypeModel.Name.Value);
Directory.CreateDirectory(animePath);
SaveWithModeType(animePath, animeTypeModel);
} }
void SaveState(string path, AnimeTypeModel animeTypeModel) void SaveState(string path, AnimeTypeModel animeTypeModel)
{ {
var animePath = Path.Combine(path, "State"); var animePath = Path.Combine(path, "State");
Directory.CreateDirectory(animePath); Directory.CreateDirectory(animePath);
SaveWithModeType(animePath, animeTypeModel); SaveMultiType(animePath, animeTypeModel);
} }
void SaveRaise(string path, AnimeTypeModel animeTypeModel) void SaveRaise(string path, AnimeTypeModel animeTypeModel)
@ -287,7 +343,7 @@ public class AnimeTypeModel
if (animeTypeModel.GraphType.Value is GraphInfo.GraphType.Raised_Dynamic) if (animeTypeModel.GraphType.Value is GraphInfo.GraphType.Raised_Dynamic)
SaveDefault(animePath, animeTypeModel); SaveDefault(animePath, animeTypeModel);
else if (animeTypeModel.GraphType.Value is GraphInfo.GraphType.Raised_Static) else if (animeTypeModel.GraphType.Value is GraphInfo.GraphType.Raised_Static)
SaveWithModeType(animePath, animeTypeModel); SaveMultiType(animePath, animeTypeModel);
} }
void SaveSwitch(string path, AnimeTypeModel animeTypeModel) void SaveSwitch(string path, AnimeTypeModel animeTypeModel)
@ -298,6 +354,30 @@ public class AnimeTypeModel
SaveWithAnimeType(Path.Combine(animePath, switchName), animeTypeModel); SaveWithAnimeType(Path.Combine(animePath, switchName), animeTypeModel);
} }
/// <summary>
/// 保存成默认样式
/// </summary>
/// <param name="path"></param>
/// <param name="animeTypeModel"></param>
static void SaveDefault(string path, AnimeTypeModel animeTypeModel)
{
var animePath = Path.Combine(path, animeTypeModel.GraphType.ToString());
Directory.CreateDirectory(animePath);
SaveWithAnimeType(animePath, animeTypeModel);
}
/// <summary>
/// 保存成多类型样式
/// </summary>
/// <param name="path"></param>
/// <param name="animeTypeModel"></param>
static void SaveMultiType(string path, AnimeTypeModel animeTypeModel)
{
var animePath = Path.Combine(path, animeTypeModel.GraphType.ToString());
Directory.CreateDirectory(animePath);
SaveWithModeType(animePath, animeTypeModel);
}
/// <summary> /// <summary>
/// 保存为 ModeType 划分的样式 /// 保存为 ModeType 划分的样式
/// <para><![CDATA[ /// <para><![CDATA[
@ -313,28 +393,26 @@ public class AnimeTypeModel
/// </summary> /// </summary>
/// <param name="path"></param> /// <param name="path"></param>
/// <param name="animeTypeModel"></param> /// <param name="animeTypeModel"></param>
void SaveWithModeType(string path, AnimeTypeModel animeTypeModel) static void SaveWithModeType(string path, AnimeTypeModel animeTypeModel)
{ {
var animePath = Path.Combine(path, animeTypeModel.GraphType.ToString());
Directory.CreateDirectory(animePath);
if (animeTypeModel.HappyAnimes.Count > 0) if (animeTypeModel.HappyAnimes.Count > 0)
{ {
var modePath = Path.Combine(animePath, nameof(GameSave.ModeType.Happy)); var modePath = Path.Combine(path, nameof(GameSave.ModeType.Happy));
SaveAnimes(modePath, animeTypeModel.HappyAnimes); SaveAnimes(modePath, animeTypeModel.HappyAnimes);
} }
if (animeTypeModel.NomalAnimes.Count > 0) if (animeTypeModel.NomalAnimes.Count > 0)
{ {
var modePath = Path.Combine(animePath, nameof(GameSave.ModeType.Nomal)); var modePath = Path.Combine(path, nameof(GameSave.ModeType.Nomal));
SaveAnimes(modePath, animeTypeModel.NomalAnimes); SaveAnimes(modePath, animeTypeModel.NomalAnimes);
} }
if (animeTypeModel.PoorConditionAnimes.Count > 0) if (animeTypeModel.PoorConditionAnimes.Count > 0)
{ {
var modePath = Path.Combine(animePath, nameof(GameSave.ModeType.PoorCondition)); var modePath = Path.Combine(path, nameof(GameSave.ModeType.PoorCondition));
SaveAnimes(modePath, animeTypeModel.PoorConditionAnimes); SaveAnimes(modePath, animeTypeModel.PoorConditionAnimes);
} }
if (animeTypeModel.IllAnimes.Count > 0) if (animeTypeModel.IllAnimes.Count > 0)
{ {
var modePath = Path.Combine(animePath, nameof(GameSave.ModeType.Ill)); var modePath = Path.Combine(path, nameof(GameSave.ModeType.Ill));
SaveAnimes(modePath, animeTypeModel.IllAnimes); SaveAnimes(modePath, animeTypeModel.IllAnimes);
} }
@ -371,18 +449,6 @@ public class AnimeTypeModel
} }
} }
/// <summary>
/// 保存成默认样式
/// </summary>
/// <param name="path"></param>
/// <param name="animeTypeModel"></param>
static void SaveDefault(string path, AnimeTypeModel animeTypeModel)
{
var animePath = Path.Combine(path, animeTypeModel.GraphType.ToString());
Directory.CreateDirectory(animePath);
SaveWithAnimeType(animePath, animeTypeModel);
}
/// <summary> /// <summary>
/// 保存为 AnimeType 划分的样式 /// 保存为 AnimeType 划分的样式
/// <para><![CDATA[ /// <para><![CDATA[

View File

@ -92,9 +92,11 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
foreach (var animeDir in Directory.EnumerateDirectories(path)) foreach (var animeDir in Directory.EnumerateDirectories(path))
{ {
var dirName = Path.GetFileName(animeDir); var dirName = Path.GetFileName(animeDir);
Enum.TryParse<GraphInfo.GraphType>(dirName, true, out var animeType); if (Enum.TryParse<GraphInfo.GraphType>(dirName, true, out var animeType))
if (AnimeTypeModel.Create(animeType, animeDir) is AnimeTypeModel model) {
petModel.Animes.Add(model); if (AnimeTypeModel.Create(animeType, animeDir) is AnimeTypeModel model)
petModel.Animes.Add(model);
}
else if (dirName.Equals("Switch", StringComparison.InvariantCultureIgnoreCase)) else if (dirName.Equals("Switch", StringComparison.InvariantCultureIgnoreCase))
{ {
foreach (var dir in Directory.EnumerateDirectories(animeDir)) foreach (var dir in Directory.EnumerateDirectories(animeDir))
@ -143,6 +145,14 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
petModel.Animes.Add(switchModel); petModel.Animes.Add(switchModel);
} }
} }
else if (dirName.Equals("Music", StringComparison.InvariantCultureIgnoreCase))
{
if (
AnimeTypeModel.Create(GraphInfo.GraphType.Common, animeDir)
is AnimeTypeModel model1
)
petModel.Animes.Add(model1);
}
} }
} }
} }

View File

@ -67,10 +67,11 @@ public class AnimeEditWindowVM
is GraphInfo.GraphType.Touch_Body is GraphInfo.GraphType.Touch_Body
or GraphInfo.GraphType.Touch_Head or GraphInfo.GraphType.Touch_Head
or GraphInfo.GraphType.Sleep or GraphInfo.GraphType.Sleep
or GraphInfo.GraphType.Common
) )
HasMultiType.Value = true; HasMultiType.Value = true;
if (model.GraphType.Value is GraphInfo.GraphType.Idel) if (model.GraphType.Value is GraphInfo.GraphType.Idel or GraphInfo.GraphType.Common)
HasAnimeName.Value = true; HasAnimeName.Value = true;
} }

View File

@ -21,7 +21,7 @@ public class AnimePageVM
public ObservableCollection<PetModel> Pets => ModInfoModel.Current.Pets; public ObservableCollection<PetModel> Pets => ModInfoModel.Current.Pets;
public ObservableValue<PetModel> CurrentPet { get; } = new(new()); public ObservableValue<PetModel> CurrentPet { get; } = new(new());
//public ObservableValue<string> Filter { get; } = new(); public ObservableValue<string> Search { get; } = new();
#endregion #endregion
#region Command #region Command
public ObservableCommand AddCommand { get; } = new(); public ObservableCommand AddCommand { get; } = new();
@ -32,7 +32,7 @@ public class AnimePageVM
{ {
ShowAnimes.Value = Animes; ShowAnimes.Value = Animes;
CurrentPet.ValueChanged += CurrentPet_ValueChanged; CurrentPet.ValueChanged += CurrentPet_ValueChanged;
//Filter.ValueChanged += Filter_ValueChanged; Search.ValueChanged += Search_ValueChanged;
AddCommand.ExecuteEvent += Add; AddCommand.ExecuteEvent += Add;
EditCommand.ExecuteEvent += Edit; EditCommand.ExecuteEvent += Edit;
@ -44,18 +44,18 @@ public class AnimePageVM
ShowAnimes.Value = newValue.Animes; ShowAnimes.Value = newValue.Animes;
} }
private void Filter_ValueChanged(string oldValue, string newValue) private void Search_ValueChanged(string oldValue, string newValue)
{ {
//if (string.IsNullOrWhiteSpace(newValue)) if (string.IsNullOrWhiteSpace(newValue))
//{ {
// ShowAnimes.Value = Animes; ShowAnimes.Value = Animes;
//} }
//else else
//{ {
// ShowAnimes.Value = new( ShowAnimes.Value = new(
// Animes.Where(m => m.Id.Value.Contains(newValue, StringComparison.OrdinalIgnoreCase)) Animes.Where(m => m.Id.Value.Contains(newValue, StringComparison.OrdinalIgnoreCase))
// ); );
//} }
} }
public void Close() { } public void Close() { }

View File

@ -17,7 +17,7 @@ public class ClickTextPageVM
#region Value #region Value
public ObservableValue<ObservableCollection<ClickTextModel>> ShowClickTexts { get; } = new(); public ObservableValue<ObservableCollection<ClickTextModel>> ShowClickTexts { get; } = new();
public ObservableCollection<ClickTextModel> ClickTexts => ModInfoModel.Current.ClickTexts; public ObservableCollection<ClickTextModel> ClickTexts => ModInfoModel.Current.ClickTexts;
public ObservableValue<string> Filter { get; } = new(); public ObservableValue<string> Search { get; } = new();
#endregion #endregion
#region Command #region Command
public ObservableCommand AddCommand { get; } = new(); public ObservableCommand AddCommand { get; } = new();
@ -28,13 +28,13 @@ public class ClickTextPageVM
public ClickTextPageVM() public ClickTextPageVM()
{ {
ShowClickTexts.Value = ClickTexts; ShowClickTexts.Value = ClickTexts;
Filter.ValueChanged += Filter_ValueChanged; Search.ValueChanged += Search_ValueChanged;
AddCommand.ExecuteEvent += Add; AddCommand.ExecuteEvent += Add;
EditCommand.ExecuteEvent += Edit; EditCommand.ExecuteEvent += Edit;
RemoveCommand.ExecuteEvent += Remove; RemoveCommand.ExecuteEvent += Remove;
} }
private void Filter_ValueChanged(string oldValue, string newValue) private void Search_ValueChanged(string oldValue, string newValue)
{ {
if (string.IsNullOrWhiteSpace(newValue)) if (string.IsNullOrWhiteSpace(newValue))
{ {

View File

@ -19,7 +19,7 @@ public class FoodPageVM
#region Value #region Value
public ObservableValue<ObservableCollection<FoodModel>> ShowFoods { get; } = new(); public ObservableValue<ObservableCollection<FoodModel>> ShowFoods { get; } = new();
public ObservableCollection<FoodModel> Foods => ModInfoModel.Current.Foods; public ObservableCollection<FoodModel> Foods => ModInfoModel.Current.Foods;
public ObservableValue<string> Filter { get; } = new(); public ObservableValue<string> Search { get; } = new();
#endregion #endregion
#region Command #region Command
public ObservableCommand AddCommand { get; } = new(); public ObservableCommand AddCommand { get; } = new();
@ -29,14 +29,14 @@ public class FoodPageVM
public FoodPageVM() public FoodPageVM()
{ {
ShowFoods.Value = Foods; ShowFoods.Value = Foods;
Filter.ValueChanged += Filter_ValueChanged; Search.ValueChanged += Search_ValueChanged;
AddCommand.ExecuteEvent += Add; AddCommand.ExecuteEvent += Add;
EditCommand.ExecuteEvent += Edit; EditCommand.ExecuteEvent += Edit;
RemoveCommand.ExecuteEvent += Remove; RemoveCommand.ExecuteEvent += Remove;
} }
private void Filter_ValueChanged(string oldValue, string newValue) private void Search_ValueChanged(string oldValue, string newValue)
{ {
if (string.IsNullOrWhiteSpace(newValue)) if (string.IsNullOrWhiteSpace(newValue))
{ {

View File

@ -20,7 +20,7 @@ public class LowTextPageVM
#region Value #region Value
public ObservableValue<ObservableCollection<LowTextModel>> ShowLowTexts { get; } = new(); public ObservableValue<ObservableCollection<LowTextModel>> ShowLowTexts { get; } = new();
public ObservableCollection<LowTextModel> LowTexts => ModInfoModel.Current.LowTexts; public ObservableCollection<LowTextModel> LowTexts => ModInfoModel.Current.LowTexts;
public ObservableValue<string> Filter { get; } = new(); public ObservableValue<string> Search { get; } = new();
#endregion #endregion
#region Command #region Command
public ObservableCommand AddCommand { get; } = new(); public ObservableCommand AddCommand { get; } = new();
@ -31,13 +31,13 @@ public class LowTextPageVM
public LowTextPageVM() public LowTextPageVM()
{ {
ShowLowTexts.Value = LowTexts; ShowLowTexts.Value = LowTexts;
Filter.ValueChanged += Filter_ValueChanged; Search.ValueChanged += Search_ValueChanged;
AddCommand.ExecuteEvent += Add; AddCommand.ExecuteEvent += Add;
EditCommand.ExecuteEvent += Edit; EditCommand.ExecuteEvent += Edit;
RemoveCommand.ExecuteEvent += Remove; RemoveCommand.ExecuteEvent += Remove;
} }
private void Filter_ValueChanged(string oldValue, string newValue) private void Search_ValueChanged(string oldValue, string newValue)
{ {
if (string.IsNullOrWhiteSpace(newValue)) if (string.IsNullOrWhiteSpace(newValue))
{ {

View File

@ -20,7 +20,7 @@ public class MovePageVM
public ObservableCollection<PetModel> Pets => ModInfoModel.Current.Pets; public ObservableCollection<PetModel> Pets => ModInfoModel.Current.Pets;
public ObservableValue<PetModel> CurrentPet { get; } = new(new()); public ObservableValue<PetModel> CurrentPet { get; } = new(new());
public ObservableValue<string> Filter { get; } = new(); public ObservableValue<string> Search { get; } = new();
#endregion #endregion
#region Command #region Command
public ObservableCommand AddCommand { get; } = new(); public ObservableCommand AddCommand { get; } = new();
@ -31,7 +31,7 @@ public class MovePageVM
{ {
ShowMoves.Value = Moves; ShowMoves.Value = Moves;
CurrentPet.ValueChanged += CurrentPet_ValueChanged; CurrentPet.ValueChanged += CurrentPet_ValueChanged;
Filter.ValueChanged += Filter_ValueChanged; Search.ValueChanged += Search_ValueChanged;
AddCommand.ExecuteEvent += Add; AddCommand.ExecuteEvent += Add;
EditCommand.ExecuteEvent += Edit; EditCommand.ExecuteEvent += Edit;
@ -43,7 +43,7 @@ public class MovePageVM
ShowMoves.Value = newValue.Moves; ShowMoves.Value = newValue.Moves;
} }
private void Filter_ValueChanged(string oldValue, string newValue) private void Search_ValueChanged(string oldValue, string newValue)
{ {
//if (string.IsNullOrWhiteSpace(newValue)) //if (string.IsNullOrWhiteSpace(newValue))
//{ //{

View File

@ -17,7 +17,7 @@ public class PetPageVM
#region Value #region Value
public ObservableValue<ObservableCollection<PetModel>> ShowPets { get; } = new(); public ObservableValue<ObservableCollection<PetModel>> ShowPets { get; } = new();
public ObservableCollection<PetModel> Pets => ModInfoModel.Current.Pets; public ObservableCollection<PetModel> Pets => ModInfoModel.Current.Pets;
public ObservableValue<string> Filter { get; } = new(); public ObservableValue<string> Search { get; } = new();
#endregion #endregion
#region Command #region Command
public ObservableCommand AddCommand { get; } = new(); public ObservableCommand AddCommand { get; } = new();
@ -27,14 +27,14 @@ public class PetPageVM
public PetPageVM() public PetPageVM()
{ {
ShowPets.Value = Pets; ShowPets.Value = Pets;
Filter.ValueChanged += Filter_ValueChanged; Search.ValueChanged += Search_ValueChanged;
AddCommand.ExecuteEvent += Add; AddCommand.ExecuteEvent += Add;
EditCommand.ExecuteEvent += Edit; EditCommand.ExecuteEvent += Edit;
RemoveCommand.ExecuteEvent += Remove; RemoveCommand.ExecuteEvent += Remove;
} }
private void Filter_ValueChanged(string oldValue, string newValue) private void Search_ValueChanged(string oldValue, string newValue)
{ {
if (string.IsNullOrWhiteSpace(newValue)) if (string.IsNullOrWhiteSpace(newValue))
{ {

View File

@ -17,7 +17,7 @@ public class SelectTextPageVM
#region Value #region Value
public ObservableValue<ObservableCollection<SelectTextModel>> ShowSelectTexts { get; } = new(); public ObservableValue<ObservableCollection<SelectTextModel>> ShowSelectTexts { get; } = new();
public ObservableCollection<SelectTextModel> SelectTexts => ModInfoModel.Current.SelectTexts; public ObservableCollection<SelectTextModel> SelectTexts => ModInfoModel.Current.SelectTexts;
public ObservableValue<string> Filter { get; } = new(); public ObservableValue<string> Search { get; } = new();
#endregion #endregion
#region Command #region Command
public ObservableCommand AddCommand { get; } = new(); public ObservableCommand AddCommand { get; } = new();
@ -28,13 +28,13 @@ public class SelectTextPageVM
public SelectTextPageVM() public SelectTextPageVM()
{ {
ShowSelectTexts.Value = SelectTexts; ShowSelectTexts.Value = SelectTexts;
Filter.ValueChanged += Filter_ValueChanged; Search.ValueChanged += Search_ValueChanged;
AddCommand.ExecuteEvent += Add; AddCommand.ExecuteEvent += Add;
EditCommand.ExecuteEvent += Edit; EditCommand.ExecuteEvent += Edit;
RemoveCommand.ExecuteEvent += Remove; RemoveCommand.ExecuteEvent += Remove;
} }
private void Filter_ValueChanged(string oldValue, string newValue) private void Search_ValueChanged(string oldValue, string newValue)
{ {
if (string.IsNullOrWhiteSpace(newValue)) if (string.IsNullOrWhiteSpace(newValue))
{ {

View File

@ -20,7 +20,7 @@ public class WorkPageVM
public ObservableCollection<PetModel> Pets => ModInfoModel.Current.Pets; public ObservableCollection<PetModel> Pets => ModInfoModel.Current.Pets;
public ObservableValue<PetModel> CurrentPet { get; } = new(new()); public ObservableValue<PetModel> CurrentPet { get; } = new(new());
public ObservableValue<string> Filter { get; } = new(); public ObservableValue<string> Search { get; } = new();
#endregion #endregion
#region Command #region Command
public ObservableCommand AddCommand { get; } = new(); public ObservableCommand AddCommand { get; } = new();
@ -31,7 +31,7 @@ public class WorkPageVM
{ {
ShowWorks.Value = Works; ShowWorks.Value = Works;
CurrentPet.ValueChanged += CurrentPet_ValueChanged; CurrentPet.ValueChanged += CurrentPet_ValueChanged;
Filter.ValueChanged += Filter_ValueChanged; Search.ValueChanged += Search_ValueChanged;
AddCommand.ExecuteEvent += Add; AddCommand.ExecuteEvent += Add;
EditCommand.ExecuteEvent += Edit; EditCommand.ExecuteEvent += Edit;
@ -43,7 +43,7 @@ public class WorkPageVM
ShowWorks.Value = newValue.Works; ShowWorks.Value = newValue.Works;
} }
private void Filter_ValueChanged(string oldValue, string newValue) private void Search_ValueChanged(string oldValue, string newValue)
{ {
if (string.IsNullOrWhiteSpace(newValue)) if (string.IsNullOrWhiteSpace(newValue))
{ {

View File

@ -24,7 +24,7 @@ public class ModMakerWindowVM
public ModEditWindow ModEditWindow { get; private set; } public ModEditWindow ModEditWindow { get; private set; }
public ObservableValue<string> HistoriesFilterText { get; } = new(); public ObservableValue<string> HistoriesSearchText { get; } = new();
public ObservableCollection<ModInfoModel> Mods { get; } = new(); public ObservableCollection<ModInfoModel> Mods { get; } = new();
public ObservableValue<ObservableCollection<ModMakerHistory>> ShowHistories { get; } = new(); public ObservableValue<ObservableCollection<ModMakerHistory>> ShowHistories { get; } = new();
@ -45,7 +45,7 @@ public class ModMakerWindowVM
CreateNewModCommand.ExecuteEvent += CreateNewMod; CreateNewModCommand.ExecuteEvent += CreateNewMod;
LoadModFromFileCommand.ExecuteEvent += LoadModFromFile; LoadModFromFileCommand.ExecuteEvent += LoadModFromFile;
ClearHistoriesCommand.ExecuteEvent += ClearHistories; ClearHistoriesCommand.ExecuteEvent += ClearHistories;
HistoriesFilterText.ValueChanged += ModFilterText_ValueChanged; HistoriesSearchText.ValueChanged += ModSearchText_ValueChanged;
} }
private void LoadHistories() private void LoadHistories()
@ -103,7 +103,7 @@ public class ModMakerWindowVM
} }
} }
private void ModFilterText_ValueChanged(string oldValue, string newValue) private void ModSearchText_ValueChanged(string oldValue, string newValue)
{ {
if (string.IsNullOrEmpty(newValue)) if (string.IsNullOrEmpty(newValue))
ShowHistories.Value = Histories; ShowHistories.Value = Histories;

View File

@ -52,7 +52,7 @@
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBox pu:TextBoxHelper.Watermark="动画Id" Text="{Binding Id.Value}" /> <TextBox pu:TextBoxHelper.Watermark="动画Id" Text="{Binding Id.Value, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Column="1" Margin="10,0,0,0"> <TextBlock Grid.Column="1" Margin="10,0,0,0">
<TextBlock.Text> <TextBlock.Text>
<MultiBinding Converter="{StaticResource StringFormatConverter}" ConverterParameter="{}({0})"> <MultiBinding Converter="{StaticResource StringFormatConverter}" ConverterParameter="{}({0})">
@ -175,19 +175,15 @@
<!--<Label Content="{ll:Str 动画Id}" /> <!--<Label Content="{ll:Str 动画Id}" />
<TextBox Grid.Column="1" />--> <TextBox Grid.Column="1" />-->
<Label Content="{ll:Str 动画类型}" /> <Label Content="{ll:Str 动画类型}" />
<TextBlock <TextBlock Grid.Column="1" Text="{Binding Anime.Value.GraphType.Value}" />
Grid.Column="1"
IsEnabled="True"
Text="{Binding Anime.Value.GraphType.Value}" />
<Label <Label
Grid.Row="1" Grid.Row="1"
Content="{ll:Str 动画名称}" Content="{ll:Str 动画名称}"
Visibility="{Binding HasAnimeName.Value, Converter={StaticResource FalseToHiddenConverter}}" /> Visibility="{Binding HasAnimeName.Value, Converter={StaticResource FalseToHiddenConverter}}" />
<TextBlock <TextBox
Grid.Row="1" Grid.Row="1"
Grid.Column="1" Grid.Column="1"
IsEnabled="True" Text="{Binding Anime.Value.Name.Value, UpdateSourceTrigger=PropertyChanged}"
Text="{Binding Anime.Value.GraphType.Value}"
Visibility="{Binding HasAnimeName.Value, Converter={StaticResource FalseToHiddenConverter}}" /> Visibility="{Binding HasAnimeName.Value, Converter={StaticResource FalseToHiddenConverter}}" />
</Grid> </Grid>
</Grid> </Grid>

View File

@ -25,18 +25,18 @@
<ColumnDefinition /> <ColumnDefinition />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<!--<TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Filter.Value, UpdateSourceTrigger=PropertyChanged}"> <TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Search.Value, UpdateSourceTrigger=PropertyChanged}">
<TextBox.Style> <TextBox.Style>
<Style BasedOn="{StaticResource {x:Type TextBox}}" TargetType="TextBox"> <Style BasedOn="{StaticResource {x:Type TextBox}}" TargetType="TextBox">
<Setter Property="IsEnabled" Value="True" /> <Setter Property="IsEnabled" Value="True" />
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding SelectedItem, ElementName=ComboBox_Pet}" Value="{x:Null}"> <DataTrigger Binding="{Binding SelectedItem, ElementName=ComboBox_Pet}" Value="{x:Null}">
<Setter Property="IsEnabled" Value="False" /> <Setter Property="IsEnabled" Value="False" />
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</TextBox.Style> </TextBox.Style>
</TextBox>--> </TextBox>
<ComboBox <ComboBox
x:Name="ComboBox_Pet" x:Name="ComboBox_Pet"
Grid.Column="1" Grid.Column="1"
@ -83,10 +83,10 @@
</DataGrid.RowStyle> </DataGrid.RowStyle>
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn <DataGridTextColumn
Binding="{Binding GraphType.Value}" Binding="{Binding Id.Value}"
CanUserSort="True" CanUserSort="True"
IsReadOnly="True" IsReadOnly="True"
SortMemberPath="GraphType.Value"> SortMemberPath="Id.Value">
<DataGridTextColumn.Header> <DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 动画类型}" /> <TextBlock Text="{ll:Str 动画类型}" />
</DataGridTextColumn.Header> </DataGridTextColumn.Header>

View File

@ -20,7 +20,7 @@
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Filter.Value, UpdateSourceTrigger=PropertyChanged}" /> <TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Search.Value, UpdateSourceTrigger=PropertyChanged}" />
<DataGrid <DataGrid
Grid.Row="1" Grid.Row="1"
d:ItemsSource="{d:SampleData ItemCount=5}" d:ItemsSource="{d:SampleData ItemCount=5}"

View File

@ -20,7 +20,7 @@
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Filter.Value, UpdateSourceTrigger=PropertyChanged}" /> <TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Search.Value, UpdateSourceTrigger=PropertyChanged}" />
<DataGrid <DataGrid
Grid.Row="1" Grid.Row="1"
d:ItemsSource="{d:SampleData ItemCount=5}" d:ItemsSource="{d:SampleData ItemCount=5}"

View File

@ -20,7 +20,7 @@
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Filter.Value, UpdateSourceTrigger=PropertyChanged}" /> <TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Search.Value, UpdateSourceTrigger=PropertyChanged}" />
<DataGrid <DataGrid
x:Name="DataGrid_LowText" x:Name="DataGrid_LowText"
Grid.Row="1" Grid.Row="1"

View File

@ -26,7 +26,7 @@
<ColumnDefinition /> <ColumnDefinition />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<!--<TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Filter.Value, UpdateSourceTrigger=PropertyChanged}"> <!--<TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Search.Value, UpdateSourceTrigger=PropertyChanged}">
<TextBox.Style> <TextBox.Style>
<Style BasedOn="{StaticResource {x:Type TextBox}}" TargetType="TextBox"> <Style BasedOn="{StaticResource {x:Type TextBox}}" TargetType="TextBox">
<Setter Property="IsEnabled" Value="True" /> <Setter Property="IsEnabled" Value="True" />

View File

@ -20,7 +20,7 @@
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Filter.Value, UpdateSourceTrigger=PropertyChanged}" /> <TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Search.Value, UpdateSourceTrigger=PropertyChanged}" />
<DataGrid <DataGrid
Grid.Row="1" Grid.Row="1"
d:ItemsSource="{d:SampleData ItemCount=5}" d:ItemsSource="{d:SampleData ItemCount=5}"

View File

@ -20,7 +20,7 @@
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Filter.Value, UpdateSourceTrigger=PropertyChanged}" /> <TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Search.Value, UpdateSourceTrigger=PropertyChanged}" />
<DataGrid <DataGrid
Grid.Row="1" Grid.Row="1"
d:ItemsSource="{d:SampleData ItemCount=5}" d:ItemsSource="{d:SampleData ItemCount=5}"

View File

@ -25,7 +25,7 @@
<ColumnDefinition /> <ColumnDefinition />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Filter.Value, UpdateSourceTrigger=PropertyChanged}"> <TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Search.Value, UpdateSourceTrigger=PropertyChanged}">
<TextBox.Style> <TextBox.Style>
<Style BasedOn="{StaticResource {x:Type TextBox}}" TargetType="TextBox"> <Style BasedOn="{StaticResource {x:Type TextBox}}" TargetType="TextBox">
<Setter Property="IsEnabled" Value="True" /> <Setter Property="IsEnabled" Value="True" />

View File

@ -34,7 +34,7 @@
<ColumnDefinition /> <ColumnDefinition />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBox pu:TextBoxHelper.Watermark="{ll:Str 最近的内容}" Text="{Binding HistoriesFilterText.Value}" /> <TextBox pu:TextBoxHelper.Watermark="{ll:Str 最近的内容}" Text="{Binding HistoriesSearchText.Value}" />
<Button <Button
Grid.Column="1" Grid.Column="1"
Command="{Binding ClearHistoriesCommand}" Command="{Binding ClearHistoriesCommand}"