Is WorkItem.Run() required before Activate() ?

Topics: CAB & Smart Client Software Factory
Feb 2, 2006 at 2:30 PM
originally posted by: suluhs

I'm kinda new to the CAB and I got confused because it seems there's a discrepancy between the BankTeller sample and the docs. In the BankTeller sample, when you click on the customer list, it launches a new child WorkItem and eventually it will call its Activate() methods. But in the documentation "Working with WorkItems" it shows to call WorkItem.Run() methods.

I tested this on my project and yes you can activate the items without it's being run. None of the OnRunStarted() will get called obviously but the WorkItem status is set to Active.

Now my questions is:
Should calling Activate() without calling Run() first throws an error instead ? Or maybe should automatically run the WorkItem ?
Feb 4, 2006 at 6:11 AM
originally posted by: DLorenz

You can activate it before you run it, but then you won't show any SmartParts, unless you happen to put that code in OnActivated event. Though, that is probably a bad idea.