Hi
We use CR13 in a project. This is a WPF solution. How i can render the report asynchronous with the CrystalReportsViewer control?
When I start the form in a new thread, not the main UI thread, then crashed the CrystalReportsViewer control.
System.NullReferenceException was unhandled
Message: An unhandled exception of type 'System.NullReferenceException' occurred in SAPBusinessObjects.WPF.Viewer.dll
Additional information: Object reference not set to an instance of an object.
With this code work the CrystalReportsViewer, but the main UI is blocked.
public void OpenCrystalReport(ReportGeneratorModel model)
{
if (Thread.CurrentThread == this.Dispatcher.Thread)
{
//show report in crystalreportviewer
CristalReportForm frm = new CristalReportForm(model);
if (model.ShowOnScreen)
{
frm.Show();
}
}
else
{
Action<ReportGeneratorModel> delaget = this.OpenCrystalReport;
this.Dispatcher.Invoke(delaget, new object[] { model });
}
}
With this code we have a NullReferenceException.
publicvoidOpenCrystalReport(ReportGeneratorModel model)
{
//show report in crystalreportviewer
CristalReportForm frm =newCristalReportForm(model);
if (model.ShowOnScreen)
{
frm.Show();
}
}
How to start the rendering nonblocking?