public void Cancel() { if (_xpsDocWriter != null) { _xpsDocWriter.CancelAsync(); } }
private void btnCancelSave_Click(object sender, RoutedEventArgs e) { //When the 'Cancel' button is clicked, we want to try and //stop the save process. if (xdw != null) { xdw.CancelAsync(); } }
private void btnCancelPrint_Click(object sender, RoutedEventArgs e) { //The user has pressed the cancel button. //First ensure we have a valid XpsDocumentWriter. if (xpsDocumentWriter != null) { //Cancel the job. xpsDocumentWriter.CancelAsync(); } }
/// <summary> /// Cancel button clicked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void CancelClicked(object sender, RoutedEventArgs e) { try { Debug.Write("CancelAsync: "); _docWriter.CancelAsync(); } catch (Exception ex) { Debug.WriteLine("Failed"); MessageBox.Show("Exception Cancelling Async printing: " + ex.ToString()); return; } Debug.WriteLine("Successful"); DialogResult = false; this.Close(); Debug.WriteLine("Successfully closed PrintProgressWindow"); Application.Current.MainWindow.Opacity = 1.0; }
public void CancelAsync() { /* ick. This does not work in windows 8. causes crash. */ /* https://connect.microsoft.com/VisualStudio/feedback/details/778145/xpsdocumentwriter-cancelasync-cause-crash-in-win8 */ m_docWriter.CancelAsync(); }
private void cancelButton_Click(object sender, RoutedEventArgs e) { xpsDocumentWriter.CancelAsync(); }