1
1
#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 ;
7
2
using System ;
8
3
using System . Collections . Generic ;
9
4
using System . Diagnostics ;
13
8
using System . Linq ;
14
9
using System . Windows ;
15
10
using 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 ;
17
17
18
18
namespace Flow . Launcher . Plugin . Explorer . ViewModels
19
19
{
20
- public class SettingsViewModel : BaseModel
20
+ public partial class SettingsViewModel : BaseModel
21
21
{
22
22
public Settings Settings { get ; set ; }
23
23
@@ -36,7 +36,6 @@ public SettingsViewModel(PluginInitContext context, Settings settings)
36
36
InitializeActionKeywordModels ( ) ;
37
37
}
38
38
39
-
40
39
public void Save ( )
41
40
{
42
41
Context . API . SaveSettingJsonStorage < Settings > ( ) ;
@@ -48,7 +47,6 @@ public void Save()
48
47
private EnumBindingModel < Settings . ContentIndexSearchEngineOption > _selectedContentSearchEngine ;
49
48
private EnumBindingModel < Settings . PathEnumerationEngineOption > _selectedPathEnumerationEngine ;
50
49
51
-
52
50
public EnumBindingModel < Settings . IndexSearchEngineOption > SelectedIndexSearchEngine
53
51
{
54
52
get => _selectedIndexSearchEngine ;
@@ -261,8 +259,7 @@ private void InitializeActionKeywordModels()
261
259
262
260
public ActionKeywordModel ? SelectedActionKeyword { get ; set ; }
263
261
264
- public ICommand EditActionKeywordCommand => new RelayCommand ( EditActionKeyword ) ;
265
-
262
+ [ RelayCommand ]
266
263
private void EditActionKeyword ( object obj )
267
264
{
268
265
if ( SelectedActionKeyword is not { } actionKeyword )
@@ -307,12 +304,6 @@ private void EditActionKeyword(object obj)
307
304
public AccessLink ? SelectedQuickAccessLink { get ; set ; }
308
305
public AccessLink ? SelectedIndexSearchExcludedPath { get ; set ; }
309
306
310
-
311
-
312
- public ICommand RemoveLinkCommand => new RelayCommand ( RemoveLink ) ;
313
- public ICommand EditLinkCommand => new RelayCommand ( EditLink ) ;
314
- public ICommand AddLinkCommand => new RelayCommand ( AddLink ) ;
315
-
316
307
public void AppendLink ( string containerName , AccessLink link )
317
308
{
318
309
var container = containerName switch
@@ -324,6 +315,7 @@ public void AppendLink(string containerName, AccessLink link)
324
315
container . Add ( link ) ;
325
316
}
326
317
318
+ [ RelayCommand ]
327
319
private void EditLink ( object commandParameter )
328
320
{
329
321
var ( selectedLink , collection ) = commandParameter switch
@@ -360,7 +352,7 @@ private void ShowUnselectedMessage()
360
352
Context . API . ShowMsgBox ( warning ) ;
361
353
}
362
354
363
-
355
+ [ RelayCommand ]
364
356
private void AddLink ( object commandParameter )
365
357
{
366
358
var container = commandParameter switch
@@ -385,6 +377,7 @@ private void AddLink(object commandParameter)
385
377
container . Add ( newAccessLink ) ;
386
378
}
387
379
380
+ [ RelayCommand ]
388
381
private void RemoveLink ( object obj )
389
382
{
390
383
if ( obj is not string container ) return ;
@@ -435,7 +428,6 @@ private void RemoveLink(object obj)
435
428
return path ;
436
429
}
437
430
438
-
439
431
internal static void OpenWindowsIndexingOptions ( )
440
432
{
441
433
var psi = new ProcessStartInfo
@@ -448,39 +440,35 @@ internal static void OpenWindowsIndexingOptions()
448
440
Process . Start ( psi ) ;
449
441
}
450
442
451
- private ICommand ? _openFileEditorPathCommand ;
452
-
453
- public ICommand OpenFileEditorPath => _openFileEditorPathCommand ??= new RelayCommand ( _ =>
443
+ [ RelayCommand ]
444
+ private void OpenFileEditorPath ( )
454
445
{
455
446
var path = PromptUserSelectPath ( ResultType . File , Settings . EditorPath != null ? Path . GetDirectoryName ( Settings . EditorPath ) : null ) ;
456
447
if ( path is null )
457
448
return ;
458
449
459
450
FileEditorPath = path ;
460
- } ) ;
461
-
462
- private ICommand ? _openFolderEditorPathCommand ;
451
+ }
463
452
464
- public ICommand OpenFolderEditorPath => _openFolderEditorPathCommand ??= new RelayCommand ( _ =>
453
+ [ RelayCommand ]
454
+ private void OpenFolderEditorPath ( )
465
455
{
466
456
var path = PromptUserSelectPath ( ResultType . File , Settings . FolderEditorPath != null ? Path . GetDirectoryName ( Settings . FolderEditorPath ) : null ) ;
467
457
if ( path is null )
468
458
return ;
469
459
470
460
FolderEditorPath = path ;
471
- } ) ;
472
-
473
- private ICommand ? _openShellPathCommand ;
461
+ }
474
462
475
- public ICommand OpenShellPath => _openShellPathCommand ??= new RelayCommand ( _ =>
463
+ [ RelayCommand ]
464
+ private void OpenShellPath ( )
476
465
{
477
466
var path = PromptUserSelectPath ( ResultType . File , Settings . EditorPath != null ? Path . GetDirectoryName ( Settings . EditorPath ) : null ) ;
478
467
if ( path is null )
479
468
return ;
480
469
481
470
ShellPath = path ;
482
- } ) ;
483
-
471
+ }
484
472
485
473
public string FileEditorPath
486
474
{
@@ -537,7 +525,6 @@ public int MaxResult
537
525
}
538
526
}
539
527
540
-
541
528
#region Everything FastSortWarning
542
529
543
530
public Visibility FastSortWarningVisibility
@@ -593,7 +580,5 @@ public string EverythingInstalledPath
593
580
}
594
581
595
582
#endregion
596
-
597
-
598
583
}
599
584
}
0 commit comments