From b9aa5a88cf5350ca7165fa570de225428472bd3f Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Mon, 5 May 2025 08:30:53 +0800 Subject: [PATCH] Change variable name for code quality --- Flow.Launcher/ViewModel/MainViewModel.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 566cb6814..476c10e74 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -33,7 +33,7 @@ namespace Flow.Launcher.ViewModel private bool _isQueryRunning; private Query _lastQuery; - private bool _lastHomeQuery; + private bool _lastIsHomeQuery; private string _queryTextBeforeLeaveResults; private string _ignoredQueryText = null; @@ -1268,7 +1268,7 @@ namespace Flow.Launcher.ViewModel App.API.LogDebug(ClassName, $"Start query with ActionKeyword <{query.ActionKeyword}> and RawQuery <{query.RawQuery}>"); - var homeQuery = query.RawQuery == string.Empty; + var isHomeQuery = query.RawQuery == string.Empty; _updateSource = new CancellationTokenSource(); @@ -1284,13 +1284,13 @@ namespace Flow.Launcher.ViewModel query.IsReQuery = isReQuery; // handle the exclusiveness of plugin using action keyword - RemoveOldQueryResults(query, homeQuery); + RemoveOldQueryResults(query, isHomeQuery); _lastQuery = query; - _lastHomeQuery = homeQuery; + _lastIsHomeQuery = isHomeQuery; ICollection plugins = Array.Empty(); - if (homeQuery) + if (isHomeQuery) { if (Settings.ShowHomePage) { @@ -1347,7 +1347,7 @@ namespace Flow.Launcher.ViewModel // plugins are ICollection, meaning LINQ will get the Count and preallocate Array Task[] tasks; - if (homeQuery) + if (isHomeQuery) { tasks = plugins.Select(plugin => plugin.Metadata.HomeDisabled switch { @@ -1397,7 +1397,7 @@ namespace Flow.Launcher.ViewModel { App.API.LogDebug(ClassName, $"Wait for querying plugin <{plugin.Metadata.Name}>"); - if (searchDelay && !homeQuery) // Do not delay for home query + if (searchDelay && !isHomeQuery) // Do not delay for home query { var searchDelayTime = plugin.Metadata.SearchDelayTime ?? Settings.SearchDelayTime; @@ -1410,7 +1410,7 @@ namespace Flow.Launcher.ViewModel // Task.Yield will force it to run in ThreadPool await Task.Yield(); - var results = homeQuery ? + var results = isHomeQuery ? await PluginManager.QueryHomeForPluginAsync(plugin, query, token) : await PluginManager.QueryForPluginAsync(plugin, query, token); @@ -1542,10 +1542,10 @@ namespace Flow.Launcher.ViewModel } } - private void RemoveOldQueryResults(Query query, bool homeQuery) + private void RemoveOldQueryResults(Query query, bool isHomeQuery) { // If last or current query is home query, we need to clear the results - if (_lastHomeQuery || homeQuery) + if (_lastIsHomeQuery || isHomeQuery) { Results.Clear(); }