Skip to content

Commit 3c9654d

Browse files
authored
Merge branch 'files-community:main' into props
2 parents fb226a7 + af51d81 commit 3c9654d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/Files.App/Data/Items/LocationItem.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,14 @@ public sealed class RecycleBinLocationItem : LocationItem
128128

129129
public async void RefreshSpaceUsed(object? sender, FileSystemEventArgs e)
130130
{
131-
await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(() =>
131+
await RefreshSpaceUsedAsync();
132+
}
133+
134+
private Task RefreshSpaceUsedAsync()
135+
{
136+
return MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(async () =>
132137
{
133-
SpaceUsed = StorageTrashBinService.GetSize();
138+
SpaceUsed = await Task.Run(() => StorageTrashBinService.GetSize());
134139
});
135140
}
136141

@@ -152,10 +157,10 @@ public override object ToolTip
152157

153158
public RecycleBinLocationItem()
154159
{
155-
SpaceUsed = StorageTrashBinService.GetSize();
156-
157160
StorageTrashBinService.Watcher.ItemAdded += RefreshSpaceUsed;
158161
StorageTrashBinService.Watcher.ItemDeleted += RefreshSpaceUsed;
162+
163+
_ = RefreshSpaceUsedAsync();
159164
}
160165
}
161166
}

0 commit comments

Comments
 (0)