WorkItemExtension question

Topics: Mobile Client Software Factory
Sep 15, 2006 at 12:41 AM
originally posted by: donelodes

Hi,

In the reference implementation, when using a WorkItemExtension, it is overrided the OnActivated method to add the extension actions.

I tried overriding the OnRunStarted method so it is not called every time the WorkItem is activated, but this method is never called!

Can anybody explain why?

Thanks in advance,
Pedro
Sep 16, 2006 at 1:23 AM
originally posted by: dcazzulino

Have you tried debugging it? It should definitely be called if the Run method of the WorkItem is called...
Sep 16, 2006 at 1:42 AM
originally posted by: donelodes

Yes,

I added this code to the MapWorkItemExtension in the RI:

protected override void OnRunStarted()
{
base.OnRunStarted();
}

When debugging it, it never stops here, only in the OnActivated() method.

Shouldn't it be called?
Sep 16, 2006 at 7:03 AM
originally posted by: donelodes

I think I found the problem.

The Run() in the WorkItem calls the OnRunStarted method, which calls the RunStarted event.

The problem is that the CustomerDetails isn't a WorkItem but a WorkItemController, which uses a ControlledWorkItem (that extends WorkItem) and overrides the OnRunStarted method of the WorkItem.

Shouldn't the ControlledWorkItem OnRunStarted method call the base method?

base.OnRunStarted();

This way the event would be called...
Sep 16, 2006 at 11:29 AM
originally posted by: dcazzulino

Good catch!
It definitely should.
That's part of the RI and the solution template, isn't it?
Sep 16, 2006 at 1:04 PM
originally posted by: donelodes

Yes.

Hope it helped,
Pedro