如何使用FileSavePicker从appdata:/assets/ *.png复制图像。我发现这个例子是File Save Picker - Save Edited Image (C# Metro app)的,但是它不工作。
我有这样的代码:
private async void OpenButton_Click(object sender, RoutedEventArgs e)
{
string path = @"\Assets\Logo.png";
StorageFolder folder = Windows.ApplicationModel.Package.Current.InstalledLocation;
StorageFile file = await folder.GetFileAsync(path);
// Show the picker
FileSavePicker savePicker = new FileSavePicker();
// Set the file that will be saved
savePicker.SuggestedSaveFile = file;
savePicker.SuggestedFileName = "Logo";
savePicker.FileTypeChoices.Add("PNG", new List<string>() { ".png" });
savePicker.PickSaveFileAndContinue();
}但他将文件保存为0字节
发布于 2015-02-20 16:50:26
你试过msdn上的样品了吗?你找到的那一个哪里出了问题?
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
// Dropdown of file types the user can save the file as
savePicker.FileTypeChoices.Add("Plain Text", new List<string>() { ".txt" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "New Document";来源:
https://stackoverflow.com/questions/28623267
复制相似问题