From 69091936b60777415be121035b8ca26f2fcc886e Mon Sep 17 00:00:00 2001 From: Yan Maniez Date: Thu, 25 Apr 2019 23:09:44 +0200 Subject: [PATCH] LauchFileAsync uwp pour le pdf --- AideDeJeu/AideDeJeu.UWP/NativeAPI.cs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/AideDeJeu/AideDeJeu.UWP/NativeAPI.cs b/AideDeJeu/AideDeJeu.UWP/NativeAPI.cs index 41e83dd5..e39b0551 100644 --- a/AideDeJeu/AideDeJeu.UWP/NativeAPI.cs +++ b/AideDeJeu/AideDeJeu.UWP/NativeAPI.cs @@ -1,8 +1,13 @@ using AideDeJeu.Tools; +using System.Collections.Generic; using System.IO; using System.Reflection; using System.Threading.Tasks; using Windows.ApplicationModel; +using Windows.ApplicationModel.DataTransfer; +using Windows.Foundation; +using Windows.Storage; +using System; [assembly: Xamarin.Forms.Dependency(typeof(AideDeJeu.UWP.Version_UWP))] namespace AideDeJeu.UWP @@ -103,10 +108,20 @@ namespace AideDeJeu.UWP return new FileStream(filepath, FileMode.Create); } - //public void OpenFileExternal(string filename) - //{ - - //} + public async Task LaunchFileAsync(string title, string message, string filePath) + { + try + { + if (!string.IsNullOrWhiteSpace(filePath)) + { + StorageFile attachment = await StorageFile.GetFileFromPathAsync(filePath); + var success = await Windows.System.Launcher.LaunchFileAsync(attachment); + } + } + finally + { + } + } } } \ No newline at end of file