From 1d6c4cee2e703510ad60e0d011d55d4d0170dc4a Mon Sep 17 00:00:00 2001
From: AminSallah <124622454+AminSallah@users.noreply.github.com>
Date: Sun, 25 Feb 2024 04:11:30 +0200
Subject: [PATCH] AddResults & UpdateResults new param "reselect"
---
Flow.Launcher/ViewModel/ResultsViewModel.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Flow.Launcher/ViewModel/ResultsViewModel.cs b/Flow.Launcher/ViewModel/ResultsViewModel.cs
index bb07ce085..d02dc9bd5 100644
--- a/Flow.Launcher/ViewModel/ResultsViewModel.cs
+++ b/Flow.Launcher/ViewModel/ResultsViewModel.cs
@@ -147,23 +147,23 @@ namespace Flow.Launcher.ViewModel
///
/// To avoid deadlock, this method should not called from main thread
///
- public void AddResults(IEnumerable resultsForUpdates, CancellationToken token)
+ public void AddResults(IEnumerable resultsForUpdates, CancellationToken token, bool reselect = true)
{
var newResults = NewResults(resultsForUpdates);
if (token.IsCancellationRequested)
return;
- UpdateResults(newResults, token);
+ UpdateResults(newResults, token, reselect);
}
- private void UpdateResults(List newResults, CancellationToken token = default)
+ private void UpdateResults(List newResults, CancellationToken token = default, bool reselect = true)
{
lock (_collectionLock)
{
// update UI in one run, so it can avoid UI flickering
Results.Update(newResults, token);
- if (Results.Any())
+ if (reselect && Results.Any())
SelectedItem = Results[0];
}