From 4097408c81eb765cf9eb82336a41ac4e49e4f420 Mon Sep 17 00:00:00 2001 From: Hakoyu Date: Mon, 6 May 2024 21:14:25 +0800 Subject: [PATCH] =?UTF-8?q?#=20=E4=BF=AE=E5=A4=8D=20-=20=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E6=9C=AC=E4=BD=93=E5=AE=A0=E7=89=A9=E6=97=B6,=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E5=AE=A0=E7=89=A9=E5=AF=BC=E8=87=B4=E7=9A=84=E8=BD=AF?= =?UTF-8?q?=E4=BB=B6=E5=B4=A9=E6=BA=83=20-=20=E6=97=A0=E6=B3=95=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=8A=A8=E7=94=BB=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet.ModMaker/Models/ModModel/AnimeModel.cs | 1 - .../ModEdit/AnimeEdit/AnimeEditWindowVM.cs | 8 ++++---- .../ViewModels/ModEdit/AnimeEdit/AnimePageVM.cs | 8 ++++++-- .../ViewModels/ModEdit/WorkEdit/WorkPageVM.cs | 2 +- .../ModEdit/AnimeEdit/SelectGraphTypeWindow.xaml | 1 + .../ModEdit/AnimeEdit/SelectGraphTypeWindow.xaml.cs | 12 +----------- 6 files changed, 13 insertions(+), 19 deletions(-) diff --git a/VPet.ModMaker/Models/ModModel/AnimeModel.cs b/VPet.ModMaker/Models/ModModel/AnimeModel.cs index b0c899f..76c276f 100644 --- a/VPet.ModMaker/Models/ModModel/AnimeModel.cs +++ b/VPet.ModMaker/Models/ModModel/AnimeModel.cs @@ -16,7 +16,6 @@ public class AnimeModel : ObservableObjectX, ICloneable public AnimeModel() { } public AnimeModel(string imagesPath) - : this() { foreach (var file in Directory.EnumerateFiles(imagesPath)) { diff --git a/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimeEditWindowVM.cs b/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimeEditWindowVM.cs index edbefc2..5b17e2f 100644 --- a/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimeEditWindowVM.cs +++ b/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimeEditWindowVM.cs @@ -75,7 +75,7 @@ public class AnimeEditWindowVM : ObservableObjectX { if (SetProperty(ref _anime, value) is false) return; - CheckGraphType(Anime); + CheckGraphType(); } } #endregion @@ -210,12 +210,12 @@ public class AnimeEditWindowVM : ObservableObjectX #region LoadAnime - private void CheckGraphType(AnimeTypeModel model) + public void CheckGraphType() { - if (AnimeTypeModel.HasMultiTypeAnimes.Contains(model.GraphType)) + if (AnimeTypeModel.HasMultiTypeAnimes.Contains(Anime.GraphType)) HasMultiType = true; - if (AnimeTypeModel.HasNameAnimes.Contains(model.GraphType)) + if (AnimeTypeModel.HasNameAnimes.Contains(Anime.GraphType)) HasAnimeName = true; } #endregion diff --git a/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimePageVM.cs b/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimePageVM.cs index d4610f4..acc10c3 100644 --- a/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimePageVM.cs +++ b/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimePageVM.cs @@ -57,7 +57,7 @@ public class AnimePageVM : ObservableObjectX { if (e.NewValue is false) { - if (CurrentPet.FromMain) + if (CurrentPet?.FromMain is true) { CurrentPet = null!; } @@ -211,7 +211,11 @@ public class AnimePageVM : ObservableObjectX var vm = window.ViewModel; vm.CurrentPet = CurrentPet; vm.Anime.GraphType = graphType; - vm.Anime.Name = animeName; + if (string.IsNullOrWhiteSpace(animeName)) + vm.Anime.ID = graphType.ToString(); + else + vm.Anime.Name = animeName; + vm.CheckGraphType(); window.ShowDialog(); if (window.IsCancel) return; diff --git a/VPet.ModMaker/ViewModels/ModEdit/WorkEdit/WorkPageVM.cs b/VPet.ModMaker/ViewModels/ModEdit/WorkEdit/WorkPageVM.cs index dda81ea..7ec776f 100644 --- a/VPet.ModMaker/ViewModels/ModEdit/WorkEdit/WorkPageVM.cs +++ b/VPet.ModMaker/ViewModels/ModEdit/WorkEdit/WorkPageVM.cs @@ -43,7 +43,7 @@ public class WorkPageVM : ObservableObjectX { if (e.NewValue is false) { - if (CurrentPet.FromMain) + if (CurrentPet?.FromMain is false) { CurrentPet = null!; } diff --git a/VPet.ModMaker/Views/ModEdit/AnimeEdit/SelectGraphTypeWindow.xaml b/VPet.ModMaker/Views/ModEdit/AnimeEdit/SelectGraphTypeWindow.xaml index 5f02138..7df6390 100644 --- a/VPet.ModMaker/Views/ModEdit/AnimeEdit/SelectGraphTypeWindow.xaml +++ b/VPet.ModMaker/Views/ModEdit/AnimeEdit/SelectGraphTypeWindow.xaml @@ -11,6 +11,7 @@ Title="SelectGraphTypeWindow" Width="500" Height="300" + WindowStartupLocation="CenterScreen" mc:Ignorable="d"> diff --git a/VPet.ModMaker/Views/ModEdit/AnimeEdit/SelectGraphTypeWindow.xaml.cs b/VPet.ModMaker/Views/ModEdit/AnimeEdit/SelectGraphTypeWindow.xaml.cs index 170aec7..6c437fb 100644 --- a/VPet.ModMaker/Views/ModEdit/AnimeEdit/SelectGraphTypeWindow.xaml.cs +++ b/VPet.ModMaker/Views/ModEdit/AnimeEdit/SelectGraphTypeWindow.xaml.cs @@ -32,7 +32,7 @@ public partial class SelectGraphTypeWindow : Window public SelectGraphTypeWindow() { InitializeComponent(); - this.SetDataContext(); + DataContext = new SelectGraphTypeWindowVM(); } public bool IsCancel { get; private set; } = true; @@ -44,16 +44,6 @@ public partial class SelectGraphTypeWindow : Window private void Button_Yes_Click(object? sender, RoutedEventArgs e) { - //if (string.IsNullOrWhiteSpace(AnimeName.Value)) - //{ - // MessageBox.Show( - // "动画名称不能为空".Translate(), - // "", - // MessageBoxButton.OK, - // MessageBoxImage.Warning - // ); - // return; - //} IsCancel = false; Close(); }