3
votes

I've been creating a WPF application that initially loads as a task bar icon and then when clicked opens an appropriate window. This was a prototype and I want to move over to Prism and having watched the (superb) videos by Mike Taulty (channel9.msdn.com/niners/mtaulty) I have the feeling that what I need to do is create an application with a custom bootstrapper that does all the service registration but does not create an initial shell but instead simply loads the modules and perhaps identifies a module to Run. Has anyone anyone done something similar, if so how much work am I in for?

1
What about making a hidden and collapsed shell, just to go with the flow and keep Mike happy (I liked his videos also). - Gayot Fow
Garry, the reason is that the application does not really have a window as such. Besides I really don't like the idea of faking an emtpy shell because my next question is how do I get a region manager to work with a new window (that question has been answered elsewhere) and then how do I get the modules to register with the new region manager? So I am still left with some customisation work in the bootstrapper I suspect. - naskew

1 Answers

2
votes

OK I bit the bullet and just tried it. I should first state that I was using the Autofac version of the Bootstrapper.

  • I returned null to CreateShell
  • I marked the apps ShutdownMode="OnExplicitShutdown" in the declaration at the top of App.Xaml (important otherwise it closes the application when you close the last window)
  • I created a module (IModule derived) that loaded the WPF notify icon by Philipp Summi (http://www.codeproject.com/Articles/36468/WPF-NotifyIcon)
  • In response to a command from the context menu on this icon I simply create the window and it's view model and show it.

This all works just as I had hoped. The only thing I have yet to do is see how to use regions with these temporary windows although other articles appear to have this covered. I'm not convinced the Autofac bootstrapper gives me any great advantages but I had developed a very early prototype using Autofac and stuck with it because it went smoothly. I will probably go with Unity or MEF in the long run just to avoid compatibility problems and to allow dynamic module loading from external plugins.