11#nullable enable
2- using Flow . Launcher . Plugin . Explorer . Search ;
3- using Flow . Launcher . Plugin . Explorer . Search . Everything ;
4- using Flow . Launcher . Plugin . Explorer . Search . Everything . Exceptions ;
5- using Flow . Launcher . Plugin . Explorer . Search . QuickAccessLinks ;
6- using Flow . Launcher . Plugin . Explorer . Views ;
72using System ;
83using System . Collections . Generic ;
94using System . Diagnostics ;
138using System . Linq ;
149using System . Windows ;
1510using System . Windows . Forms ;
16- using System . Windows . Input ;
11+ using CommunityToolkit . Mvvm . Input ;
12+ using Flow . Launcher . Plugin . Explorer . Search ;
13+ using Flow . Launcher . Plugin . Explorer . Search . Everything ;
14+ using Flow . Launcher . Plugin . Explorer . Search . Everything . Exceptions ;
15+ using Flow . Launcher . Plugin . Explorer . Search . QuickAccessLinks ;
16+ using Flow . Launcher . Plugin . Explorer . Views ;
1717
1818namespace Flow . Launcher . Plugin . Explorer . ViewModels
1919{
20- public class SettingsViewModel : BaseModel
20+ public partial class SettingsViewModel : BaseModel
2121 {
2222 public Settings Settings { get ; set ; }
2323
@@ -36,7 +36,6 @@ public SettingsViewModel(PluginInitContext context, Settings settings)
3636 InitializeActionKeywordModels ( ) ;
3737 }
3838
39-
4039 public void Save ( )
4140 {
4241 Context . API . SaveSettingJsonStorage < Settings > ( ) ;
@@ -48,7 +47,6 @@ public void Save()
4847 private EnumBindingModel < Settings . ContentIndexSearchEngineOption > _selectedContentSearchEngine ;
4948 private EnumBindingModel < Settings . PathEnumerationEngineOption > _selectedPathEnumerationEngine ;
5049
51-
5250 public EnumBindingModel < Settings . IndexSearchEngineOption > SelectedIndexSearchEngine
5351 {
5452 get => _selectedIndexSearchEngine ;
@@ -261,8 +259,7 @@ private void InitializeActionKeywordModels()
261259
262260 public ActionKeywordModel ? SelectedActionKeyword { get ; set ; }
263261
264- public ICommand EditActionKeywordCommand => new RelayCommand ( EditActionKeyword ) ;
265-
262+ [ RelayCommand ]
266263 private void EditActionKeyword ( object obj )
267264 {
268265 if ( SelectedActionKeyword is not { } actionKeyword )
@@ -307,12 +304,6 @@ private void EditActionKeyword(object obj)
307304 public AccessLink ? SelectedQuickAccessLink { get ; set ; }
308305 public AccessLink ? SelectedIndexSearchExcludedPath { get ; set ; }
309306
310-
311-
312- public ICommand RemoveLinkCommand => new RelayCommand ( RemoveLink ) ;
313- public ICommand EditLinkCommand => new RelayCommand ( EditLink ) ;
314- public ICommand AddLinkCommand => new RelayCommand ( AddLink ) ;
315-
316307 public void AppendLink ( string containerName , AccessLink link )
317308 {
318309 var container = containerName switch
@@ -324,6 +315,7 @@ public void AppendLink(string containerName, AccessLink link)
324315 container . Add ( link ) ;
325316 }
326317
318+ [ RelayCommand ]
327319 private void EditLink ( object commandParameter )
328320 {
329321 var ( selectedLink , collection ) = commandParameter switch
@@ -360,7 +352,7 @@ private void ShowUnselectedMessage()
360352 Context . API . ShowMsgBox ( warning ) ;
361353 }
362354
363-
355+ [ RelayCommand ]
364356 private void AddLink ( object commandParameter )
365357 {
366358 var container = commandParameter switch
@@ -385,6 +377,7 @@ private void AddLink(object commandParameter)
385377 container . Add ( newAccessLink ) ;
386378 }
387379
380+ [ RelayCommand ]
388381 private void RemoveLink ( object obj )
389382 {
390383 if ( obj is not string container ) return ;
@@ -435,7 +428,6 @@ private void RemoveLink(object obj)
435428 return path ;
436429 }
437430
438-
439431 internal static void OpenWindowsIndexingOptions ( )
440432 {
441433 var psi = new ProcessStartInfo
@@ -448,39 +440,35 @@ internal static void OpenWindowsIndexingOptions()
448440 Process . Start ( psi ) ;
449441 }
450442
451- private ICommand ? _openFileEditorPathCommand ;
452-
453- public ICommand OpenFileEditorPath => _openFileEditorPathCommand ??= new RelayCommand ( _ =>
443+ [ RelayCommand ]
444+ private void OpenFileEditorPath ( )
454445 {
455446 var path = PromptUserSelectPath ( ResultType . File , Settings . EditorPath != null ? Path . GetDirectoryName ( Settings . EditorPath ) : null ) ;
456447 if ( path is null )
457448 return ;
458449
459450 FileEditorPath = path ;
460- } ) ;
461-
462- private ICommand ? _openFolderEditorPathCommand ;
451+ }
463452
464- public ICommand OpenFolderEditorPath => _openFolderEditorPathCommand ??= new RelayCommand ( _ =>
453+ [ RelayCommand ]
454+ private void OpenFolderEditorPath ( )
465455 {
466456 var path = PromptUserSelectPath ( ResultType . File , Settings . FolderEditorPath != null ? Path . GetDirectoryName ( Settings . FolderEditorPath ) : null ) ;
467457 if ( path is null )
468458 return ;
469459
470460 FolderEditorPath = path ;
471- } ) ;
472-
473- private ICommand ? _openShellPathCommand ;
461+ }
474462
475- public ICommand OpenShellPath => _openShellPathCommand ??= new RelayCommand ( _ =>
463+ [ RelayCommand ]
464+ private void OpenShellPath ( )
476465 {
477466 var path = PromptUserSelectPath ( ResultType . File , Settings . EditorPath != null ? Path . GetDirectoryName ( Settings . EditorPath ) : null ) ;
478467 if ( path is null )
479468 return ;
480469
481470 ShellPath = path ;
482- } ) ;
483-
471+ }
484472
485473 public string FileEditorPath
486474 {
@@ -537,7 +525,6 @@ public int MaxResult
537525 }
538526 }
539527
540-
541528 #region Everything FastSortWarning
542529
543530 public Visibility FastSortWarningVisibility
@@ -593,7 +580,5 @@ public string EverythingInstalledPath
593580 }
594581
595582 #endregion
596-
597-
598583 }
599584}
0 commit comments