Skip to content

Commit 3a1756c

Browse files
committed
refactor: just use Wait instead of Stopwatch
1 parent ec17ea9 commit 3a1756c

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

src/ViewModels/ScanRepositories.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ public override Task<bool> Sure()
4646

4747
return Task.Run(() =>
4848
{
49-
var watch = new Stopwatch();
50-
watch.Start();
49+
var delay = Task.Delay(500);
5150

5251
var rootDir = new DirectoryInfo(_selected.Path);
5352
var found = new List<string>();
@@ -57,11 +56,8 @@ public override Task<bool> Sure()
5756
IgnoreInaccessible = true,
5857
});
5958

60-
// Make sure this task takes at least 0.5s to avoid that the popup panel do not disappear very quickly.
61-
var remain = 500 - (int)watch.Elapsed.TotalMilliseconds;
62-
watch.Stop();
63-
if (remain > 0)
64-
Task.Delay(remain).Wait();
59+
// Make sure this task takes at least 0.5s so the popup panel doesn't disappear too quickly.
60+
delay.Wait();
6561

6662
Dispatcher.UIThread.Invoke(() =>
6763
{

0 commit comments

Comments
 (0)