예제 #1
0
        //
        // Create an "async operation complete" event handler
        // for saving a FixedDocumentSequence
        //
        private void AsyncSaveCompleted(
            object sender, WritingCompletedEventArgs e)
        {
            string result;

            if (e.Cancelled)
            {
                result = "Canceled";
            }
            else if (e.Error != null)
            {
                result = "Error";
            }
            else
            {
                result = "Asynchronous operation Completed";
            }

            // Close the pakcage
            _xpsDocument.Close();

            if (OnAsyncSaveChange != null)
            {
                AsyncSaveEventArgs asyncInfo =
                    new AsyncSaveEventArgs(result, true);
                OnAsyncSaveChange(this, asyncInfo);
            }
        }
예제 #2
0
        //
        // Create an "async operation progress" event handler for
        // monitoring the progress of saving a FixedDocumentSequence.
        //
        private void AsyncSavingProgress(
            object sender, WritingProgressChangedEventArgs e)
        {
            _batchProgress++;

            if (OnAsyncSaveChange != null)
            {
                String progress =
                    String.Format("{0} - {1}", e.WritingLevel.ToString(),
                                  e.Number.ToString());
                AsyncSaveEventArgs asyncInfo =
                    new AsyncSaveEventArgs(progress, false);
                OnAsyncSaveChange(this, asyncInfo);
            }

            // Call EndBatchWrite when serializing multiple visuals.
            if ((_activeVtoXPSD != null) && (_batchProgress == 3))
            {
                _activeVtoXPSD.EndBatchWrite();
            }
        }