2024-03-07 10:41:18 +00:00
|
|
|
|
using System.ComponentModel;
|
2024-01-18 13:39:23 +00:00
|
|
|
|
using System.Text;
|
2023-12-30 14:54:49 +00:00
|
|
|
|
using System.Windows;
|
2023-12-23 14:44:10 +00:00
|
|
|
|
using System.Windows.Controls;
|
2024-03-07 10:41:18 +00:00
|
|
|
|
using HKW.HKWUtils;
|
|
|
|
|
using LinePutScript.Localization.WPF;
|
|
|
|
|
using Panuon.WPF.UI;
|
2024-02-03 16:08:31 +00:00
|
|
|
|
using VPet.Solution.Models.SettingEditor;
|
2023-12-23 14:44:10 +00:00
|
|
|
|
using VPet.Solution.ViewModels;
|
2024-01-13 13:56:21 +00:00
|
|
|
|
using VPet.Solution.Views.SaveViewer;
|
2024-01-07 14:57:27 +00:00
|
|
|
|
using VPet.Solution.Views.SettingEditor;
|
2024-02-03 16:08:31 +00:00
|
|
|
|
using VPet_Simulator.Windows.Interface;
|
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-13 13:56:21 +00:00
|
|
|
|
public SettingWindow SettingWindow { get; } = new();
|
|
|
|
|
public SaveWindow SaveWindow { get; } = new();
|
2024-01-07 14:57:27 +00:00
|
|
|
|
|
2023-12-18 14:53:56 +00:00
|
|
|
|
public MainWindow()
|
2024-03-09 18:05:27 +00:00
|
|
|
|
{
|
2023-12-18 14:53:56 +00:00
|
|
|
|
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-03-07 10:41:18 +00:00
|
|
|
|
private void MainWindow_Closed(object? sender, EventArgs e)
|
2023-12-23 14:44:10 +00:00
|
|
|
|
{
|
2024-03-09 18:05:27 +00:00
|
|
|
|
if (ModSettingModel.LocalMods != null)
|
|
|
|
|
foreach (var mod in ModSettingModel.LocalMods)
|
|
|
|
|
mod.Value.Image?.CloseStream();
|
2024-01-07 14:57:27 +00:00
|
|
|
|
SettingWindow.CloseX();
|
2024-01-13 13:56:21 +00:00
|
|
|
|
SaveWindow.CloseX();
|
2024-01-07 14:57:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-03-07 10:41:18 +00:00
|
|
|
|
private void Button_OpenSettingEditor_Click(object? sender, RoutedEventArgs e)
|
2024-01-07 14:57:27 +00:00
|
|
|
|
{
|
2024-01-09 15:22:25 +00:00
|
|
|
|
SettingWindow.ShowOrActivate();
|
2023-12-18 14:53:56 +00:00
|
|
|
|
}
|
2024-01-13 13:56:21 +00:00
|
|
|
|
|
2024-03-07 10:41:18 +00:00
|
|
|
|
private void Button_OpenSaveViewer_Click(object? sender, RoutedEventArgs e)
|
2024-01-13 13:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
SaveWindow.ShowOrActivate();
|
|
|
|
|
}
|
2023-12-18 14:53:56 +00:00
|
|
|
|
}
|