我知道我可以通过RetrievePropertiesAsync()
方法检索文件的预定义属性。但是现在我想再添加一个我自己的自定义属性,比如描述,有可能吗?我试过这段代码,但得到异常
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
StorageFile file = await KnownFolders.MusicLibrary.GetFileAsync("video.mp4");
List<string> propertiesName = new List<string>();
propertiesName.Add("CustomProperty");
string a = "Come and knock on our door. We've been waiting for you. Where the kisses are hers and hers and his, three's company, too! Come and dance on our floor. Take a step that is new. We've a lovable space that needs your face, three's company, too! You'll see that life is a ball again and laughter is callin' for you. Down at our rendezvous, three's company, too! The year is 1987 and NASA launches the last of America's deep space probes. In a freak mishap, Ranger 3 and its pilot Captain William 'Buck' Rogers are blown out of their trajectory into an orbit which freezes his life support system and returns Buck Rogers to Earth five hundred years later.";
IDictionary<string, object> extraProperties = await file.Properties.RetrievePropertiesAsync(propertiesName);
extraProperties.Add((new KeyValuePair<string, object>("CustomProperty", a)));
await file.Properties.SavePropertiesAsync(extraProperties);
}
An exception of type 'System.ArgumentException' occurred in App2.exe but was not handled in user code
WinRT information: The specified property name (CustomProperty) is invalid. The property may not be registered on the system.
Additional information: The parameter is incorrect.
PS:我想要这样的东西