Pausing and resuming WorkItems

Topics: Mobile Client Software Factory
Jul 11, 2006 at 7:27 AM
originally posted by: donelodes

Hi,

Due to the small resources Pocket PCs have, it is very important to minimize all unnecessary object creation. How can I achieve this in MCSF using CAB?

My specific problem is:
I have an OrderWI and I start a SelectProductsWI has a child WI to select the necessary products for the order. How can I “pause” the SelectProductsWI after all selection is done and return to the OrderWI, so that if I want to change the selected products, I can just “resume” the SelectProductsWI (without needing to terminate the WI and then running it, rebuilding all services and SmartParts)?

Thanks,
Pedro
Jul 11, 2006 at 8:10 PM
originally posted by: dcazzulino

You could just hide the UI for the product selection WI when a valid selection is done, and bring it back sometime after. It's OK for the parent WI to keep a reference to this child, or even get it by name from its own Items collection.
All children will be disposed collectively when the parnet/owner is disposed.

Is that what you're looking for?
Jul 11, 2006 at 11:36 PM
originally posted by: donelodes

Is there a way to hide all the UI of an WI? Because if the child WI has several SmartParts, I would like to hide all with one command and then be able to restore all the same way.

I would not like to have specific code to hide the UI of the SelectProductsWI, but instead a generic way to hide and show a WI UI.

Thanks for the reply!
Jul 12, 2006 at 3:34 AM
originally posted by: donelodes

This is what I want to do:

"There is always an active WorkItem, which implements the currently active use case,
and you can activate and deactivate WorkItems as required. For example, a user may
be in the process of entering a customer order when he or she needs to update that
customer's details. The application can support the deactivation of the order use case
and activation of the customer details use case." (MobileCABObjectBuilder.pdf)

I tried to deactivate a WI but it didn't have any effect: WorkItem.Deactivate();

Any ideas?
Jul 12, 2006 at 11:25 AM
originally posted by: dcazzulino

I'm trying to understand what it is that you want the application to do. That document was ported from the desktop CAB, where deactivating workitems and pieces of UI makes more sense than the device, where you always have a single screen...

What do you expect the de-activation to do?
Jul 12, 2006 at 11:58 PM
originally posted by: donelodes

To simply put it, I want to have WIs that implement independent atomic actions, like selections, visualizations, creations, etc. Then I only need to have a WI for each workflow that I want for my program (orders, customer’s information CRUD...) , which would use the atomic WIs.

For this to work, it would be nice to have the power for not just running and terminating a WI, but also freezing it, so that a workflow WI could just resume it when needed, instead of terminating it and running it again (leading to unnecessary object destruction and creation).

The freezing process could be, as you said it, just hiding all visible UI from a WI. It just has to be in a way that the Workflow WI just commands the atomic WI to freeze/hide, because it doesn't know the atomics implementation. Reading the docs I had the impression that the activation and deactivation could serve this purpose.

Hope I explained it well... What do you think of this?
Jul 14, 2006 at 9:22 AM
originally posted by: dcazzulino

You can achieve the desired effect by overriding hte OnDeactivating method on your custom workitem.