1
- using System . Windows ;
1
+ using System . Windows ;
2
2
using Flow . Launcher . Core . Plugin ;
3
3
using Flow . Launcher . Core . Resource ;
4
4
using Flow . Launcher . Infrastructure . Exception ;
5
5
using Flow . Launcher . Infrastructure . UserSettings ;
6
6
using Flow . Launcher . Plugin ;
7
+ using Flow . Launcher . ViewModel ;
7
8
8
9
namespace Flow . Launcher
9
10
{
@@ -12,13 +13,14 @@ public partial class ActionKeywords : Window
12
13
private PluginPair _plugin ;
13
14
private Settings _settings ;
14
15
private readonly Internationalization _translater = InternationalizationManager . Instance ;
16
+ private readonly PluginViewModel pluginViewModel ;
15
17
16
- public ActionKeywords ( string pluginId , Settings settings )
18
+ public ActionKeywords ( string pluginId , Settings settings , PluginViewModel pluginViewModel )
17
19
{
18
20
InitializeComponent ( ) ;
19
21
_plugin = PluginManager . GetPluginForId ( pluginId ) ;
20
22
_settings = settings ;
21
- if ( _plugin == null )
23
+ this . pluginViewModel = pluginViewModel ;
22
24
{
23
25
MessageBox . Show ( _translater . GetTranslation ( "cannotFindSpecifiedPlugin" ) ) ;
24
26
Close ( ) ;
@@ -41,10 +43,9 @@ private void btnDone_OnClick(object sender, RoutedEventArgs _)
41
43
var oldActionKeyword = _plugin . Metadata . ActionKeywords [ 0 ] ;
42
44
var newActionKeyword = tbAction . Text . Trim ( ) ;
43
45
newActionKeyword = newActionKeyword . Length > 0 ? newActionKeyword : "*" ;
44
- if ( ! PluginManager . ActionKeywordRegistered ( newActionKeyword ) )
46
+ if ( ! pluginViewModel . IsActionKeywordRegistered ( newActionKeyword ) )
45
47
{
46
- var id = _plugin . Metadata . ID ;
47
- PluginManager . ReplaceActionKeyword ( id , oldActionKeyword , newActionKeyword ) ;
48
+ pluginViewModel . ChangeActionKeyword ( newActionKeyword , oldActionKeyword ) ;
48
49
Close ( ) ;
49
50
}
50
51
else
0 commit comments