Post-initialization event completed in WPF / Prism application

In a WPF application without a prism, if I want to run the code after initialization (for example, to complete the task specified by the command line argument), I can do this in the Loadedmain window event . However, with Prism, the modules are initialized after the main window is displayed, that is, it is IModule.Initialize()called after Bootstrapper.CreateShell()and Bootstrapper.InitializeShell(). In this case, which event / override should be used?

+3
source share
1 answer

The last thing called UnityBootstrapper.Run(bool runWithDefaultConfiguration)is InitializeModules()(well, except for calling Logger.Log). So, redefine Run (...).

class Bootstrapper : UnityBootstrapper
{
    ...
    public override void Run(bool runWithDefaultConfiguration)
    {
        base.Run(runWithDefaultConfiguration);

        // modules (and everything else) have been initialized when you get here
    }
}
+5
source