From 56d9a37aec47ee557063ca7440b977b00b9d336e Mon Sep 17 00:00:00 2001 From: Hongtao Zhang Date: Sun, 11 Dec 2022 11:08:23 -0600 Subject: [PATCH] wrap the whole thing --- Flow.Launcher/ViewModel/MainViewModel.cs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index d204dbeed..ab64f0f3f 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -429,22 +429,24 @@ namespace Flow.Launcher.ViewModel /// Force query even when Query Text doesn't change public void ChangeQueryText(string queryText, bool reQuery = false) { - if (QueryText != queryText) + Application.Current.Dispatcher.Invoke(() => { - Application.Current.Dispatcher.Invoke(() => + if (QueryText != queryText) { + // re-query is done in QueryText's setter method QueryText = queryText; // set to false so the subsequent set true triggers // PropertyChanged and MoveQueryTextToEnd is called QueryTextCursorMovedToEnd = false; - }); - } - else if (reQuery) - { - Query(); - } - QueryTextCursorMovedToEnd = true; + + } + else if (reQuery) + { + Query(); + } + QueryTextCursorMovedToEnd = true; + }); } public bool LastQuerySelected { get; set; }