@@ -331,16 +331,26 @@ private void menuSaveOne_Click(object sender, RoutedEventArgs e)
331331 MessageBox . Show ( "Please choose one project!" ) ;
332332 }
333333
334- SelectedFile . Save ( ) ;
334+ try
335+ {
336+ SelectedFile . Save ( ) ;
337+ MessageBox . Show ( $ "File saved:\r \n { SelectedFile . FullFilePath } ", "Success" , MessageBoxButton . OK , MessageBoxImage . Information ) ;
338+ }
339+ catch ( Exception ex )
340+ {
341+ MessageBox . Show ( $@ "File save faild:\r\n{ SelectedFile . FullFilePath }
342+
343+ { ex . Message } ", "Success" , MessageBoxButton . OK , MessageBoxImage . Error ) ;
344+ }
335345
336- MessageBox . Show ( $ "File saved:\r \n { SelectedFile . FullFilePath } ") ;
337346 }
338347
339348 private void menuSaveAll_Click ( object sender , RoutedEventArgs e )
340349 {
341350 txtPath . Focus ( ) ;
342351
343352 int i = 0 ;
353+ List < string > notSaved = new List < string > ( ) ;
344354 foreach ( var projectFile in ProjectFiles )
345355 {
346356 try
@@ -350,15 +360,52 @@ private void menuSaveAll_Click(object sender, RoutedEventArgs e)
350360 }
351361 catch
352362 {
363+ notSaved . Add ( projectFile . FileName ) ;
364+ }
365+ }
366+ var msg = $ "All files saved: { i } /{ ProjectFiles . Count } ";
367+ if ( i < ProjectFiles . Count )
368+ {
369+ msg += @"
370+
371+ The following files are not saved:
353372
373+ " ;
374+ foreach ( var file in ProjectFiles )
375+ {
376+ msg += file . FileName + Environment . NewLine ;
354377 }
355378 }
356- MessageBox . Show ( $ "All files saved: { i } /{ ProjectFiles . Count } ") ;
379+
380+ MessageBox . Show ( msg , "Complete" , MessageBoxButton . OK , MessageBoxImage . Information ) ;
357381 }
358382
359383
384+
360385 #endregion
361386
387+ private void btnRemoveKeywords_Click ( object sender , RoutedEventArgs e )
388+ {
389+ txtRemoveKeywords . Text . Split ( new [ ] { "," } , StringSplitOptions . RemoveEmptyEntries )
390+ . ToList ( )
391+ . ForEach ( kw =>
392+ {
393+ var keyword = kw . Trim ( ) ;
394+ if ( keyword . Length == 0 )
395+ {
396+ return ;
397+ }
362398
399+ var tobeRemvoe = ProjectFiles . Where ( z => z . FileName . Contains ( keyword , StringComparison . OrdinalIgnoreCase ) ) . ToList ( ) ;
400+ tobeRemvoe . ForEach ( z => ProjectFiles . Remove ( z ) ) ;
401+ } ) ;
402+ }
403+
404+ private void btnRemoveFileItem_Click ( object sender , RoutedEventArgs e )
405+ {
406+ var propertyGroup = ( PropertyGroup ) ( ( Button ) e . OriginalSource ) . DataContext ;
407+ ProjectFiles . Remove ( propertyGroup ) ;
408+ e . Handled = true ;
409+ }
363410 }
364411}
0 commit comments