locked
Windows Application Exception/Offline Handling RRS feed

  • Question

  • Hi all,

    I am currently developing a Windows application which consists of a MDI and few MDI child windows form. 
    At each of the MDI child form, there are some user controls which fire some request to server and wait for the server to response.

    Hope my statement is clear and can be understand.

    So, my question here is in case server is not responding or network is down, then I should switch the whole application to "Offline" mode. From inside the user control, how can I notice main MDI form so that the "Offline" is shown at the application title bar? One of the idea is to throw OfflineException from user control, then catch it at MDI child form then throw again to main MDI form. Does this way make sense?

    Any comment is welcome and appreciated.

    Regards,
    SweeKian
    Tuesday, October 7, 2008 1:14 AM

Answers

  • You could either throw an exception as you have considered or raise an event for the change from online to offline. 

     

    I would raise an event as it is not really an exception.  Exceptions are normally used to cater for unexpected circumstances.  This is one you expect so feels more like a state change to me.

     

    Raising an event could be done from the control to inform the parent form (and ultimately the mainform).   Alternatively, you could have a component/control that periodically checks the online status and raises an event for all components that have registered for the event (including the main form).

    Tuesday, October 7, 2008 10:16 AM

All replies

  • First, I would take a look at the smart client software factory; http://www.codeplex.com/smartclient

     

    I would prefer a client that handled being offline seemlessly.  Perhaps this is not possible in your application?

     

    Tuesday, October 7, 2008 8:21 AM
  • Well, thanks for the idea, Moore.

    I do welcome the idea of SCSF. As when the project is started, the basic structure is as what I told, also, implementing SCSF involve another learning curve for me which may delay the whole project. Thus making the application as it is now.
    Tuesday, October 7, 2008 9:21 AM
  • You could either throw an exception as you have considered or raise an event for the change from online to offline. 

     

    I would raise an event as it is not really an exception.  Exceptions are normally used to cater for unexpected circumstances.  This is one you expect so feels more like a state change to me.

     

    Raising an event could be done from the control to inform the parent form (and ultimately the mainform).   Alternatively, you could have a component/control that periodically checks the online status and raises an event for all components that have registered for the event (including the main form).

    Tuesday, October 7, 2008 10:16 AM