This is a migrated thread and some comments may be shown as answers.
PrintCompleted problem
1 Answer 9 Views
This is a migrated thread and some comments may be shown as answers.
kity
Top achievements
Rank 2
kity asked on 20 Sep 2013, 12:35 PM
...


 

public abstract class ExportProvaiderDocument : RadDocument, IValidatable, IDisposable
{
  
  public abstract void Export();
    
}
  
  
  
public class PrintProvaider : ExportProvaiderDocument
{
  
  public RadRichTextBox PrintBox = new RadRichTextBox();
  
  public RadRichTextBox PrintBox = new RadRichTextBox();
  
        public override void Export()
        {
            if (this.Validate())
            {
                try
                {
                    Print();
                }
                catch (System.InvalidOperationException ie)
                {
                    // There is no DocumentFormatProvider which supports html
                    Telerik.Windows.Documents.FormatProviders.DocumentFormatProvidersManager.RegisterFormatProvider(new HtmlFormatProvider()); // Some Telerik depending
                    Print();
                }
            }
        }
          
          
        public void Print()
        {
            this.PrintBox.Document = this; // set RadDocument, before that one of my provaider set raddocument. All Provaiders like class "PrintProvaider" inherited ExportProvaiderDocument
  
            var printSettings = new Telerik.Windows.Documents.UI.PrintSettings();
            printSettings.DocumentName = "Print Report";
            printSettings.PrintMode = Telerik.Windows.Documents.UI.PrintMode.Html;
            printSettings.PrintScaling = Telerik.Windows.Documents.UI.PrintScaling.None;
  
            //this.PrintBox.PrintCompleted -= _printEventHandler;
            //_printEventHandler = (s, a) =>
            //{
            //    Wave.Platform.PortalFramework.Infrastructure.MessageBox.WaveMessageBox.Info("Report was successfully printed.");
            //    this.PrintBox.Document = new RadDocument();
            //};
  
            //this.PrintBox.PrintCompleted += _printEventHandler;
  
  
            this.PrintBox.PrintCompleted += PrintBox_PrintCompleted;
            this.PrintBox.Print(printSettings);
        }
  
        void PrintBox_PrintCompleted(object sender, Telerik.Windows.Documents.UI.PrintCompletedEventArgs e)
        {
            Wave.Platform.PortalFramework.Infrastructure.MessageBox.WaveMessageBox.Info("Report was successfully printed.");
        }
          
          
          
          
}



Bug description: When I print document via PRINTER machine, event PrintCompleted() never call/enter.
Check function "PrintBox_PrintCompleted()".

 

IValidatable is custome interfaice - it is not important
IDisposable is standart interfaice for free non manage inctance like FileStream (one of my properties in abstract class). Standart implementation.

 

1 Answer, 1 is accepted

Sort by
0
kity
Top achievements
Rank 2
answered on 20 Sep 2013, 12:36 PM
Version: 2013.1.527.1050
Asked by
kity
Top achievements
Rank 2
Answers by
kity
Top achievements
Rank 2
Share this question
or