Skip to content

Commit ab97a5c

Browse files
committed
Fix Plugin list unselected item bug
1 parent 49b9e97 commit ab97a5c

File tree

4 files changed

+14
-19
lines changed

4 files changed

+14
-19
lines changed

Flow.Launcher/ActionKeywords.xaml.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,17 @@
88

99
namespace Flow.Launcher
1010
{
11-
public partial class ActionKeywords : Window
11+
public partial class ActionKeywords
1212
{
1313
private readonly PluginPair plugin;
14-
private Settings settings;
1514
private readonly Internationalization translater = InternationalizationManager.Instance;
1615
private readonly PluginViewModel pluginViewModel;
1716

18-
public ActionKeywords(string pluginId, Settings settings, PluginViewModel pluginViewModel)
17+
public ActionKeywords(PluginViewModel pluginViewModel)
1918
{
2019
InitializeComponent();
21-
plugin = PluginManager.GetPluginForId(pluginId);
22-
this.settings = settings;
20+
plugin = pluginViewModel.PluginPair;
2321
this.pluginViewModel = pluginViewModel;
24-
if (plugin == null)
25-
{
26-
MessageBox.Show(translater.GetTranslation("cannotFindSpecifiedPlugin"));
27-
Close();
28-
}
2922
}
3023

3124
private void ActionKeyword_OnLoaded(object sender, RoutedEventArgs e)

Flow.Launcher/SettingWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,8 +1192,8 @@
11921192
Height="34"
11931193
Margin="5,0,0,0"
11941194
HorizontalAlignment="Right"
1195-
Click="OnPluginActionKeywordsClick"
11961195
Content="{Binding ActionKeywordsText}"
1196+
Command="{Binding SetActionKeywordsCommand}"
11971197
Cursor="Hand"
11981198
DockPanel.Dock="Right"
11991199
FontWeight="Bold"

Flow.Launcher/SettingWindow.xaml.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,6 @@ private void OnPluginPriorityClick(object sender, RoutedEventArgs e)
194194
}
195195
}
196196

197-
private void OnPluginActionKeywordsClick(object sender, RoutedEventArgs e)
198-
{
199-
var id = viewModel.SelectedPlugin.PluginPair.Metadata.ID;
200-
ActionKeywords changeKeywordsWindow = new ActionKeywords(id, settings, viewModel.SelectedPlugin);
201-
changeKeywordsWindow.ShowDialog();
202-
}
203-
204197
private void OnPluginNameClick(object sender, MouseButtonEventArgs e)
205198
{
206199
if (e.ChangedButton == MouseButton.Left)

Flow.Launcher/ViewModel/PluginViewModel.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
using Flow.Launcher.Infrastructure.Image;
55
using Flow.Launcher.Core.Plugin;
66
using System.Windows.Controls;
7+
using CommunityToolkit.Mvvm.Input;
78

89
namespace Flow.Launcher.ViewModel
910
{
10-
public class PluginViewModel : BaseModel
11+
public partial class PluginViewModel : BaseModel
1112
{
1213
private readonly PluginPair _pluginPair;
1314
public PluginPair PluginPair
@@ -36,6 +37,7 @@ public bool IsExpanded
3637
set
3738
{
3839
_isExpanded = value;
40+
3941
OnPropertyChanged();
4042
OnPropertyChanged(nameof(SettingControl));
4143
}
@@ -70,6 +72,13 @@ public void ChangePriority(int newPriority)
7072
}
7173

7274
public static bool IsActionKeywordRegistered(string newActionKeyword) => PluginManager.ActionKeywordRegistered(newActionKeyword);
75+
76+
[RelayCommand]
77+
private void SetActionKeywords()
78+
{
79+
ActionKeywords changeKeywordsWindow = new ActionKeywords(this);
80+
changeKeywordsWindow.ShowDialog();
81+
}
7382
}
7483

7584
}

0 commit comments

Comments
 (0)