在WP8的C#中,FileSavePicker任务没有显示在Window.Storage.Pickers中。

3

我正在尝试使用FilePicker任务保存视频文件,但是在解决方案中并没有显示FileSavePicker任务。以下是截图:

Windows.Storage.Pickers只显示了4个任务:

  1. FileExtensionVector
  2. FileOpenPicker
  3. PickerLocationId
  4. PickerViewMode

这是我使用的代码:

        async void TrimVideoFile()
    {
        Windows.Storage.StorageFile source;
        Windows.Storage.StorageFile destination;

        var openPicker = new Windows.Storage.Pickers.FileOpenPicker();

        openPicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.VideosLibrary;
        openPicker.FileTypeFilter.Add(".wmv");
        openPicker.FileTypeFilter.Add(".mp4");

        source = await openPicker.PickSingleFileAsync();

        var savePicker = new Windows.Storage.Pickers.FileSavePicker()
        savePicker.SuggestedStartLocation =
            Windows.Storage.Pickers.PickerLocationId.VideosLibrary;

        savePicker.DefaultFileExtension = ".mp4";
        savePicker.SuggestedFileName = "New Video";

        savePicker.FileTypeChoices.Add("MPEG4", new string[] { ".mp4" });

        destination = await savePicker.PickSaveFileAsync();

        // Method to perform the transcoding.
        TrimFile(source, destination);
    }

只显示了4个任务,如何使用FileSavePicker任务。我正在使用Visual Studio 2012,我的目标应用程序是Windows Phone 8.0应用程序。

1个回答

1
文件选择器在Windows Phone 8上不可用。它们是在Windows Phone 8.1中添加的。 请参见MSDN上FileSavePicker文档中的“版本”部分:

最小支持手机 Windows Phone 8.1 [Windows Phone Silverlight 8.1和Windows Runtime应用程序]


在Windows Phone 8中,是否有FileSavePicker的替代方案? - Pawan
不是的。它们是8.1的新功能。您可以编写自己的拾取UI,但它只能针对应用程序已经可以读取的位置。 - Rob Caplan - MSFT

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接