> I have an application which has 8 dialog windows, some
> have timed updates on them (via a timer).
[quoted text clipped - 3 lines]
> application; close down other dialogs etc, kill the timers
> etc?
I solve this problem by means of a Form Manager. In my form base class
(subclassed from System.Windows.Forms.Form), I have placed code in the
constructor that registers each form with the Form Manager (the Form Manager
has a static RegisterForm method that is called). You can either have the
Form Manager store a reference to each form in a collection (reference
should be removed when a form is closed), or you can register the forms as
event handlers of Form Manager events (again, forms should be unregistered
when the form closes).
You can then add a CloseAllForms method to your Form Manager. This method
can call a special "Shutdown" or "Close" method on all active forms (or
raise an event if you're going with that model). Within each form you can
place the intelligence that knows how to shut down that particular form.
I have this working in two different modes...one mode checks if the user has
pending changes and asks if they want to save them. Another "brute force"
mode simply ignores pending changes and closes the forms down.
Regards,
Kevin McNeish
.NET /C# MVP
Chief Software Architect, Mere Mortals .NET Framework
www.oakleafsd.com