File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments