Skip to content

Commit 8d9b152

Browse files
committed
Improve code quality
1 parent bb31990 commit 8d9b152

File tree

1 file changed

+19
-26
lines changed

1 file changed

+19
-26
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

+19-26
Original file line numberDiff line numberDiff line change
@@ -1313,19 +1313,7 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
13131313

13141314
if (query == null) // shortcut expanded
13151315
{
1316-
App.API.LogDebug(ClassName, $"Clear query results");
1317-
1318-
// Hide and clear results again because running query may show and add some results
1319-
Results.Visibility = Visibility.Collapsed;
1320-
Results.Clear();
1321-
1322-
// Reset plugin icon
1323-
PluginIconPath = null;
1324-
PluginIconSource = null;
1325-
SearchIconVisibility = Visibility.Visible;
1326-
1327-
// Hide progress bar again because running query may set this to visible
1328-
ProgressBarVisibility = Visibility.Hidden;
1316+
ClearResults();
13291317
return;
13301318
}
13311319

@@ -1336,19 +1324,7 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
13361324
// Do not show home page for quick switch window
13371325
if (quickSwitch && isHomeQuery)
13381326
{
1339-
App.API.LogDebug(ClassName, $"Clear query results");
1340-
1341-
// Hide and clear results again because running query may show and add some results
1342-
Results.Visibility = Visibility.Collapsed;
1343-
Results.Clear();
1344-
1345-
// Reset plugin icon
1346-
PluginIconPath = null;
1347-
PluginIconSource = null;
1348-
SearchIconVisibility = Visibility.Visible;
1349-
1350-
// Hide progress bar again because running query may set this to visible
1351-
ProgressBarVisibility = Visibility.Hidden;
1327+
ClearResults();
13521328
return;
13531329
}
13541330

@@ -1585,6 +1561,23 @@ void QueryHistoryTask()
15851561
}
15861562
}
15871563

1564+
private void ClearResults()
1565+
{
1566+
App.API.LogDebug(ClassName, $"Clear query results");
1567+
1568+
// Hide and clear results again because running query may show and add some results
1569+
Results.Visibility = Visibility.Collapsed;
1570+
Results.Clear();
1571+
1572+
// Reset plugin icon
1573+
PluginIconPath = null;
1574+
PluginIconSource = null;
1575+
SearchIconVisibility = Visibility.Visible;
1576+
1577+
// Hide progress bar again because running query may set this to visible
1578+
ProgressBarVisibility = Visibility.Hidden;
1579+
}
1580+
15881581
private async Task<Query> ConstructQueryAsync(string queryText, IEnumerable<CustomShortcutModel> customShortcuts,
15891582
IEnumerable<BaseBuiltinShortcutModel> builtInShortcuts)
15901583
{

0 commit comments

Comments
 (0)