Events on CompositeWPF services

Jul 17, 2008 at 1:07 PM
I am currently porting WPFCAB application to CompositeWPF platform, and I noticed that services (i.e. service interfaces) defined in Prism don't expose events when specific action is executed.
e.g. IModuleLoader does not expose ModuleLoaded event,  IRegionManager does not expose RegionAttached, etc.
Services in CAB provided such events - is there any specific reason why they were omitted in Prism? In WPFCAB I used such events for updating splashscreen on initialization, now I can't find elegant solution for given task. What is the recommended aproach ?

Jul 17, 2008 at 6:06 PM
Hi Simon,

Maybe I'm missing something - your module is loaded after Initialize() is called.  If you need to send a message back to an extenrnal resource, just inject the external resource and communicate with it (i.e. the event aggregator or a shell service) at the end of your Initialize().

class MyModule : IModule
   private IExternalResource _externalResource;

  public MyModule(IExternalResource er) { _externalResource = er; }

  public void Initialize()
     ... do iniitalization


Hope this helps.  Jim
Jul 18, 2008 at 2:00 AM
@JesenkoS, I'd be very interested in your splash solution, as I can't figure out how to get modules loading on a seperate thread which will allow the splash screen to update for modules that take a long time to load (initial model requirement maybe).

@jwalklin, I think I understand what Jesenkos problem is, it's not so much getting an external service to have some event fired, it's more of a global notification within the module loader subsystem.

Jul 18, 2008 at 7:16 AM
@jwalklin: I am aware of such solution, and it would indeed work. But in given example, it's each module responsibility to notify "splashPresenter" that it is loading. I would prefer something like (in bootstrapper):

IModuleLoader loader = container.Resolve<IModuleLoader>();
loader.ModuleLoaded += delegate(object sender, LoaderEventArgs e){
    splashPresenter.EnqueueText ("Loaded module " + e.ModuleName);

Now shell is responsible for appropriate splash notifications. It was indeed possible in CAB, in prism there are no such events exposed - at any service, not just IModuleLoader.

@jwalkin: I am doing it other way around - I am running SplashScreen in separate thread, not module loader. Actually, I ported splash solution I found for CAB (WinForms):
It requires some tweaking, but can be done in wpf also.

Jul 18, 2008 at 9:52 PM

Sorry I wasn't more help.  My only other thought is to bootstrap your own implementation of IModuleLoader that fires the event you desire.

Like Brett, I'd also be interested in your splash solution.

Sep 29, 2008 at 8:10 PM
I am also very insterested in a good implementation of Splash Screen. Would really appreciate your help. Thanks!
Sep 29, 2008 at 8:34 PM
In the absence of a good implementation of a Splash Screen I implemented a "Loading..." message (click HERE for flash demo); the "Loading..." message could be easily replaced with an image.   I blog on it HERE and provide a demo application.