Close any open modal dialogs opened by the ReportViewer

1 Answer 41 Views
FileDialogs
Canice
Top achievements
Rank 1
Canice asked on 24 Feb 2023, 09:01 AM

Hello,

Our application has a requirement to automatically log a user out after a period of input inactivity, e.g. keyboard or mouse events for security reasons.

When we automatically log out a user, we also want to close any open modal dialogs in our application, including any modal dialogs open in the Telerik ReportViewer - such as the Export / Print dialogs.

Is there a way for cancel/close these modal dialogs?

I looked at the specific events such as ExportBegin  as it provides a way to cancel the export, but I need a way to close the dialogs at any time not just at the specific time the export starts.

 

Thanks,

Canice.

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 01 Mar 2023, 06:39 AM

Hi Canice,

A developer from the Reporting team has already replied to the same question you asked in a Support thread. Here are the highlights related to the technical issue for the benefit of our community. The sample is also attached.

I have attached a sample WPF project that illustrates how to close all child windows within an application (both modal or modeless). A part that can be a bit tricky is the time-related event. Using a DispatcherTimer will not be a viable option as opening a modal dialog will block the dispatcher queue, so that the event should potentially originate on another thread. However, processing the event should be forced on the main thread as all of the application windows are owned by the main thread, and trying to close them on another thread will cause a dispatcher access exception.

Regards,
Todor
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
Tags
FileDialogs
Asked by
Canice
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or