1
我正在开发一个windows应用程序,我需要上传图像并将其保存在Assets文件夹中。我是C#中的新成员。这是我的代码。将图片上传到windows store应用程序的Assets文件夹中
var picker = new FileOpenPicker();
picker.SuggestedStartLocation = PickerLocationId.Desktop;
picker.ViewMode = PickerViewMode.Thumbnail;
picker.FileTypeFilter.Add(".jpg");
picker.FileTypeFilter.Add(".jpeg");
StorageFile file = await picker.PickSingleFileAsync();
if (file == null) return;
var stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);
BitmapImage image = new BitmapImage();
image.SetSource(stream);
imageTargetControl.Source = image;
StorageFolder storageFolder = KnownFolders.DocumentsLibrary;
StorageFile copyFile = await file.CopyAsync(storageFolder);
请帮助我。 谢谢
StorageFolder storageFolder = KnownFolders.DocumentsLibrary; StorageFile copyFile =等待file.CopyAsync(storageFolder); 我试过这个,但我想上传资产文件夹中的文件,而不是DocumentsLibrary,我是新手,无法继续:( –
更新它的问题,而不是作为评论。 –