【问题标题】:Open StorageItem in default program in WinRT?在 WinRT 的默认程序中打开 StorageItem?
【发布时间】:2012-09-03 07:21:56
【问题描述】:

目前我正在编写一个 XAML/C#/WinRT 现代 UI 应用程序,其中包括一个简单的(几乎)任意类型的 StorageItems 管理系统,主要是图像、PDF/Office 文档、文本文件......

如果我可以在用户想要的时候在“默认程序”中打开一个文件,那么我将获得最好的用户体验。在 C#/WinRT 中是否有任何编程可能性以使用默认程序/应用程序(图像 -> 照片应用程序、pdf -> 阅读器应用程序、Word/Excel -> Office、...)打开 StorageItem?

【问题讨论】:

    标签: c# microsoft-metro windows-runtime


    【解决方案1】:
     Windows.ApplicationModel.Package.current.installedLocation.getFileAsync(fileToOpen).done(
                function (file) {
                    Windows.System.Launcher.launchFileAsync(file).done(
                        function (success) {
                            // anything you want to do after default program launched        });
                });
    

    【讨论】:

    • 谢谢!没想到这么简单;-)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-06
    相关资源
    最近更新 更多