Skip to content

Commit ab1fe67

Browse files
committed
Remove command parameter
1 parent d429304 commit ab1fe67

File tree

2 files changed

+27
-25
lines changed

2 files changed

+27
-25
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -328,37 +328,36 @@ public void AppendLink(string containerName, AccessLink link)
328328
container.Add(link);
329329
}
330330

331-
332331
[RelayCommand]
333-
private void EditIndexSearchExcludePaths(object commandParameter)
332+
private void EditIndexSearchExcludePaths()
334333
{
335-
334+
var selectedLink = SelectedIndexSearchExcludedPath;
336335
var collection = Settings.IndexSearchExcludedSubdirectoryPaths;
337336

338-
if (SelectedIndexSearchExcludedPath is null)
337+
if (selectedLink is null)
339338
{
340339
ShowUnselectedMessage();
341340
return;
342341
}
343342

344-
var path = PromptUserSelectPath(SelectedIndexSearchExcludedPath.Type,
345-
SelectedIndexSearchExcludedPath.Type == ResultType.Folder
346-
? SelectedIndexSearchExcludedPath.Path
347-
: Path.GetDirectoryName(SelectedIndexSearchExcludedPath.Path));
343+
var path = PromptUserSelectPath(selectedLink.Type,
344+
selectedLink.Type == ResultType.Folder
345+
? selectedLink.Path
346+
: Path.GetDirectoryName(selectedLink.Path));
348347

349348
if (path is null)
350349
return;
351350

352-
var selectedType = SelectedIndexSearchExcludedPath.Type;
353-
collection.Remove(SelectedIndexSearchExcludedPath);
351+
var selectedType = selectedLink.Type;
352+
collection.Remove(selectedLink);
354353
collection.Add(new AccessLink
355354
{
356355
Path = path, Type = selectedType, Name = path.GetPathName()
357356
});
358357
}
359358

360359
[RelayCommand]
361-
private void AddIndexSearchExcludePaths(object commandParameter)
360+
private void AddIndexSearchExcludePaths()
362361
{
363362
var container = Settings.IndexSearchExcludedSubdirectoryPaths;
364363

@@ -378,30 +377,37 @@ private void AddIndexSearchExcludePaths(object commandParameter)
378377
}
379378

380379
[RelayCommand]
381-
private void EditQuickAccessLink(object commandParameter)
380+
private void EditQuickAccessLink()
382381
{
383-
if (SelectedQuickAccessLink is null)
382+
var selectedLink = SelectedQuickAccessLink;
383+
var collection = Settings.QuickAccessLinks;
384+
385+
if (selectedLink is null)
384386
{
385387
ShowUnselectedMessage();
386388
return;
387389
}
388-
var quickAccessLinkSettings = new QuickAccessLinkSettings(Settings.QuickAccessLinks,SelectedQuickAccessLink);
389-
if (quickAccessLinkSettings.ShowDialog() == true) Save();
390+
var quickAccessLinkSettings = new QuickAccessLinkSettings(collection, SelectedQuickAccessLink);
391+
if (quickAccessLinkSettings.ShowDialog() == true)
392+
{
393+
Save();
394+
}
390395
}
391396

392397
[RelayCommand]
393-
private void AddQuickAccessLink(object commandParameter)
398+
private void AddQuickAccessLink()
394399
{
395400
var quickAccessLinkSettings = new QuickAccessLinkSettings(Settings.QuickAccessLinks);
396-
if (quickAccessLinkSettings.ShowDialog() == true) Save();
401+
if (quickAccessLinkSettings.ShowDialog() == true)
402+
{
403+
Save();
404+
}
397405
}
398-
399-
400406

401407
[RelayCommand]
402-
private void RemoveLink(object obj)
408+
private void RemoveLink(object commandParameter)
403409
{
404-
if (obj is not string container) return;
410+
if (commandParameter is not string container) return;
405411

406412
switch (container)
407413
{

Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -785,13 +785,11 @@
785785
MinWidth="100"
786786
Margin="{StaticResource SettingPanelItemLeftMargin}"
787787
Command="{Binding EditQuickAccessLinkCommand}"
788-
CommandParameter="QuickAccessLink"
789788
Content="{DynamicResource plugin_explorer_edit}" />
790789
<Button
791790
MinWidth="100"
792791
Margin="{StaticResource SettingPanelItemLeftMargin}"
793792
Command="{Binding AddQuickAccessLinkCommand}"
794-
CommandParameter="QuickAccessLink"
795793
Content="{DynamicResource plugin_explorer_add}" />
796794
</StackPanel>
797795
</Grid>
@@ -852,13 +850,11 @@
852850
MinWidth="100"
853851
Margin="{StaticResource SettingPanelItemLeftMargin}"
854852
Command="{Binding EditIndexSearchExcludePathsCommand}"
855-
CommandParameter="IndexSearchExcludedPaths"
856853
Content="{DynamicResource plugin_explorer_edit}" />
857854
<Button
858855
MinWidth="100"
859856
Margin="{StaticResource SettingPanelItemLeftMargin}"
860857
Command="{Binding AddIndexSearchExcludePathsCommand}"
861-
CommandParameter="IndexSearchExcludedPaths"
862858
Content="{DynamicResource plugin_explorer_add}" />
863859
</StackPanel>
864860
</Grid>

0 commit comments

Comments
 (0)