Skip to content

Commit 8f1c6b0

Browse files
committed
设置保存优化
1 parent 8d30b99 commit 8f1c6b0

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

StickyHomeworks/MainWindow.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@
9393
<materialDesign:DialogHost Identifier="MainWindow">
9494
<materialDesign:DrawerHost IsBottomDrawerOpen="{Binding ViewModel.IsDrawerOpened}"
9595
IsTabStop="False"
96-
FocusVisualStyle="{x:Null}">
96+
FocusVisualStyle="{x:Null}"
97+
DrawerClosing="DrawerHost_OnDrawerClosing">
9798
<!-- 作业编辑 -->
9899
<materialDesign:DrawerHost.BottomDrawerContent>
99100
<Grid Margin="16">

StickyHomeworks/MainWindow.xaml.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using System.Windows.Navigation;
1414
using System.Windows.Shapes;
1515
using ElysiaFramework;
16+
using MaterialDesignThemes.Wpf;
1617
using Microsoft.Xaml.Behaviors;
1718
using StickyHomeworks.Behaviors;
1819
using StickyHomeworks.Models;
@@ -301,4 +302,10 @@ orderby i.Subject
301302
dialog.Dispose();
302303
ViewModel.IsWorking = false;
303304
}
305+
306+
private void DrawerHost_OnDrawerClosing(object? sender, DrawerClosingEventArgs e)
307+
{
308+
SettingsService.SaveSettings();
309+
ProfileService.SaveProfile();
310+
}
304311
}

StickyHomeworks/Views/SettingsWindow.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Windows;
44
using System.Windows.Input;
55
using ClassIsland.Services;
6+
using ElysiaFramework;
67
using ElysiaFramework.Controls;
78
using MaterialDesignThemes.Wpf;
89
using StickyHomeworks.Models;
@@ -98,6 +99,7 @@ private void SettingsWindow_OnClosing(object? sender, CancelEventArgs e)
9899
{
99100
e.Cancel = true;
100101
Hide();
102+
AppEx.GetService<SettingsService>().SaveSettings();
101103
IsOpened = false;
102104
}
103105

0 commit comments

Comments
 (0)