// ------------------------ AsyncPrintCompleted ----------------------- /// <summary> /// Creates an "async operation complete" event handler /// for print completion of a FixedDocumentSequence.</summary> private void AsyncPrintCompleted( object sender, WritingCompletedEventArgs e) { string result = null; if (e.Cancelled) { result = "Canceled"; } else if (e.Error != null) { result = "Error"; } else { result = "Asynchronous Print Completed"; } if (OnAsyncPrintChange != null) { AsyncPrintEventArgs asyncInfo = new AsyncPrintEventArgs(result, true); OnAsyncPrintChange(this, asyncInfo); // update display status } }// end:AsyncPrintCompleted()
}// end:AsyncPrintCompleted() // ----------------------- AsyncPrintingProgress ---------------------- /// <summary> /// Creates an "async operation progress" event handler for tracking /// the progress in printing a FixedDocumentSequence.</summary> private void AsyncPrintingProgress( object sender, WritingProgressChangedEventArgs e) { _batchProgress++; if (OnAsyncPrintChange != null) { String progress = String.Format("{0} - {1}", e.WritingLevel.ToString(), e.Number.ToString()); AsyncPrintEventArgs asyncInfo = new AsyncPrintEventArgs(progress, false); OnAsyncPrintChange(this, asyncInfo); // update display status } // Will only called EndBatchWrite when serializing Multiple Visuals if (_activeVtoXPSD != null && _batchProgress == 3) { _activeVtoXPSD.EndBatchWrite(); } }// end:AsyncPrintingProgress()