@@ -20,7 +20,7 @@ public SettingsWindow(MainWindow mainWindow, LogController logController)
2020
2121 InitializeComponent ( ) ;
2222 ChangeVisualStyle ( ) ;
23- LoadSettings ( ) ;
23+ LoadProperties ( ) ;
2424
2525 _mainWindow = mainWindow ;
2626
@@ -39,31 +39,66 @@ private void ChangeVisualStyle()
3939 _logController . AddLog ( new ApplicationLog ( "Done changing SettingsWindow theme style" ) ) ;
4040 }
4141
42- private void LoadSettings ( )
42+ private void LoadProperties ( )
4343 {
44+ _logController . AddLog ( new ApplicationLog ( "Loading properties" ) ) ;
45+
4446 //TODO
47+ //General
48+ ChbAutoUpdate . IsChecked = Properties . Settings . Default . AutoUpdate ;
49+ if ( Properties . Settings . Default . Topmost )
50+ {
51+ ChbTopmost . IsChecked = Properties . Settings . Default . Topmost ;
52+ Topmost = true ;
53+ }
54+ else
55+ {
56+ Topmost = false ;
57+ }
58+
59+ ChbRamMonitor . IsChecked = Properties . Settings . Default . RamMonitor ;
60+ ChbDisableInactive . IsChecked = Properties . Settings . Default . DisableOnInactive ;
61+ ItbRamMonitorTimeout . Value = Properties . Settings . Default . RamMonitorInterval ;
62+
63+ _logController . AddLog ( new ApplicationLog ( "Properties have been loaded" ) ) ;
4564 }
4665
47- private void SaveSettings ( )
66+ private void SaveProperties ( )
4867 {
68+ _logController . AddLog ( new ApplicationLog ( "Saving properties" ) ) ;
69+
4970 //TODO
71+ //General
72+ if ( ChbAutoUpdate . IsChecked != null ) Properties . Settings . Default . AutoUpdate = ChbAutoUpdate . IsChecked . Value ;
73+ if ( ChbTopmost . IsChecked != null ) Properties . Settings . Default . Topmost = ChbTopmost . IsChecked . Value ;
74+ if ( ChbRamMonitor . IsChecked != null ) Properties . Settings . Default . RamMonitor = ChbRamMonitor . IsChecked . Value ;
75+ if ( ChbDisableInactive . IsChecked != null ) Properties . Settings . Default . DisableOnInactive = ChbDisableInactive . IsChecked . Value ;
76+ if ( ItbRamMonitorTimeout . Value != null ) Properties . Settings . Default . RamMonitorInterval = ( int ) ItbRamMonitorTimeout . Value ;
77+
5078 Properties . Settings . Default . Save ( ) ;
5179
5280 _mainWindow . ChangeVisualStyle ( ) ;
5381 _mainWindow . LoadProperties ( ) ;
5482
55- _logController . AddLog ( new ApplicationLog ( "Settings have been saved" ) ) ;
83+ _logController . AddLog ( new ApplicationLog ( "Properties have been saved" ) ) ;
5684
57- MessageBox . Show ( "All settings have been saved!" , "MemPlus" , MessageBoxButton . OK , MessageBoxImage . Information ) ;
85+ MessageBox . Show ( "All properties have been saved!" , "MemPlus" , MessageBoxButton . OK , MessageBoxImage . Information ) ;
5886 }
5987
6088 private void ResetSettings ( )
6189 {
90+ _logController . AddLog ( new ApplicationLog ( "Resetting properties" ) ) ;
91+
6292 Properties . Settings . Default . Reset ( ) ;
6393 Properties . Settings . Default . Save ( ) ;
6494
6595 _mainWindow . ChangeVisualStyle ( ) ;
6696 _mainWindow . LoadProperties ( ) ;
97+ LoadProperties ( ) ;
98+
99+ MessageBox . Show ( "All settings have been reset!" , "MemPlus" , MessageBoxButton . OK , MessageBoxImage . Information ) ;
100+
101+ _logController . AddLog ( new ApplicationLog ( "Properties have been reset" ) ) ;
67102 }
68103
69104 private void BtnReset_OnClick ( object sender , RoutedEventArgs e )
@@ -73,7 +108,7 @@ private void BtnReset_OnClick(object sender, RoutedEventArgs e)
73108
74109 private void BtnSave_OnClick ( object sender , RoutedEventArgs e )
75110 {
76- SaveSettings ( ) ;
111+ SaveProperties ( ) ;
77112 }
78113 }
79114}
0 commit comments