Where to put "logging off" code?

Topics: CAB & Smart Client Software Factory
Jan 10, 2006 at 12:55 PM
originally posted by: mhildner

Greetings,

I'm trying to figure out the best place to put some code that I'd like to be executed when the user closes the WorkItem (or the application). The WorkItem has a single view (UserControl).

I see that the WorkItem has an Terminating event, just not sure if this is the right spot. This is because my single view has a controller object that all messages are passed through. I don't know if it makes sense to have an instance of the controller in the WorkItem as well.

What I'm trying to accomplish is to call a web service saying "I'm logging off" when the user closes the app. If the UserControl had a .Closing event, I'd probably use that.

Any thoughts are appreciated.

Regards,
Mike
Jan 10, 2006 at 1:59 PM
originally posted by: BradWilsonMSFT

Yes, WorkItem's Terminating event is a fine place for this logic.
Jan 10, 2006 at 2:17 PM
originally posted by: mhildner

Thanks for the reply. I'll go with that. It works fine of course, I was just thought it was a little strange, and not sure if I was violating any design priciples, by having an instance of the controller in both the view and the WorkItem.

Regards,
Mike