Prism 4 Splash Screen with MEF Loader

I have a prism 4 application using the MEF bootloader. I have implemented a screensaver from the bootloader and I want to provide the user with information about the module (as they load) when the module manager loads the application / modules.

I think I need to subscribe to the LoadModuleCompleted event in the module manager. I cannot do this because when I decide the module manager with the container in the MEF boot block, the PRISM framework calls OnImportsSatisfied, which loads all the modules. (Too late since I want to listen to this).

How to display a popup with a progress bar displaying module information / progress?

Many thanks!

+7
source share
1 answer

If you manage the components that are imported into your project, you can implement IPartImportsSatisfiedNotification for each of them and tell them your own progress in any imported progress monitor class:

 public interface IProgressMonitor { void ReportComposed(Type type); } [Export(typeof(IProgressMonitor))] public class ProgressMonitor : IProgressMonitor { public ProgressMonitor() { var loadHeuristic = this.GetPreviousLoadProgress(); if (loadHeuristic == null) { // Never been loaded before, so it unclear how long it will take // Set indeterminate progress bar. } else { // Use previous load times to estimate progress. _loadHeuristic = loadHeuristic; _progress = 0; } } public void ReportComposed(Type type) { if (_loadHeuristic != null) { this.IncrementProgress(); } } } [Export] public class FooExport : IPartImportsSatisfiedNotification { [Import] internal IProgressMonitor ProgressMonitor { get; set; } public void OnImportsSatisfied() { this.ProgressMonitor.ReportComposed(typeof(FooExport)); } } 
0
source

All Articles