private async void Open_openFile() { dictationTextBox.SelectionChanging += dictationTextBox_SelectionChanging; switch (openFile.FileType) { case ".pdf": dictationTextBox.Text = await SaveFilePdf.Read(openFile).ConfigureAwait(true); currentFormatFile = "PDF"; break; case ".docx": dictationTextBox.Text = await SaveFileDocX.OpenFileWord(openFile).ConfigureAwait(true); currentFormatFile = "DOCX"; break; case ".doc": dictationTextBox.Text = await SaveFileDoc.OpenFileWord(openFile).ConfigureAwait(true); currentFormatFile = "DOC"; break; } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { if (this.mainPage.IsEnabled == false) { this.mainPage.IsEnabled = true; } try { if (e.Parameter is StorageFile) { StorageFile f = (StorageFile)e.Parameter; openFile = f; Open_openFile(); } } catch (NullReferenceException) { } try { //var entry = this.Frame.BackStack.LastOrDefault(); //if (entry.SourcePageType.Name == "recent") //{ // recentFile = (StorageFile)e.Parameter; // OpenFileDialog_Click(null, null); // //await appWindow.CloseAsync(); //} } catch (NullReferenceException) { } string textFile = ""; if (e != null) { try { this.shareOperation = (ShareOperation)e.Parameter; } catch (InvalidCastException) { } } if (this.shareOperation != null) { IEnumerable <IStorageItem> file = await shareOperation.Data.GetStorageItemsAsync(); foreach (var item in file) { StorageFile f = (StorageFile)item; switch (f.FileType) { case ".pdf": SaveFilePdf.openFile = f; openFile = f; textFile = await SaveFilePdf.Read(openFile).ConfigureAwait(true); currentFormatFile = "PDF"; break; case ".doc": SaveFileDoc.openFile = f; openFile = f; textFile = await SaveFileDoc.OpenFileWord(openFile).ConfigureAwait(true); currentFormatFile = "DOC"; break; case ".docx": SaveFileDocX.openFile = f; openFile = f; textFile = await SaveFileDocX.OpenFileWord(openFile).ConfigureAwait(true); currentFormatFile = "DOCX"; break; } } dictationTextBox.Text = textFile; } if (PrintManager.IsSupported()) { } else { //InvokePrintingButton.Visibility = Visibility.Collapsed; } printHelper = new PrintHelper(this); }