Beispiel #1
0
        private async Task PreviewDatasheet(ISearchResult item)
        {
            try
            {
                IsOperationInProgress = true;

                var pdffile = await DownloadDatasheet(item);

                // Shell open the file
                // TODO: This may be potentially dangerous as the file comes from the internet.
                string ext = System.IO.Path.GetExtension(pdffile).ToLowerInvariant();
                if (Settings.AllowedPreviewTypes.Contains(ext))
                {
                    ShellOperation.ShellExecute(pdffile);
                }
                else
                {
                    App.ErrorHandler($"Unsupported file type {ext}", fatal: false);
                }
            }
            finally
            {
                IsOperationInProgress = false;
            }
        }
Beispiel #2
0
 public void OpenItem()
 {
     try
     {
         ShellOperation.ShellExecute(this.FilePath);
     }
     catch (Exception e)
     {
         //((App)App.Current)
     }
 }