1- using System . Windows ;
1+ using System . Collections . Generic ;
2+ using System . Linq ;
3+ using System . Windows ;
24using MemPlus . Classes . GUI ;
35using MemPlus . Classes . LOG ;
6+ using Microsoft . Win32 ;
47
58namespace MemPlus . Windows
69{
@@ -62,6 +65,17 @@ private void LoadProperties()
6265
6366 ChbFileSystemCache . IsChecked = Properties . Settings . Default . FileSystemCache ;
6467 ChbStandByCache . IsChecked = Properties . Settings . Default . StandByCache ;
68+ if ( Properties . Settings . Default . ProcessExceptions != null )
69+ {
70+ foreach ( string s in Properties . Settings . Default . ProcessExceptions )
71+ {
72+ LsvExclusions . Items . Add ( s ) ;
73+ }
74+ }
75+ else
76+ {
77+ LsvExclusions . Items . Clear ( ) ;
78+ }
6579
6680 //Theme
6781 CboStyle . Text = Properties . Settings . Default . VisualStyle ;
@@ -81,11 +95,13 @@ private void SaveProperties()
8195 if ( ChbTopmost . IsChecked != null ) Properties . Settings . Default . Topmost = ChbTopmost . IsChecked . Value ;
8296 if ( ChbRamMonitor . IsChecked != null ) Properties . Settings . Default . RamMonitor = ChbRamMonitor . IsChecked . Value ;
8397 if ( ChbDisableInactive . IsChecked != null ) Properties . Settings . Default . DisableOnInactive = ChbDisableInactive . IsChecked . Value ;
84- if ( ItbRamMonitorTimeout . Value != null ) Properties . Settings . Default . RamMonitorInterval = ( int ) ItbRamMonitorTimeout . Value ;
98+ if ( ItbRamMonitorTimeout . Value != null ) Properties . Settings . Default . RamMonitorInterval = ( int ) ItbRamMonitorTimeout . Value ;
8599
86100 //RAM Optimizer
87101 if ( ChbFileSystemCache . IsChecked != null ) Properties . Settings . Default . FileSystemCache = ChbFileSystemCache . IsChecked . Value ;
88102 if ( ChbStandByCache . IsChecked != null ) Properties . Settings . Default . StandByCache = ChbStandByCache . IsChecked . Value ;
103+ List < string > exclusionList = LsvExclusions . Items . Cast < string > ( ) . ToList ( ) ;
104+ Properties . Settings . Default . ProcessExceptions = exclusionList ;
89105
90106 //Theme
91107 Properties . Settings . Default . VisualStyle = CboStyle . Text ;
@@ -129,5 +145,47 @@ private void BtnSave_OnClick(object sender, RoutedEventArgs e)
129145 {
130146 SaveProperties ( ) ;
131147 }
148+
149+ private void BtnFileView_OnClick ( object sender , RoutedEventArgs e )
150+ {
151+ OpenFileDialog ofd = new OpenFileDialog { Filter = "All files (*.*)|*.*" } ;
152+
153+ if ( ofd . ShowDialog ( ) == true )
154+ {
155+ TxtExclusion . Text = ofd . FileName ;
156+ }
157+ }
158+
159+ private void BtnAddExclusion_OnClick ( object sender , RoutedEventArgs e )
160+ {
161+ if ( TxtExclusion . Text . Length == 0 ) return ;
162+
163+ if ( System . IO . File . Exists ( TxtExclusion . Text ) )
164+ {
165+ LsvExclusions . Items . Add ( TxtExclusion . Text ) ;
166+ TxtExclusion . Text = "" ;
167+ }
168+ else
169+ {
170+ MessageBox . Show ( "The selected file does not exist!" , "MemPlus" , MessageBoxButton . OK , MessageBoxImage . Error ) ;
171+ }
172+ }
173+
174+ private void CopyExclusionMenuItem_OnClick ( object sender , RoutedEventArgs e )
175+ {
176+ if ( LsvExclusions . SelectedItems . Count == 0 ) return ;
177+ Clipboard . SetText ( LsvExclusions . SelectedItem . ToString ( ) ) ;
178+ }
179+
180+ private void DeleteExclusionMenuItem_OnClick ( object sender , RoutedEventArgs e )
181+ {
182+ if ( LsvExclusions . SelectedItems . Count == 0 ) return ;
183+ LsvExclusions . Items . Remove ( LsvExclusions . SelectedItem ) ;
184+ }
185+
186+ private void ClearExclusionsMenuItem_OnClick ( object sender , RoutedEventArgs e )
187+ {
188+ LsvExclusions . Items . Clear ( ) ;
189+ }
132190 }
133191}
0 commit comments