简体   繁体   English

什么是WinRT(C#)上的System.Diagnostic.Process的等价物?

[英]What's the equivalent of the System.Diagnostic.Process on WinRT (C#)?

I need to launch a couple of commands from my WinRT application, like if it were a Command Console, in order to do this, on not WinRT apps the class to be used is System.Diagnostic.Process but on Win RT his class is not available, is there any equivalent class or method that i could use? 我需要从我的WinRT应用程序启动一些命令,比如它是一个命令控制台,为了做到这一点,在WinRT应用程序上,要使用的类是System.Diagnostic.Process但是在Win RT上他的类不是可用,我可以使用任何等效的类或方法吗?

Thanks in advance :) 提前致谢 :)

Windows Store Apps cannot launch other processes directly, as Marylin already said. 正如Marylin所说,Windows应用商店应用无法直接启动其他进程。 You can only use Launcher.LaunchFileAsync to launch the default application for the file type (file ending) the passed file has. 您只能使用Launcher.LaunchFileAsync来启动传递文件所具有的文件类型(文件结尾)的默认应用程序。 Using this you could define a self-defined file type like .process in Windows and set its handler application to a windowless desktop application you write. 使用此方法,您可以在Windows中定义自定义文件类型,如.process,并将其处理程序应用程序设置为您编写的无窗口桌面应用程序。 The desktop application reads the process file which has the path to the application stored that is to start and launches it using Process. 桌面应用程序读取进程文件,该文件具有存储的应用程序路径,该文件将启动并使用Process启动它。

This trick would certainly fail the certification but may be useful in apps you deploy to businesses skipping the Store. 这个技巧肯定会失败,但在您部署到跳过商店的企业的应用程序中可能会有用。 A problem would be that the Windows Store App is set to the background if a Desktop application is launched. 问题是如果启动了桌面应用程序,Windows应用商店应用程序将设置为后台。 I think this is one reason that Microsoft does not allow it for certified apps. 我认为这是微软不允许它用于认证应用程序的一个原因。

You cannot do that from a Windows Store application - those are sandboxed and do not have access to other processes. 您无法从Windows应用商店应用程序执行此操作 - 这些应用程序是沙盒的,无法访问其他进程。 More details here . 更多细节在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM