- 切换本体宠物时,没有宠物导致的软件崩溃
- 无法添加动画的问题
This commit is contained in:
Hakoyu 2024-05-06 21:14:25 +08:00
parent bf1f989a57
commit 4097408c81
6 changed files with 13 additions and 19 deletions

View File

@ -16,7 +16,6 @@ public class AnimeModel : ObservableObjectX, ICloneable<AnimeModel>
public AnimeModel() { }
public AnimeModel(string imagesPath)
: this()
{
foreach (var file in Directory.EnumerateFiles(imagesPath))
{

View File

@ -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

View File

@ -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;

View File

@ -43,7 +43,7 @@ public class WorkPageVM : ObservableObjectX
{
if (e.NewValue is false)
{
if (CurrentPet.FromMain)
if (CurrentPet?.FromMain is false)
{
CurrentPet = null!;
}

View File

@ -11,6 +11,7 @@
Title="SelectGraphTypeWindow"
Width="500"
Height="300"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<Window.Resources>
<ResourceDictionary Source="/VPet-Simulator.Windows.Interface;component/ResourceStyle.xaml" />

View File

@ -32,7 +32,7 @@ public partial class SelectGraphTypeWindow : Window
public SelectGraphTypeWindow()
{
InitializeComponent();
this.SetDataContext<SelectGraphTypeWindowVM>();
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();
}