File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 3
3
using Files . Helpers ;
4
4
using Microsoft . Toolkit . Mvvm . ComponentModel ;
5
5
using Microsoft . Toolkit . Uwp . Extensions ;
6
+ using Microsoft . Toolkit . Uwp . Helpers ;
6
7
using System ;
7
8
using System . Linq ;
8
9
using System . Threading ;
9
10
using System . Threading . Tasks ;
11
+ using Windows . ApplicationModel . Core ;
10
12
using Windows . Storage ;
11
13
using Windows . UI . Xaml ;
12
14
@@ -54,10 +56,11 @@ public DriveItem(StorageFolder root, DriveType type)
54
56
Type = type ;
55
57
Path = string . IsNullOrEmpty ( root . Path ) ? $ "\\ \\ ?\\ { root . Name } \\ " : root . Path ;
56
58
Root = root ;
57
- GetDriveItemProperties ( ) ;
59
+
60
+ CoreApplication . MainView . ExecuteOnUIThreadAsync ( ( ) => GetDriveItemProperties ( ) ) ;
58
61
}
59
62
60
- private async void GetDriveItemProperties ( )
63
+ private async Task GetDriveItemProperties ( )
61
64
{
62
65
try
63
66
{
@@ -66,8 +69,8 @@ private async void GetDriveItemProperties()
66
69
67
70
MaxSpace = ByteSize . FromBytes ( ( ulong ) properties [ "System.Capacity" ] ) ;
68
71
FreeSpace = ByteSize . FromBytes ( ( ulong ) properties [ "System.FreeSpace" ] ) ;
69
-
70
72
SpaceUsed = MaxSpace - FreeSpace ;
73
+
71
74
SpaceText = string . Format (
72
75
"DriveFreeSpaceAndCapacity" . GetLocalized ( ) ,
73
76
FreeSpace . ToBinaryString ( ) . ConvertSizeAbbreviation ( ) ,
You can’t perform that action at this time.
0 commit comments