...
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.