Encontré una solución relativamente simple.
Mi aplicación tiene una clase llamada ShellHandler, que es instanciado en el programa previo e inscrita en el Contenedor La unidad como un conjunto unitario:
Container.RegisterType<IShellHandler, ShellHandler>(new ContainerControlledLifetimeManager());
creé en mi ShellHandler un método que puede ser utilizado por los módulos a la bandera a sí mismos como cargado:
/// <summary>
/// Method used to increment the number of modules loaded.
/// Once the number of modules loaded equals the number of modules registered in the catalog,
/// the shell displays the Login shell.
/// This prevents the scenario where the Shell is displayed at start-up with empty regions,
/// and then the regions are populated as the modules are loaded.
/// </summary>
public void FlagModuleAsLoaded()
{
NumberOfLoadedModules++;
if (NumberOfLoadedModules != ModuleCatalog.Modules.Count())
return;
// Display the Login shell.
DisplayShell(typeof(LoginShell), true);
}
por último, en mi clase ModuleBase, que todos los módulos implementan, he creado un método abstracto que se llama durante el proceso de inicialización:
/// <summary>
/// Method automatically called and used to register the module's views, types,
/// as well as initialize the module itself.
/// </summary>
public void Initialize()
{
// Views and types must be registered first.
RegisterViewsAndTypes();
// Now initialize the module.
InitializeModule();
// Flag the module as loaded.
FlagModuleAsLoaded();
}
public abstract void FlagModuleAsLoaded();
Cada módulo resuelve ahora la instancia del singleton ShellHandler a través de su constructor:
public LoginModule(IUnityContainer container, IRegionManager regionManager, IShellHandler shellHandler)
: base(container, regionManager)
{
this.ShellHandler = shellHandler;
}
Y finalmente implementar el método abstracto de ModuleBase:
/// <summary>
/// Method used to alert the Shell Handler that a new module has been loaded.
/// Used by the Shell Handler to determine when all modules have been loaded
/// and the Login shell can be displayed.
/// </summary>
public override void FlagModuleAsLoaded()
{
ShellHandler.FlagModuleAsLoaded();
}
No creo que el w Hago lo que necesita, pero ¿ha mirado una SplashScreen? – Paparazzi
No estaba al tanto del SplashScreen, lo investigaré, gracias. Sin embargo, no estoy seguro si esto resolverá el problema, ya que aún tendré que determinar cuándo terminaron de cargarse los módulos. –