mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 04:07:40 +02:00
Refactoring DelayInvoke
In MainWindow.xaml.cs, the reference of originQuery, lastQuery and tbQuery.Text are same, so remove originQuery is fine.
This commit is contained in:
@@ -457,27 +457,27 @@ namespace Wox
|
||||
int searchDelay = GetSearchDelay(lastQuery);
|
||||
|
||||
Dispatcher.DelayInvoke("UpdateSearch",
|
||||
o =>
|
||||
() =>
|
||||
{
|
||||
Dispatcher.DelayInvoke("ClearResults", i =>
|
||||
Dispatcher.DelayInvoke("ClearResults", () =>
|
||||
{
|
||||
// first try to use clear method inside pnlResult, which is more closer to the add new results
|
||||
// and this will not bring splash issues.After waiting 100ms, if there still no results added, we
|
||||
// must clear the result. otherwise, it will be confused why the query changed, but the results
|
||||
// didn't.
|
||||
if (pnlResult.Dirty) pnlResult.Clear();
|
||||
}, TimeSpan.FromMilliseconds(100), null);
|
||||
}, TimeSpan.FromMilliseconds(100));
|
||||
queryHasReturn = false;
|
||||
Query query = new Query(lastQuery);
|
||||
query.IsIntantQuery = searchDelay == 0;
|
||||
Query(query);
|
||||
Dispatcher.DelayInvoke("ShowProgressbar", originQuery =>
|
||||
Dispatcher.DelayInvoke("ShowProgressbar", () =>
|
||||
{
|
||||
if (!queryHasReturn && originQuery == tbQuery.Text && !string.IsNullOrEmpty(lastQuery))
|
||||
if (!queryHasReturn && !string.IsNullOrEmpty(lastQuery))
|
||||
{
|
||||
StartProgress();
|
||||
}
|
||||
}, TimeSpan.FromMilliseconds(150), tbQuery.Text);
|
||||
}, TimeSpan.FromMilliseconds(150));
|
||||
//reset query history index after user start new query
|
||||
ResetQueryHistoryIndex();
|
||||
}, TimeSpan.FromMilliseconds(searchDelay));
|
||||
|
||||
Reference in New Issue
Block a user