1
1
using System . Windows ;
2
- using Flow . Launcher . Core . Resource ;
3
2
using Flow . Launcher . Plugin ;
4
3
using Flow . Launcher . ViewModel ;
5
- using Flow . Launcher . Core ;
6
4
using System . Linq ;
7
5
using System . Collections . Generic ;
8
6
9
7
namespace Flow . Launcher
10
8
{
11
9
public partial class ActionKeywords
12
10
{
13
- private readonly PluginPair plugin ;
14
- private readonly Internationalization translater = InternationalizationManager . Instance ;
15
- private readonly PluginViewModel pluginViewModel ;
11
+ private readonly PluginPair _plugin ;
12
+ private readonly PluginViewModel _pluginViewModel ;
16
13
17
14
public ActionKeywords ( PluginViewModel pluginViewModel )
18
15
{
19
16
InitializeComponent ( ) ;
20
- plugin = pluginViewModel . PluginPair ;
21
- this . pluginViewModel = pluginViewModel ;
17
+ _plugin = pluginViewModel . PluginPair ;
18
+ _pluginViewModel = pluginViewModel ;
22
19
}
23
20
24
21
private void ActionKeyword_OnLoaded ( object sender , RoutedEventArgs e )
25
22
{
26
- tbOldActionKeyword . Text = string . Join ( Query . ActionKeywordSeparator , plugin . Metadata . ActionKeywords . ToArray ( ) ) ;
23
+ tbOldActionKeyword . Text = string . Join ( Query . ActionKeywordSeparator , _plugin . Metadata . ActionKeywords . ToArray ( ) ) ;
27
24
tbAction . Focus ( ) ;
28
25
}
29
26
@@ -34,7 +31,7 @@ private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
34
31
35
32
private void btnDone_OnClick ( object sender , RoutedEventArgs _ )
36
33
{
37
- var oldActionKeywords = plugin . Metadata . ActionKeywords ;
34
+ var oldActionKeywords = _plugin . Metadata . ActionKeywords ;
38
35
39
36
var newActionKeywords = tbAction . Text . Split ( Query . ActionKeywordSeparator ) . ToList ( ) ;
40
37
newActionKeywords . RemoveAll ( string . IsNullOrEmpty ) ;
@@ -48,7 +45,7 @@ private void btnDone_OnClick(object sender, RoutedEventArgs _)
48
45
{
49
46
if ( oldActionKeywords . Count != newActionKeywords . Count )
50
47
{
51
- ReplaceActionKeyword ( plugin . Metadata . ID , removedActionKeywords , addedActionKeywords ) ;
48
+ ReplaceActionKeyword ( _plugin . Metadata . ID , removedActionKeywords , addedActionKeywords ) ;
52
49
return ;
53
50
}
54
51
@@ -58,18 +55,16 @@ private void btnDone_OnClick(object sender, RoutedEventArgs _)
58
55
if ( sortedOldActionKeywords . SequenceEqual ( sortedNewActionKeywords ) )
59
56
{
60
57
// User just changes the sequence of action keywords
61
- var msg = translater . GetTranslation ( "newActionKeywordsSameAsOld" ) ;
62
- MessageBoxEx . Show ( msg ) ;
58
+ App . API . ShowMsgBox ( App . API . GetTranslation ( "newActionKeywordsSameAsOld" ) ) ;
63
59
}
64
60
else
65
61
{
66
- ReplaceActionKeyword ( plugin . Metadata . ID , removedActionKeywords , addedActionKeywords ) ;
62
+ ReplaceActionKeyword ( _plugin . Metadata . ID , removedActionKeywords , addedActionKeywords ) ;
67
63
}
68
64
}
69
65
else
70
66
{
71
- string msg = translater . GetTranslation ( "newActionKeywordsHasBeenAssigned" ) ;
72
- App . API . ShowMsgBox ( msg ) ;
67
+ App . API . ShowMsgBox ( App . API . GetTranslation ( "newActionKeywordsHasBeenAssigned" ) ) ;
73
68
}
74
69
}
75
70
@@ -85,7 +80,7 @@ private void ReplaceActionKeyword(string id, IReadOnlyList<string> removedAction
85
80
}
86
81
87
82
// Update action keywords text and close window
88
- pluginViewModel . OnActionKeywordsChanged ( ) ;
83
+ _pluginViewModel . OnActionKeywordsChanged ( ) ;
89
84
Close ( ) ;
90
85
}
91
86
}
0 commit comments