Skip to content

Commit 6604247

Browse files
committed
Fix typos & Improve code quality
1 parent 756ac0b commit 6604247

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public MainViewModel()
159159
};
160160
_selectedResults = Results;
161161

162-
Results.PropertyChanged += (_, args) =>
162+
Results.PropertyChanged += (o, args) =>
163163
{
164164
switch (args.PropertyName)
165165
{
@@ -171,7 +171,7 @@ public MainViewModel()
171171
}
172172
};
173173

174-
History.PropertyChanged += (_, args) =>
174+
History.PropertyChanged += (o, args) =>
175175
{
176176
switch (args.PropertyName)
177177
{
@@ -298,15 +298,15 @@ public void ReQuery()
298298
{
299299
if (QueryResultsSelected())
300300
{
301-
// When we are requerying, we should not delay the query
301+
// When we are requiring, we should not delay the query
302302
_ = QueryResultsAsync(false, isReQuery: true);
303303
}
304304
}
305305

306306
public void ReQuery(bool reselect)
307307
{
308308
BackToQueryResults();
309-
// When we are requerying, we should not delay the query
309+
// When we are requiring, we should not delay the query
310310
_ = QueryResultsAsync(false, isReQuery: true, reSelect: reselect);
311311
}
312312

@@ -315,7 +315,7 @@ public void ReverseHistory()
315315
{
316316
if (_history.Items.Count > 0)
317317
{
318-
ChangeQueryText(_history.Items[^lastHistoryIndex].Query.ToString());
318+
ChangeQueryText(_history.Items[^lastHistoryIndex].Query);
319319
if (lastHistoryIndex < _history.Items.Count)
320320
{
321321
lastHistoryIndex++;
@@ -328,7 +328,7 @@ public void ForwardHistory()
328328
{
329329
if (_history.Items.Count > 0)
330330
{
331-
ChangeQueryText(_history.Items[^lastHistoryIndex].Query.ToString());
331+
ChangeQueryText(_history.Items[^lastHistoryIndex].Query);
332332
if (lastHistoryIndex > 1)
333333
{
334334
lastHistoryIndex--;
@@ -660,7 +660,7 @@ private async Task ChangeQueryTextAsync(string queryText, bool isReQuery = false
660660
}
661661
else if (isReQuery)
662662
{
663-
// When we are requerying, we should not delay the query
663+
// When we are requiring, we should not delay the query
664664
await QueryAsync(false, isReQuery: true);
665665
}
666666

@@ -753,7 +753,7 @@ private ResultsViewModel SelectedResults
753753
public Visibility ProgressBarVisibility { get; set; }
754754
public Visibility MainWindowVisibility { get; set; }
755755

756-
// This is to be used for determining the visibility status of the mainwindow instead of MainWindowVisibility
756+
// This is to be used for determining the visibility status of the main window instead of MainWindowVisibility
757757
// because it is more accurate and reliable representation than using Visibility as a condition check
758758
public bool MainWindowVisibilityStatus { get; set; } = true;
759759

@@ -1071,9 +1071,7 @@ private void QueryContextMenu()
10711071

10721072
if (selected != null) // SelectedItem returns null if selection is empty.
10731073
{
1074-
List<Result> results;
1075-
1076-
results = PluginManager.GetContextMenusForPlugin(selected);
1074+
var results = PluginManager.GetContextMenusForPlugin(selected);
10771075
results.Add(ContextMenuTopMost(selected));
10781076
results.Add(ContextMenuPluginInfo(selected.PluginID));
10791077

@@ -1227,16 +1225,16 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
12271225
TaskContinuationOptions.NotOnCanceled,
12281226
TaskScheduler.Default);
12291227

1230-
// plugins is ICollection, meaning LINQ will get the Count and preallocate Array
1228+
// plugins are ICollection, meaning LINQ will get the Count and preallocate Array
12311229

12321230
var tasks = plugins.Select(plugin => plugin.Metadata.Disabled switch
12331231
{
1234-
false => QueryTaskAsync(plugin, searchDelay, reSelect, _updateSource.Token),
1232+
false => QueryTaskAsync(plugin, _updateSource.Token),
12351233
true => Task.CompletedTask
12361234
}).ToArray();
12371235

12381236
// TODO: Remove debug codes.
1239-
System.Diagnostics.Debug.Write($"!!!Querying {query.RawQuery}: search dalay {searchDelay}");
1237+
System.Diagnostics.Debug.Write($"!!!Querying {query.RawQuery}: search delay {searchDelay}");
12401238
foreach (var plugin in plugins)
12411239
{
12421240
if (!plugin.Metadata.Disabled)
@@ -1269,7 +1267,7 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
12691267
}
12701268

12711269
// Local function
1272-
async Task QueryTaskAsync(PluginPair plugin, bool searchDelay, bool reSelect, CancellationToken token)
1270+
async Task QueryTaskAsync(PluginPair plugin, CancellationToken token)
12731271
{
12741272
if (searchDelay)
12751273
{
@@ -1623,7 +1621,7 @@ public void Save()
16231621
}
16241622

16251623
/// <summary>
1626-
/// To avoid deadlock, this method should not called from main thread
1624+
/// To avoid deadlock, this method should not be called from main thread
16271625
/// </summary>
16281626
public void UpdateResultView(ICollection<ResultsForUpdate> resultsForUpdates)
16291627
{

0 commit comments

Comments
 (0)