VPet/VPet.Solution/Views/MainWindow.xaml.cs

43 lines
947 B
C#
Raw Normal View History

2023-12-23 14:44:10 +00:00
using HKW.HKWUtils;
using Panuon.WPF.UI;
2023-12-30 14:54:49 +00:00
using System.ComponentModel;
using System.Windows;
2023-12-23 14:44:10 +00:00
using System.Windows.Controls;
using VPet.Solution.ViewModels;
2024-01-07 14:57:27 +00:00
using VPet.Solution.Views.SettingEditor;
2023-12-18 14:53:56 +00:00
2023-12-23 14:44:10 +00:00
namespace VPet.Solution.Views;
2023-12-18 14:53:56 +00:00
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : WindowX
{
2023-12-30 14:54:49 +00:00
public MainWindowVM ViewModel => (MainWindowVM)DataContext;
2023-12-23 14:44:10 +00:00
2024-01-07 14:57:27 +00:00
public SettingWindow SettingWindow { get; set; } = new();
2023-12-18 14:53:56 +00:00
public MainWindow()
{
if (App.IsDone)
{
Close();
return;
}
InitializeComponent();
2023-12-30 14:54:49 +00:00
this.SetViewModel<MainWindowVM>();
2024-01-07 14:57:27 +00:00
Closed += MainWindow_Closed;
2023-12-23 14:44:10 +00:00
}
2024-01-07 14:57:27 +00:00
private void MainWindow_Closed(object sender, EventArgs e)
2023-12-23 14:44:10 +00:00
{
2024-01-07 14:57:27 +00:00
SettingWindow.CloseX();
}
private void Button_OpenSettingEditor_Click(object sender, RoutedEventArgs e)
{
2024-01-09 15:22:25 +00:00
SettingWindow.ShowOrActivate();
2023-12-18 14:53:56 +00:00
}
}