Search This Blog

Thursday, August 22, 2013

How to prompt when the user is about to exit a WinForms application

Today I improved  the implementation one of my WinForms examples by changing the code and also by adding functional tests powered by our EasyTest engine.

This example is about displaying confirmation message when the main application window is being closed by a user to avoid accidental closure of the whole application and losing all opened screens:


You might remember this behavior from many browsers, which ask you under similar circumstances.
This is not rocket science (just a single WindowController for you to add), but probably your end-users will appreciate it.

www.devexpress.com/example=E527

The functional test is also quite straightforward and easy to understand for regular human beings:




#DropDB E527
#Application E527Win

*Action Exit
*HandleDialog
 Caption = Exit
 Message[0] = You are about to exit the application*
 Respond = No

*Action New
*Action Save and Close
*Action Edit Model           ;We need to ensure that no confirmation appears in this case!


A bit off-topic, but since we touched base on functional testing here, I would like to remind you about our new  TestCafé product (I like this name!), which is essentially "a system for creating and running functional tests for web pages, sites, or applications" (learn more on this from here, if you are interested in it). Although it has no any relation to XAF, XAF ASP.NET apps can be tested using it as well as any other web site.

I hope you find this information helpful.

No comments:

Post a Comment