Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: How to create a separate XAP file using Prism/MEFBootstrapper for a complex Child Window?

$
0
0

Thats right Warren. You need to call the LoadModule with the module name defined in your modulescatalog.xaml. Once your module is downloaded you would use regionManager.RequestNavigate to load the view in your MainRegion or whatever the name of the region is in your shell.

From what I understand in your scenario you only have the 2 childwindows in the SharedFormsModule? Then in that case wherever you have an import on the ChildWindows you'll have those properties available for use. With regards to the Initialize() event in your IModule you wouldnt need to do anything. Ideally you would use it to register views with regions, which is usually needed to be done when you use a Unity container for managing your views and viewmodels. In case of MEF implementation you dont need to worry about it. You could plug some initialzation logic for the module in that method, if there is any. Otherwise can be left blank.

The silverlight navigation framework provides you with events like Navigated/NavigationFailed etc. You can hook up to the Navigated event to download your shared module. Also keep in mind you might want to check the module state before calling a LoadModule. Reason being you would download it only once and it will be available in the AggregateCatalog else you would get ugly MEF errors saying the exports could not be recomposed and stuff. So next time around you wont need to download the xap again. Do something like this

var module = ModuleCatalog.Modules.Single(m => m.ModuleName.Equals("SharedFormsModule"));// Check state of the module.if (module.State == ModuleState.NotStarted)
   ModuleManager.LoadModule(module.ModuleName);

Where ModuleCatalog is an implementation of IModuleCatalog (import it in your constructor just like IModuleManager).

Cheers!


Viewing all articles
Browse latest Browse all 1878

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>