We have a report with text data and with a chart with functionality to cancel the report while it is still in rendering phase.
Currently I do this (which serves the purspose):
Code: Select all
report.Rendering += (s, e) => {
if (cancelled && !report.IsStopped)
{
report.IsStopped = true;
Log.Trace("Cancellation of report rendering requested after {0} pages", report.RenderedPages.Count);
}
};
Usually a page is rendered quite fast hence this usually works fine for a report which just has text.
Problem: When I try to render a chart which has too many series to plot then it may take long time to complete the rendering.
Because Chart is rendered in only ONE PAGE, the Rendering event handler is not fired during chart rendering process and hence I do not have any way to to check if report is being cancelled and say report.IsStopped=true (from the same thread context which is rendering the report).
So, I would like to know is there any good way to cancel a report which is rending a chart which may take quite long time to load. Like, Is there any event handler which can be called during the chart rendering phase or which can be called periodically.
Any advice will be of great help.
Thanks,
Sandeep