private async void btnViewDoc_Click(object sender, RoutedEventArgs e) { string wordDocument =txbSelectedWordFile.Text; if (string.IsNullOrEmpty(wordDocument) || !File.Exists(wordDocument)) { MessageBox.Show("The file is invalid. Please select an existing file again."); } else { string convertedXpsDoc = string.Concat(Path.GetTempPath(), "\\", Guid.NewGuid().ToString(), ".xps"); //await AssignDocument(wordDocument, convertedXpsDoc); //System.Threading.Tasks.Task MyNewTask = System.Threading.Tasks.Task.Factory.StartNew(() => AssignDocument(wordDocument, convertedXpsDoc)); } } private async Task<bool> AssignDocument(string wordDocumentURI, string xpsDocURI) { XpsDocument xpsDocument = ConvertWordToXps(wordDocumentURI, xpsDocURI); if (xpsDocument == null) { return false; } else { documentviewWord.Document = xpsDocument.GetFixedDocumentSequence(); return true; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)