Skip to content

Commit 713d4de

Browse files
committed
Do not block during call to QueryRecycleBin
1 parent 645d837 commit 713d4de

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

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

129129
public async void RefreshSpaceUsed(object? sender, FileSystemEventArgs e)
130130
{
131-
await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(() =>
131+
await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(async () =>
132132
{
133-
SpaceUsed = StorageTrashBinService.GetSize();
133+
SpaceUsed = await Task.Run(() => StorageTrashBinService.GetSize());
134134
});
135135
}
136136

@@ -152,10 +152,10 @@ public override object ToolTip
152152

153153
public RecycleBinLocationItem()
154154
{
155-
SpaceUsed = StorageTrashBinService.GetSize();
156-
157155
StorageTrashBinService.Watcher.ItemAdded += RefreshSpaceUsed;
158156
StorageTrashBinService.Watcher.ItemDeleted += RefreshSpaceUsed;
157+
158+
RefreshSpaceUsed(null, new(WatcherChangeTypes.Changed, "", null));
159159
}
160160
}
161161
}

0 commit comments

Comments
 (0)