Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/315.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在c中的应用程序中运行Windows IoT应用程序#_C#_Windows Iot Core 10 - Fatal编程技术网

C# 如何在c中的应用程序中运行Windows IoT应用程序#

C# 如何在c中的应用程序中运行Windows IoT应用程序#,c#,windows-iot-core-10,C#,Windows Iot Core 10,我正在尝试编写一个简单的主菜单应用程序,用户可以点击一个按钮,然后它将启动一个已经安装在Windows10IoT中的应用程序。(以“IoTCoreMediaPlayer”应用程序为例) 这是我的密码: private void Button_Click(object sender, RoutedEventArgs e) { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.File

我正在尝试编写一个简单的主菜单应用程序,用户可以点击一个按钮,然后它将启动一个已经安装在Windows10IoT中的应用程序。(以“IoTCoreMediaPlayer”应用程序为例)

这是我的密码:

private void Button_Click(object sender, RoutedEventArgs e)
    {
        ProcessStartInfo startInfo = new ProcessStartInfo();
        startInfo.FileName = @"C:\Data\USERS\DefaultAccount\AppData\Local\DevelopmentFiles\IoTCoreMediaPlayerVS.Debug_ARM.User\entrypoint\IoTCoreMediaPlayer.exe";
        startInfo.Arguments = f;
        Process.Start(startInfo);
    }
但是,这不起作用,并导致以下错误:

System.NotImplementedException: 'The method or operation is not implemented.'
根据:

using Media_Center;

namespace System.Diagnostics
{
internal class Process
{
    internal static void Start(string v)
    {
        throw new NotImplementedException();
    }

    internal static void Start(ProcessStartInfo startInfo)
    {
        throw new NotImplementedException(); <===
    }
}
}
使用媒体中心;
名称空间系统诊断
{
内部类过程
{
内部静态无效开始(字符串v)
{
抛出新的NotImplementedException();
}
内部静态无效启动(ProcessStartInfo startInfo)
{
抛出new NotImplementedException();您可以参考此示例,它演示如何从另一个UWP应用程序启动UWP应用程序。
在此示例中,您可以找到操作代码:

private async void RunMainPage_Click(object sender, RoutedEventArgs e) 
{ 
    await LaunchAppAsync("test-launchmainpage://HostMainpage/Path1?param=This is param"); 
} 

private async void RunPage1_Click(object sender, RoutedEventArgs e) 
{ 
    await LaunchAppAsync("test-launchpage1://Page1/Path1?param1=This is param1&param1=This is param2"); 
} 

private async Task LaunchAppAsync(string uriStr) 
{ 
    Uri uri = new Uri(uriStr); 
    var promptOptions = new Windows.System.LauncherOptions(); 
    promptOptions.TreatAsUntrusted = false; 

    bool isSuccess = await Windows.System.Launcher.LaunchUriAsync(uri, promptOptions); 

    if (!isSuccess) 
    { 
        string msg = "Launch failed"; 
        await new MessageDialog(msg).ShowAsync(); 
    } 
}
诀窍是在要启动的应用程序上指定Windows协议,并在LaunchApp URI中指定该协议

此外,如果要启动外部进程(exe),可以参考此示例。

您可以参考此示例,它演示如何从另一个UWP应用程序启动UWP应用程序。 在此示例中,您可以找到操作代码:

private async void RunMainPage_Click(object sender, RoutedEventArgs e) 
{ 
    await LaunchAppAsync("test-launchmainpage://HostMainpage/Path1?param=This is param"); 
} 

private async void RunPage1_Click(object sender, RoutedEventArgs e) 
{ 
    await LaunchAppAsync("test-launchpage1://Page1/Path1?param1=This is param1&param1=This is param2"); 
} 

private async Task LaunchAppAsync(string uriStr) 
{ 
    Uri uri = new Uri(uriStr); 
    var promptOptions = new Windows.System.LauncherOptions(); 
    promptOptions.TreatAsUntrusted = false; 

    bool isSuccess = await Windows.System.Launcher.LaunchUriAsync(uri, promptOptions); 

    if (!isSuccess) 
    { 
        string msg = "Launch failed"; 
        await new MessageDialog(msg).ShowAsync(); 
    } 
}
诀窍是在要启动的应用程序上指定Windows协议,并在LaunchApp URI中指定该协议

此外,如果要启动外部进程(exe),可以参考此示例