Doing UWP development, when you’ve been doing WPF/WinForms development for years, can cause some confusion sometimes.
A colleague of mine got stuck when trying to launch the default application for a particular file he generated in code:
var file = await savePicker.PickSaveFileAsync();
System.Diagnostics.Process.Start(file.Path)
Now, although devs who have been doing .NET development might easily think the above code looks OK, it doesn’t work, all it does is throwing an AccessDenied exception.
Note that UWP apps are running sandboxed, so you are not allowed to use Proccess.Start.
You should be using the Windows.System.Launcher api to do this in UWP instead:
In this short blogpost I want to show you how I've used the Windows.Data.Pdf.PdfDocument class in order to render a PDF file inside my UWP app. In order to open a PDF from a UWP app, you can ofcourse, always use Windows.System.Launcher.LaunchUriAsync like this: Windows.System.LauncherOptions options = new Windows.System.LauncherOptions(); options.ContentType…
The term UWP is used for a lot of things: UI (WinUI), the Windows AppModel, Windows Runtime API, Store Apps,... As I'm planning to keep this a short blogpost, I'm not going to discuss this here :D For sake of this blogpost UWP APIs== the Window Runtime API. Just 1…
8th March 2016 I gave a talk for Mobel ("Belgian Mobile Developer User Group") about Data sharing and Cross-App Communication in UWP. As it was only a short talk (in total there were 3 speakers, each one covering 'data sharing' on an other platform), I had to limit the content…
Leave a Reply