0

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.

akeyo20
  • 23
  • 3
  • What was the problem with Launcher. I was going to suggest Launcher.LaunchUriAsync. – Andy Jul 31 '20 at 12:04
  • 1. It's not available in normal WPF project. 2. I havent' found proper Uri to use – akeyo20 Jul 31 '20 at 12:11
  • There's a nuget package. https://blogs.windows.com/windowsdeveloper/2017/01/25/calling-windows-10-apis-desktop-application/ Isn't the uri in the manifest? https://learn.microsoft.com/en-us/windows/uwp/launch-resume/handle-uri-activation – Andy Jul 31 '20 at 12:26
  • How can I access this manifest? I don't know target app, it will changes runtime. It may be calculator or something different. User passes AppId and that's all I have. – akeyo20 Jul 31 '20 at 12:31

1 Answers1

0

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.

Nico Zhu
  • 32,367
  • 2
  • 15
  • 36