简体   繁体   中英

Launching UWP application in simple C# app (WPF/Console)

I work on.NetFramework WPF app and I need to run some UWP app, like calculator having only APPID (or family package name, I suppose) like:

Microsoft.WindowsCalculator_8wekyb3d8bbwe!App

Honestly I have no idea how to do it. Google doesn't help. Process.Start() will not manage, as I don't have exe filepath. Any suggestions? I tried to reference UWP launcher but it failed.

Launching UWP application in simple C# app (WPF/Console)

WindowsCalculator is open source, you could get app's protocol name here. So you could use Launcher to launch WindowsCalculator app from WPF or Console.

private async void Button_Click(object sender, RoutedEventArgs e)
{
   var res = await Launcher.LaunchUriAsync(new Uri("ms-calculator:"));
}

And this is sample . Please note, you need add Windows.winmd and System.Runtime.WindowsRuntime.dll for the WPF app. For more please refer this reply .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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