Skip to content

Commit 27ea2e4

Browse files
committed
Improve code quality
1 parent 81429d7 commit 27ea2e4

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,7 @@ private static List<Result> GetHistoryItems(IEnumerable<HistoryItem> historyItem
13331333

13341334
private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, bool reSelect = true)
13351335
{
1336-
_updateSource?.Cancel();
1336+
_updateSource?.CancelAsync();
13371337
_progressQuery = null;
13381338

13391339
App.API.LogDebug(ClassName, $"Start query with text: <{QueryText}>");
@@ -1425,16 +1425,16 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
14251425
}*/
14261426

14271427
_ = Task.Delay(200, currentCancellationToken).ContinueWith(_ =>
1428+
{
1429+
// start the progress bar if query takes more than 200 ms and this is the current running query and it didn't finish yet
1430+
if (_progressQuery != null && _progressQuery == query)
14281431
{
1429-
// start the progress bar if query takes more than 200 ms and this is the current running query and it didn't finish yet
1430-
if (_progressQuery != null && _progressQuery == query)
1431-
{
1432-
ProgressBarVisibility = Visibility.Visible;
1433-
}
1434-
},
1435-
currentCancellationToken,
1436-
TaskContinuationOptions.NotOnCanceled,
1437-
TaskScheduler.Default);
1432+
ProgressBarVisibility = Visibility.Visible;
1433+
}
1434+
},
1435+
currentCancellationToken,
1436+
TaskContinuationOptions.NotOnCanceled,
1437+
TaskScheduler.Default);
14381438

14391439
// plugins are ICollection, meaning LINQ will get the Count and preallocate Array
14401440

@@ -1927,7 +1927,7 @@ public async Task SetupDialogJumpAsync(nint handle)
19271927
if (DialogJump.DialogJumpWindowPosition == DialogJumpWindowPositions.UnderDialog)
19281928
{
19291929
// Cancel the previous Dialog Jump task
1930-
_dialogJumpSource?.Cancel();
1930+
_dialogJumpSource?.CancelAsync();
19311931

19321932
// Create a new cancellation token source
19331933
_dialogJumpSource = new CancellationTokenSource();

0 commit comments

Comments
 (0)