diff --git a/src/ViewModels/ScanRepositories.cs b/src/ViewModels/ScanRepositories.cs index 6df2843ba..265e26a2e 100644 --- a/src/ViewModels/ScanRepositories.cs +++ b/src/ViewModels/ScanRepositories.cs @@ -46,8 +46,7 @@ public override Task Sure() return Task.Run(() => { - var watch = new Stopwatch(); - watch.Start(); + var delay = Task.Delay(500); var rootDir = new DirectoryInfo(_selected.Path); var found = new List(); @@ -57,11 +56,8 @@ public override Task Sure() IgnoreInaccessible = true, }); - // Make sure this task takes at least 0.5s to avoid that the popup panel do not disappear very quickly. - var remain = 500 - (int)watch.Elapsed.TotalMilliseconds; - watch.Stop(); - if (remain > 0) - Task.Delay(remain).Wait(); + // Make sure this task takes at least 0.5s so the popup panel doesn't disappear too quickly. + delay.Wait(); Dispatcher.UIThread.Invoke(() => {