OnDeactivating issue

Topics: CAB & Smart Client Software Factory
Jan 6, 2006 at 9:49 PM
originally posted by: Badajoz95

Hi,

I have an issue with the OnDeactivating WorkItem event. I want to use it to check whether the user has saved data from the WorkItem before they navigate away. In my override OnDeactivating event I check if WorkItem has changed, if it has, I give them a dialog asking if they want to really navigate away and loose their data. I use the CancelEventArgs to allow the WorkItem to deactivate or stay active.

My issue is - if I put a break point into my OnDeactivating code it works fine... but if I don't have a break point it does not.

Any ideas?

(I'm happy to provide more information on request)

Thanks in advance,

Paul.
Jan 7, 2006 at 5:04 AM
originally posted by: DLorenz

Do you really want OnDeactivating? Or do you really want OnTerminating?
Jan 9, 2006 at 11:59 AM
originally posted by: Badajoz95

Thanks for your reply.

I was thinking of asking the user to save OnDeactivating (aka in my mind when it looses user focus) rather than OnTerminating because when the user no longer sees the WorkItem would be a good point at which to ask them to commit their changes.

I orginally considered OnTerminating but I thought that there would be some performance advantage with keeping it active (in memory) rather than terminating it, when the user navigates back to the WorkItem at some point later.

I really appreciate your reply and will definately try your suggestion as an alternative because I need to take a pragmatic view towards getting a working system. It is good to have someone else prod one towards alternatives.

Perhaps my premises of deactivated and terminated are no in tune with those of the CAB by design?

The whole works when debugging thing gives me nightmares
Jan 10, 2006 at 5:07 AM
originally posted by: DLorenz

Well, actually everything is still sitting in memory whether it is active or inactive. I know for the project I am working on, they want to be able to be in the middle of something, then jump to something else (like a sales transaction), then come back to where they left off. In that instance, you don't want them to force them to commit changes in the middle of what they are doing. Instead, if you do it OnTerminating, you can ask if they want to save (if they didn't already). If they want to, then you can abort the Terminate or actually save the data (depending on the wording you use to prompt them). Hope this helps.