[PTRun]Integrated lock mechanism for thread-safe Results updates. (#26104)

This commit is contained in:
gokcekantarci
2023-06-06 15:11:09 +03:00
committed by GitHub
parent 0f6ac52f99
commit ddaa348e5a
2 changed files with 37 additions and 23 deletions

View File

@@ -606,14 +606,17 @@ namespace PowerLauncher
private void ClearResults()
{
_viewModel.Results.SelectedItem = null;
System.Threading.Tasks.Task.Run(() =>
MainViewModel.PerformSafeAction(() =>
{
Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() =>
_viewModel.Results.SelectedItem = null;
System.Threading.Tasks.Task.Run(() =>
{
_viewModel.Results.Clear();
_viewModel.Results.Results.NotifyChanges();
}));
Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() =>
{
_viewModel.Results.Clear();
_viewModel.Results.Results.NotifyChanges();
}));
});
});
}