ViewSwitchingNavigation example - bad code/bug

Topics: Prism v4 - Silverlight 4
Jul 20, 2011 at 3:04 PM

Hey guys.

Look at

\Quickstarts\View-Switching Navigation\Silverlight\View-Switching Navigation\ViewSwitchingNavigation\Shell.xaml.cs.

Example shows how to navigate to a view when module is ready. Navigation happens in OnImportsSatisfied() method.

This method called twise because there are two properties initialized

 [Import(AllowRecomposition = false)]
 public IModuleManager ModuleManager;

 [Import(AllowRecomposition = false)]
 public IRegionManager RegionManager;
It means that subscription for LoadModuleCompleted event done twise..
public void OnImportsSatisfied()
            this.ModuleManager.LoadModuleCompleted +=
                (s, e) =>{....}
Not good example...
Jul 20, 2011 at 3:16 PM


Thank you for notifying this. Please note that there is already a work item in the issue tracker created to report this, so you could vote for it so that the product team considers it for a future release:

ModularityWithMef "module loaded" displayed twice


Guido Leandro Maliandi