Windows Store App如果无法识别,则使用DisplayApplicationPicker打开文件

时间:2013-10-31 11:13:11

标签: c# windows-store-apps file-access

在我的应用程序中,我存储了一些文件,然后使用以下代码打开它们:

           StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;            
           StorageFile file = await localFolder.GetFileAsync(objectName);
            if (file != null)
            {
                // Launch the retrieved file
                bool success = await Windows.System.Launcher.LaunchFileAsync(file);
            }
            else
            {
                messageBox("File not found", "Attention");
            }

它适用于PDF,XML,DOC等文件,但它根本不适用于具有特定扩展名的文件,例如XML ... 我想打开DisplayApplicationPicker BUT只针对无法识别的文件:

            // Set the option to show the picker
            var options = new Windows.System.LauncherOptions();
            options.DisplayApplicationPicker = false;

            // Launch the retrieved file
            bool success = await Windows.System.Launcher.LaunchFileAsync(file, options);

有办法做到这一点吗?!

0 个答案:

没有答案