从Windows 8应用打开Windows资源管理器的文件? [英] Opening a file in Windows Explorer from a Windows 8 app?

查看:137
本文介绍了从Windows 8应用打开Windows资源管理器的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写的是,很简单,最大限度地减少我的Windows 8身临其境的应用程序,并打开在资源管理器文件中的函数 - 最好是如果该文件是对多个文件的文件夹中,文件强调

 公共异步无效打开文件(文件路径字符串)
{
StorageFile文件=等待StorageFile.GetFileFromApplicationUriAsync
(新的URI(文件路径,UriKind.RelativeOrAbsolute)); ;

如果(文件!= NULL)
{
等待Launcher.LaunchUriAsync(新的URI(File.Path));
}
}

此代码给我一个权限错误。任何想法?


解决方案

这纯粹是从我的角度来看一个内部应用程序




这是核心问题,您预期的做法。有没有在Windows应用商店生态系统的内​​部程序的概念。唯一可能的途径来获得另一台机器上运行的商店应用是通过获得许可证密钥,你只能从商店得到的。



这是容易忽略你的时候正在开发您的开发机器上的商店应用。它的看起来的这样的许可证密钥不需要运行和调试应用程序。但实际上还有一个,你得到它时,Visual Studio中缠身您一个对话框每月一次重新获得开发人员许可证密钥。这是一个的临时的关键,良好的只有一个月,而纯粹是为了给你足够的时间来让你的应用程序运行稳固。没有机制到密钥传输到另一台机器或保持它(和程序)活着超过1个月的期限。



您当然可以仍发布一个内部应用程序到商店。但你会审核的适用性和稳定性通过像任何其他商店应用验证程序。不就像WACK机械测试执行,有两个人,这将考验你的应用程序可以在发布之前。他们会毫不犹豫地当你做任何事情来尝试解决沙盒限制,包括协议处理程序的黑客拒绝您的应用程序。



一旦获得批准,这将是通过下载的任何的Windows 8的用户。其中包括有兴趣​​的公司内部机密和做法,顺便说一句黑客。非常方便为好,他不会有走出他的睡衣。



一个典型的业务线应用仍然是可预见的未来桌面应用程序。






这个答案需要更新,但现在从专用服务器发布应用的机制。这就是所谓的侧载的。该应用程序仍然需要一个证书,它的成本一掷千金,但可以从由一家私营公司,而不是微软存储服务器控制的专用服务器进行部署。



概述可在这里。


I want to write a function that, quite simply minimises my Windows 8 immersive app, and opens a file in explorer - preferably if the file is in a folder with multiple files, with the file highlighted.

 public async void OpenFile( string filePath)
 {
     StorageFile File = await StorageFile.GetFileFromApplicationUriAsync
                              (new Uri(filePath, UriKind.RelativeOrAbsolute)); ;

     if (File != null)
     {
         await Launcher.LaunchUriAsync(new Uri(File.Path));
     }
 }

This code gives me a permissions error. Any ideas?

解决方案

this is purely for an internal app from my point of view

This is the core problem with your intended approach. There is no concept of an "internal app" in the Windows Store ecosystem. The only possible way to get a Store app running on another machine is by acquiring a license key that you can only get from the Store.

This is easy to overlook when you are developing a Store app on your dev machine. It looks like this license key is not required to run and debug your app. But there actually is one, you get it when Visual Studio pesters you with a dialog once a month to re-acquire your developer license key. This is a temporary key, good for only one month, and purely meant to give you enough time to get your app running solidly. There is no mechanism to transfer that key to another machine or keep it (and the program) alive beyond the one month expiration.

You can of course still publish an internal app to the Store. But you'll be vetted for suitability and stability by the validation procedure like any other Store app. Not just a mechanical test like WACK performs, there are two people that will test your app before it can be published. They will not hesitate to reject your app when you do anything to try to work around the sandbox restrictions, including the protocol handler hack.

Once approved, it will be downloadable by any Windows 8 user. Including a hacker that would be interested in your internal company secrets and practices btw. Very convenient as well, he won't have to get out of his pajamas.

A typical line-of-business app is still a desktop app for the foreseeable future.


This answer requires an update, there's now a mechanism to publish apps from a dedicated server. This is called sideloading. The app still requires a certificate, and it costs big bucks, but can be deployed from a private server controlled by a private company instead of the Microsoft Store server.

An overview is available here.

这篇关于从Windows 8应用打开Windows资源管理器的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆