Event pub/sub cross modules?

Topics: CAB & Smart Client Software Factory
Nov 5, 2005 at 12:05 PM
originally posted by: mjiang2000

How do i publish event in one module, then subscribe it in another one? We have tried to use PublicationScope.Global option in EventPublication attribute. But it doesn't help. If we move the subscription code to the same module, it works fine. Very confused..:S
Nov 5, 2005 at 12:05 PM
originally posted by: BradWilsonMSFT

We can successfully do this. Can you provide a very simple repro?
Nov 5, 2005 at 1:03 PM
originally posted by: mjiang2000

We just figure out the reason is the workitem with event subscriber in the other module didn't get created in shell onload event.

To do that we create empty interface call ILoadInBackground and implement it in the workitem need to be created and put following code in shell onload event:

workItemTypeCatalog.CreateEachWorkItem<ILoadInBackground>(workItem.RootWorkItem, delegate(ILoadInBackground item){});

This is a very strange syntax to me, i think it might have some other code style to create the specific workitem. I keep using this syntax style just because bankteller sample is using it. Is there an alternative way to create the workitem in certain module as we want?
Nov 11, 2005 at 8:14 AM
originally posted by: PProvost

Let me explain what that syntax does.

If you have a situation where you don't want your WorkItem to get created at module load time, you can register the workitem type with the work item type catalog so that it can be initialized later.

The final version of the Bank Teller doesn't use this syntax anymore. It now loads up the workitems just like the other quick starts.

Try that and let us know.