c# - 如何从 Windows 8 应用程序启动进程?

标签 c# .net microsoft-metro

我找不到 System.Diagnostics.Process 来启动新进程。我想这是故意的。但是还有别的办法吗?这可能吗?

最佳答案

You can use this reference on Windows 8 Metro application : How to Start a external Program from Metro App. All the Metro-style applications work in the highly sand boxed environment and there is no way to directly start an external application.

您可以尝试使用 Launcher class

  1. Launcher.LaunchFileAsync

    // Path to the file in the app package to launch
    string exeFile = @"C:\Program Files (x86)\App.exe";
    
    var file = await Windows.ApplicationModel.Package.Current.InstalledLocation
                            .GetFileAsync(exeFile);
    
    if (file != null)
    {
        // Set the option to show the picker
        var options = new Windows.System.LauncherOptions();
        options.DisplayApplicationPicker = true;
    
        // Launch the retrieved file
        bool success = await Windows.System.Launcher.LaunchFileAsync(file, options);
        if (success)
        {
           // File launched
        }
        else
        {
           // File launching failed
        }
    }
    
  2. Launcher.LaunchUriAsync

引用:Can I use Windows.System.Launcher.LauncherDefaultProgram(Uri) to invoke another metro style app?

关于c# - 如何从 Windows 8 应用程序启动进程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13563559/

相关文章:

c# - 枚举 Dictionary.Values 与字典本身

c# - 在 C# 中运行 javascript

xaml - Metro XAML-LayoutTransform在哪里?

c# - LINQ 一个简单的问题

c# - 方法 this.hide() 与 this.close()

c# - 将大量可观察量聚合成新的可观察量

c# - 使用 2 个表之间的可选/条件联接进行查询

html - 如何在 Metro 应用程序上实现推送通知

javascript - 限制 Metro-ui datetimepicker 中的过去日期

时间:2019-03-09 标签:c#xorfunctionality