【发布时间】:2016-12-02 19:01:50
【问题描述】:
我正在开发一个 HTML+JS 应用程序。 我必须在本地照片应用程序中从 Internet 启动图像文件。
要启动的代码:
var uri = new Windows.Foundation.Uri("http://someuri.com/somefile.JPG");
Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri).then(
function (file) {
// Launch the retrieved file using the default app
Windows.System.Launcher.launchFileAsync(file).then(
function (success) {
if (success) {
// File launched
} else {
// File launch failed
}
}
);
}
);
文件有问题,变量应该是StorageFile class。我无法从 URI 创建此类。我应该选择哪种方法(查看链接)?
方法 getFileFromApplicationUriAsync 只从其他应用程序获取文件,而不是从网络获取文件。
createStreamedFileFromUriAsync 方法在 WP 8.1 上不可用。
方法 getFileFromPathAsync 不支持 URI。
【问题讨论】:
标签: javascript html windows-runtime windows-store-apps winjs