Skip to content

Commit 6d21fa7

Browse files
committed
Reset count on refresh
1 parent 2f95016 commit 6d21fa7

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

WorkspaceLauncherForVSCode/Classes/CountTracker.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.Generic;
2+
using System.Linq;
23
using WorkspaceLauncherForVSCode.Enums;
34

45
namespace WorkspaceLauncherForVSCode.Classes;
@@ -35,4 +36,22 @@ public void Update(WorkspaceType localType, int value)
3536
_vscodeLocalCounts[localType] = value;
3637
}
3738
}
39+
40+
public void Reset()
41+
{
42+
foreach (var key in _counts.Keys.ToList())
43+
{
44+
_counts[key] = 0;
45+
}
46+
47+
foreach (var key in _vscodeRemoteCounts.Keys.ToList())
48+
{
49+
_vscodeRemoteCounts[key] = 0;
50+
}
51+
52+
foreach (var key in _vscodeLocalCounts.Keys.ToList())
53+
{
54+
_vscodeLocalCounts[key] = 0;
55+
}
56+
}
3857
}

WorkspaceLauncherForVSCode/Pages/VisualStudioCodePage.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ private async Task RefreshWorkspacesAsync(bool isUserInitiated)
186186

187187
IsLoading = true;
188188

189+
_countTracker.Reset();
190+
189191
if (isUserInitiated)
190192
{
191193
_vscodeService.LoadInstances(_settingsManager.EnabledEditions);

0 commit comments

Comments
 (0)