本文介绍了UWP如何获得StorageDevice的可用空间和容量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的UWP应用中,我使用此构造来获取所有StorageDevices的列表:
in my UWP app I use this construction to get list of all StorageDevices:
List<StorageFolder> list = new List<StorageFolder>();
var selector = Windows.Devices.Portable.StorageDevice.GetDeviceSelector();
var devices = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(selector);
foreach (Windows.Devices.Enumeration.DeviceInformation device in devices)
{
// Get device root folder
StorageFolder rootFolder = Windows.Devices.Portable.StorageDevice.FromId(device.Id);
list.Add(rootFolder);
}
RemovableItems.DataContext = new RemovableStorageViewModel(list);
如何获得此设备的自由空间和容量?我尝试从文件夹道具 rootFolder.Properties.RetrievePropertiesAsync(new List< string>())
中获取它,但是缺少该道具.
How to get freespace and capacity of this devices? I try to get it from folder props rootFolder.Properties.RetrievePropertiesAsync(new List<string>())
, but this props is missing.
更新:
可用的道具值:
可用的道具钥匙:
为什么缺少自由空间和容量?
Why freespace and capacity is missing?
推荐答案
我尝试做同样的事情没有成功.Microsoft出于某些原因省略了这些属性.希望下一个SDK更新能够解决这个问题.
I've tried without success to do the same thing. Microsoft has omitted those properties for some reason. Hoping that the next SDK update will address this.
这篇关于UWP如何获得StorageDevice的可用空间和容量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!