VPet/VPet.Solution/Views/MainWindow.xaml.cs
2024-01-13 21:56:21 +08:00

51 lines
1.2 KiB
C#

using HKW.HKWUtils;
using Panuon.WPF.UI;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using VPet.Solution.ViewModels;
using VPet.Solution.Views.SaveViewer;
using VPet.Solution.Views.SettingEditor;
namespace VPet.Solution.Views;
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : WindowX
{
public MainWindowVM ViewModel => (MainWindowVM)DataContext;
public SettingWindow SettingWindow { get; } = new();
public SaveWindow SaveWindow { get; } = new();
public MainWindow()
{
if (App.IsDone)
{
Close();
return;
}
InitializeComponent();
this.SetViewModel<MainWindowVM>();
Closed += MainWindow_Closed;
}
private void MainWindow_Closed(object sender, EventArgs e)
{
SettingWindow.CloseX();
SaveWindow.CloseX();
}
private void Button_OpenSettingEditor_Click(object sender, RoutedEventArgs e)
{
SettingWindow.ShowOrActivate();
}
private void Button_OpenSaveEditor_Click(object sender, RoutedEventArgs e)
{
SaveWindow.ShowOrActivate();
}
}