【问题标题】:How to copy .png using FileSavePicker for wp 8.1如何使用 FileSavePicker for wp 8.1 复制 .​​png
【发布时间】:2017-08-22 17:24:23
【问题描述】:

如何使用 FileSavePicker 从 appdata:/assets/images 复制 *.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 字节

【问题讨论】:

  • 是复制还是保存?
  • 我需要将应用程序保存到您的手机

标签: c# windows-phone-8 windows-phone


【解决方案1】:

您是否试用过 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";

来源:

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2015-12-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-03-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多