示例#1
0
        // ------------------------ 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()
示例#2
0
 // -------------------------- AsyncPrintEvent -------------------------
 /// <summary>
 ///   Called as the asynchronous save proceeds.</summary>
 /// <param name="saveHelper"></param>
 /// <param name="asyncInformation">
 ///   Progress information about the asynchronous save.</param>
 private void AsyncPrintEvent(object printHelper, AsyncPrintEventArgs asyncInformation)
 {
     if (asyncInformation.Completed)
     {
         this.mainCanvas.Background = (Brush)App.Current.FindResource("canvasBrushResource");
         MessageBox.Show("标签打印完成", "打印完成");
     }
 }
示例#3
0
        }// 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()
示例#4
0
        // ----------------------- 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();
            }
        }
示例#5
0
        // ------------------------ 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
            }
        }