private async void PDFView_InitializationCompletedHandlerAsync(PdfView sender, PSPDFKit.Pdf.Document document) { // If we already have a file to open lets proceed with that here. if (_fileToOpen != null) { await PDFView.OpenStorageFileAsync(_fileToOpen); } _pdfViewInitialised = true; }
/// <summary> /// Take the file and call the conroller to open the document. /// </summary> /// <param name="file">File to open.</param> internal async Task OpenFileAsync(StorageFile file) { _fileToOpen = file; // If the PdfView is already initialised we can show the new document. if (_pdfViewInitialised) { try { await PDFView.OpenStorageFileAsync(file); } catch (Exception e) { // Show a dialog with the exception message. var dialog = new MessageDialog(e.Message); await dialog.ShowAsync(); } } }