Load and save config

This commit is contained in:
huiyadanli
2023-10-05 22:13:48 +08:00
parent 21d7a30023
commit f1b26f4d70
19 changed files with 279 additions and 53 deletions

View File

@@ -17,14 +17,18 @@ using System.Collections.ObjectModel;
using BetterGenshinImpact.View.Pages;
using Wpf.Ui;
using Wpf.Ui.Controls;
using BetterGenshinImpact.Service.Interface;
using BetterGenshinImpact.Service;
namespace BetterGenshinImpact.ViewModel
{
public partial class MainWindowViewModel : ObservableObject
{
public MainWindowViewModel(INavigationService navigationService)
{
private readonly IConfigService _configService;
public MainWindowViewModel(INavigationService navigationService, IConfigService configService)
{
_configService = configService;
}
@@ -37,6 +41,7 @@ namespace BetterGenshinImpact.ViewModel
[RelayCommand]
private void OnClosed()
{
_configService.Save();
WeakReferenceMessenger.Default.Send(new PropertyChangedMessage<object>(this, "Close", "", ""));
Debug.WriteLine("MainWindowViewModel Closed");
Application.Current.Shutdown();