Hi,
I am using Prism 4.1 with MEF. What i want is to run Bootstrapper on background silently while my login window shows up. So that user can continue to input username and password while the Bootstrapper is loading a lot of modules.
In order to get this, I am using BackgroundWorker.However i get error saying "The calling thread must be STA, because many UI components require this.". I tried to use a thread with STA mode to run the BackgroundWorker, however it caused other issues that i could't figure out. in order to avoid this issue, i return null as a result of CreateShell()
when the Bootstrapper is running. and after Bootstrapper is loaded completely, i set the Shell property via SetShell() as shown in below. However, I got error saying "The region manager does not contain the ShellApplicationMdiContainerRegion region." . The "ShellApplicationMdiContainerRegion" is the region name I defined in ShellView xaml. Seems to me that this region is not registered in the prism.
Could someone shred some light on this?
By the way, I don’t want to use a thread with STA mode as well as Application.Current.Dispatcher.Invoke method to run Bootstrapper as any of them will cause other big issues.
I am using Prism 4.1 with MEF. What i want is to run Bootstrapper on background silently while my login window shows up. So that user can continue to input username and password while the Bootstrapper is loading a lot of modules.
In order to get this, I am using BackgroundWorker.However i get error saying "The calling thread must be STA, because many UI components require this.". I tried to use a thread with STA mode to run the BackgroundWorker, however it caused other issues that i could't figure out. in order to avoid this issue, i return null as a result of CreateShell()
when the Bootstrapper is running. and after Bootstrapper is loaded completely, i set the Shell property via SetShell() as shown in below. However, I got error saying "The region manager does not contain the ShellApplicationMdiContainerRegion region." . The "ShellApplicationMdiContainerRegion" is the region name I defined in ShellView xaml. Seems to me that this region is not registered in the prism.
Could someone shred some light on this?
By the way, I don’t want to use a thread with STA mode as well as Application.Current.Dispatcher.Invoke method to run Bootstrapper as any of them will cause other big issues.
protected override DependencyObject CreateShell()
{
return null;
}
private void Backgroundworkder_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
bootstrapper.SetShell();
}
public void SetShell()
{
this.Shell = this.Container.GetExportedValue<ShellView>();
}