Opening a file in Windows Explorer from a Windows 8 app?(从 Windows 8 应用程序在 Windows 资源管理器中打开文件?)
问题描述
我想编写一个函数,它可以简单地最小化我的 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
这是您预期方法的核心问题.Windows 应用商店生态系统中没有内部应用"的概念.让商店应用程序在另一台机器上运行的唯一可能方法是获取只能从商店获得的许可证密钥.
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.
当您在开发机器上开发商店应用程序时,很容易忽略这一点.看起来 运行和调试您的应用不需要此许可证密钥.但实际上有一个,当 Visual Studio 每月一次用对话框纠缠您重新获取您的开发人员许可证密钥时,您会得到它.这是一个临时键,仅使用一个月,纯粹是为了给你足够的时间让你的应用程序稳定运行.没有机制可以将该密钥转移到另一台机器或在一个月到期后保持它(和程序)存活.
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.
当然,您仍然可以将内部应用发布到应用商店.但是,您将像任何其他商店应用程序一样通过验证程序来审查您的适用性和稳定性.不仅仅是像 WACK 这样的机械测试,还有两个人会在你的应用程序发布之前对其进行测试.当您尝试解决沙盒限制(包括协议处理程序黑客攻击)时,他们会毫不犹豫地拒绝您的应用.
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.
一旦获得批准,任何 Windows 8 用户都可以下载它.包括对您的内部公司机密和做法感兴趣的黑客.也很方便,不用脱睡衣.
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.
这个答案需要更新,现在有一种机制可以从专用服务器发布应用程序.这称为侧载.该应用仍然需要证书,而且成本很高,但可以从私人公司控制的私人服务器而不是 Microsoft Store 服务器进行部署.
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.
可在此处获得概览.
这篇关于从 Windows 8 应用程序在 Windows 资源管理器中打开文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:从 Windows 8 应用程序在 Windows 资源管理器中打开文件?
基础教程推荐
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01