mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Revert creating a new task when adding result.
This commit is contained in:
parent
01158fdc66
commit
aa20d505fe
1 changed files with 4 additions and 14 deletions
|
|
@ -188,22 +188,12 @@ namespace Flow.Launcher.ViewModel
|
|||
return;
|
||||
lock (_collectionLock)
|
||||
{
|
||||
// update UI in one run, so it can avoid UI flickering
|
||||
|
||||
// https://social.msdn.microsoft.com/Forums/vstudio/en-US/5ff71969-f183-4744-909d-50f7cd414954/binding-a-tabcontrols-selectedindex-not-working?forum=wpf
|
||||
// fix selected index flow
|
||||
var updateTask = Task.Run(() =>
|
||||
{
|
||||
// update UI in one run, so it can avoid UI flickering
|
||||
Results.Update(newResults, token);
|
||||
if (Results.Any())
|
||||
SelectedItem = Results[0];
|
||||
|
||||
Results.Update(newResults, token);
|
||||
if (Results.Any())
|
||||
SelectedItem = Results[0];
|
||||
});
|
||||
if (!updateTask.Wait(300))
|
||||
{
|
||||
updateTask.Dispose();
|
||||
throw new TimeoutException("Update result use too much time.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue