mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
Improving UI performance (#5216)
* Added fast observable collection * Updated to use 1 collection changed event per query * Moved result updating to background thread * Changed collapsed to hidden for virtualization * Moved all token cancellations inside try catch * Fixed freeze on deleting first letter * nit fixes * Moved update logic to plugin result loop * Updated doc comment for AddResults function * fix result clear on empty query
This commit is contained in:
committed by
GitHub
parent
5fb7d43aff
commit
87ae1c6a9b
@@ -315,8 +315,6 @@ namespace PowerLauncher
|
||||
}
|
||||
}
|
||||
|
||||
private const int millisecondsToWait = 100;
|
||||
private static DateTime s_lastTimeOfTyping;
|
||||
private bool disposedValue = false;
|
||||
|
||||
private void QueryTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||
@@ -335,22 +333,7 @@ namespace PowerLauncher
|
||||
SearchBox.AutoCompleteTextBlock.Text = string.Empty;
|
||||
}
|
||||
_viewModel.QueryText = text;
|
||||
var latestTimeOfTyping = DateTime.Now;
|
||||
|
||||
Task.Run(() => DelayedCheck(latestTimeOfTyping));
|
||||
s_lastTimeOfTyping = latestTimeOfTyping;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task DelayedCheck(DateTime latestTimeOfTyping)
|
||||
{
|
||||
await Task.Delay(millisecondsToWait).ConfigureAwait(false);
|
||||
if (latestTimeOfTyping.Equals(s_lastTimeOfTyping))
|
||||
{
|
||||
await System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
_viewModel.Query();
|
||||
}));
|
||||
_viewModel.Query();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user