Skip to content

Commit 8f012f2

Browse files
committed
fix variable naming convention
1 parent 651e2a9 commit 8f012f2

File tree

2 files changed

+35
-35
lines changed

2 files changed

+35
-35
lines changed

Flow.Launcher/ActionKeywords.xaml.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Windows;
1+
using System.Windows;
22
using Flow.Launcher.Core.Plugin;
33
using Flow.Launcher.Core.Resource;
44
using Flow.Launcher.Infrastructure.Exception;
@@ -10,26 +10,27 @@ namespace Flow.Launcher
1010
{
1111
public partial class ActionKeywords : Window
1212
{
13-
private PluginPair _plugin;
14-
private Settings _settings;
15-
private readonly Internationalization _translater = InternationalizationManager.Instance;
13+
private readonly PluginPair plugin;
14+
private Settings settings;
15+
private readonly Internationalization translater = InternationalizationManager.Instance;
1616
private readonly PluginViewModel pluginViewModel;
1717

1818
public ActionKeywords(string pluginId, Settings settings, PluginViewModel pluginViewModel)
1919
{
2020
InitializeComponent();
21-
_plugin = PluginManager.GetPluginForId(pluginId);
22-
_settings = settings;
21+
plugin = PluginManager.GetPluginForId(pluginId);
22+
this.settings = settings;
2323
this.pluginViewModel = pluginViewModel;
24+
if (plugin == null)
2425
{
25-
MessageBox.Show(_translater.GetTranslation("cannotFindSpecifiedPlugin"));
26+
MessageBox.Show(translater.GetTranslation("cannotFindSpecifiedPlugin"));
2627
Close();
2728
}
2829
}
2930

3031
private void ActionKeyword_OnLoaded(object sender, RoutedEventArgs e)
3132
{
32-
tbOldActionKeyword.Text = string.Join(Query.ActionKeywordSeperater, _plugin.Metadata.ActionKeywords.ToArray());
33+
tbOldActionKeyword.Text = string.Join(Query.ActionKeywordSeperater, plugin.Metadata.ActionKeywords.ToArray());
3334
tbAction.Focus();
3435
}
3536

@@ -40,7 +41,7 @@ private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
4041

4142
private void btnDone_OnClick(object sender, RoutedEventArgs _)
4243
{
43-
var oldActionKeyword = _plugin.Metadata.ActionKeywords[0];
44+
var oldActionKeyword = plugin.Metadata.ActionKeywords[0];
4445
var newActionKeyword = tbAction.Text.Trim();
4546
newActionKeyword = newActionKeyword.Length > 0 ? newActionKeyword : "*";
4647
if (!pluginViewModel.IsActionKeywordRegistered(newActionKeyword))
@@ -50,7 +51,7 @@ private void btnDone_OnClick(object sender, RoutedEventArgs _)
5051
}
5152
else
5253
{
53-
string msg = _translater.GetTranslation("newActionKeywordsHasBeenAssigned");
54+
string msg = translater.GetTranslation("newActionKeywordsHasBeenAssigned");
5455
MessageBox.Show(msg);
5556
}
5657
}

Flow.Launcher/SettingWindow.xaml.cs

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Diagnostics;
32
using System.IO;
43
using System.Windows;
54
using System.Windows.Input;
@@ -21,17 +20,17 @@ public partial class SettingWindow
2120
{
2221
private const string StartupPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
2322

24-
public readonly IPublicAPI _api;
25-
private Settings _settings;
26-
private SettingWindowViewModel _viewModel;
23+
public readonly IPublicAPI API;
24+
private Settings settings;
25+
private SettingWindowViewModel viewModel;
2726

2827
public SettingWindow(IPublicAPI api, SettingWindowViewModel viewModel)
2928
{
3029
InitializeComponent();
31-
_settings = viewModel.Settings;
30+
settings = viewModel.Settings;
3231
DataContext = viewModel;
33-
_viewModel = viewModel;
34-
_api = api;
32+
this.viewModel = viewModel;
33+
API = api;
3534
}
3635

3736
#region General
@@ -94,7 +93,7 @@ private void OnSelectPythonDirectoryClick(object sender, RoutedEventArgs e)
9493
var pythonPath = Path.Combine(pythonDirectory, PluginsLoader.PythonExecutable);
9594
if (File.Exists(pythonPath))
9695
{
97-
_settings.PluginSettings.PythonDirectory = pythonDirectory;
96+
settings.PluginSettings.PythonDirectory = pythonDirectory;
9897
MessageBox.Show("Remember to restart Flow Launcher use new Python path");
9998
}
10099
else
@@ -111,7 +110,7 @@ private void OnSelectPythonDirectoryClick(object sender, RoutedEventArgs e)
111110

112111
private void OnHotkeyControlLoaded(object sender, RoutedEventArgs e)
113112
{
114-
HotkeyControl.SetHotkey(_viewModel.Settings.Hotkey, false);
113+
HotkeyControl.SetHotkey(viewModel.Settings.Hotkey, false);
115114
}
116115

117116
void OnHotkeyChanged(object sender, EventArgs e)
@@ -129,8 +128,8 @@ void OnHotkeyChanged(object sender, EventArgs e)
129128
Application.Current.MainWindow.Visibility = Visibility.Hidden;
130129
}
131130
});
132-
RemoveHotkey(_settings.Hotkey);
133-
_settings.Hotkey = HotkeyControl.CurrentHotkey.ToString();
131+
RemoveHotkey(settings.Hotkey);
132+
settings.Hotkey = HotkeyControl.CurrentHotkey.ToString();
134133
}
135134
}
136135

@@ -159,7 +158,7 @@ void RemoveHotkey(string hotkeyStr)
159158

160159
private void OnDeleteCustomHotkeyClick(object sender, RoutedEventArgs e)
161160
{
162-
var item = _viewModel.SelectedCustomPluginHotkey;
161+
var item = viewModel.SelectedCustomPluginHotkey;
163162
if (item == null)
164163
{
165164
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
@@ -173,17 +172,17 @@ private void OnDeleteCustomHotkeyClick(object sender, RoutedEventArgs e)
173172
MessageBox.Show(deleteWarning, InternationalizationManager.Instance.GetTranslation("delete"),
174173
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
175174
{
176-
_settings.CustomPluginHotkeys.Remove(item);
175+
settings.CustomPluginHotkeys.Remove(item);
177176
RemoveHotkey(item.Hotkey);
178177
}
179178
}
180179

181180
private void OnnEditCustomHotkeyClick(object sender, RoutedEventArgs e)
182181
{
183-
var item = _viewModel.SelectedCustomPluginHotkey;
182+
var item = viewModel.SelectedCustomPluginHotkey;
184183
if (item != null)
185184
{
186-
CustomQueryHotkeySetting window = new CustomQueryHotkeySetting(this, _settings);
185+
CustomQueryHotkeySetting window = new CustomQueryHotkeySetting(this, settings);
187186
window.UpdateItem(item);
188187
window.ShowDialog();
189188
}
@@ -195,7 +194,7 @@ private void OnnEditCustomHotkeyClick(object sender, RoutedEventArgs e)
195194

196195
private void OnAddCustomeHotkeyClick(object sender, RoutedEventArgs e)
197196
{
198-
new CustomQueryHotkeySetting(this, _settings).ShowDialog();
197+
new CustomQueryHotkeySetting(this, settings).ShowDialog();
199198
}
200199

201200
#endregion
@@ -204,17 +203,17 @@ private void OnAddCustomeHotkeyClick(object sender, RoutedEventArgs e)
204203

205204
private void OnPluginToggled(object sender, RoutedEventArgs e)
206205
{
207-
var id = _viewModel.SelectedPlugin.PluginPair.Metadata.ID;
206+
var id = viewModel.SelectedPlugin.PluginPair.Metadata.ID;
208207
// used to sync the current status from the plugin manager into the setting to keep consistency after save
209-
_settings.PluginSettings.Plugins[id].Disabled = _viewModel.SelectedPlugin.PluginPair.Metadata.Disabled;
208+
settings.PluginSettings.Plugins[id].Disabled = viewModel.SelectedPlugin.PluginPair.Metadata.Disabled;
210209
}
211210

212211
private void OnPluginActionKeywordsClick(object sender, MouseButtonEventArgs e)
213212
{
214213
if (e.ChangedButton == MouseButton.Left)
215214
{
216-
var id = _viewModel.SelectedPlugin.PluginPair.Metadata.ID;
217-
ActionKeywords changeKeywordsWindow = new ActionKeywords(id, _settings, _viewModel.SelectedPlugin);
215+
var id = viewModel.SelectedPlugin.PluginPair.Metadata.ID;
216+
ActionKeywords changeKeywordsWindow = new ActionKeywords(id, settings, viewModel.SelectedPlugin);
218217
changeKeywordsWindow.ShowDialog();
219218
}
220219
}
@@ -223,7 +222,7 @@ private void OnPluginNameClick(object sender, MouseButtonEventArgs e)
223222
{
224223
if (e.ChangedButton == MouseButton.Left)
225224
{
226-
var website = _viewModel.SelectedPlugin.PluginPair.Metadata.Website;
225+
var website = viewModel.SelectedPlugin.PluginPair.Metadata.Website;
227226
if (!string.IsNullOrEmpty(website))
228227
{
229228
var uri = new Uri(website);
@@ -239,7 +238,7 @@ private void OnPluginDirecotyClick(object sender, MouseButtonEventArgs e)
239238
{
240239
if (e.ChangedButton == MouseButton.Left)
241240
{
242-
var directory = _viewModel.SelectedPlugin.PluginPair.Metadata.PluginDirectory;
241+
var directory = viewModel.SelectedPlugin.PluginPair.Metadata.PluginDirectory;
243242
if (!string.IsNullOrEmpty(directory))
244243
FilesFolders.OpenPath(directory);
245244
}
@@ -250,15 +249,15 @@ private void OnPluginDirecotyClick(object sender, MouseButtonEventArgs e)
250249

251250
private void OnTestProxyClick(object sender, RoutedEventArgs e)
252251
{ // TODO: change to command
253-
var msg = _viewModel.TestProxy();
252+
var msg = viewModel.TestProxy();
254253
MessageBox.Show(msg); // TODO: add message box service
255254
}
256255

257256
#endregion
258257

259258
private async void OnCheckUpdates(object sender, RoutedEventArgs e)
260259
{
261-
_viewModel.UpdateApp(); // TODO: change to command
260+
viewModel.UpdateApp(); // TODO: change to command
262261
}
263262

264263
private void OnRequestNavigate(object sender, RequestNavigateEventArgs e)
@@ -269,7 +268,7 @@ private void OnRequestNavigate(object sender, RequestNavigateEventArgs e)
269268

270269
private void OnClosed(object sender, EventArgs e)
271270
{
272-
_viewModel.Save();
271+
viewModel.Save();
273272
}
274273

275274
private void OnCloseExecuted(object sender, ExecutedRoutedEventArgs e)

0 commit comments

Comments
 (0)