How to start the shell within a shell?

Topics: Prism v2 - WPF 3.5
May 6, 2009 at 8:32 AM
Edited May 6, 2009 at 10:32 AM
Hi All,
We are using Prism 2.0 for my development.We have more than two modules in a application. Presently we need to open a module in another shell (May be a new instance of the shell). I tried using Process to open up new Shell. But I am not able to load the module in the startup.

Take Microsoft Outlook for example. We can open the Calendar in new window. Here the complete Outlook is duplicated and opened as Calendar. You can navigate to Mail, etc.

Process p = new Process();
p.StartInfo.FileName = System.Reflection.Assembly.GetEntryAssembly().Location;
p.StartInfo.CreateNoWindow = false;
p.StartInfo.UseShellExecute = true;
p.StartInfo.Arguments = query;            
May 7, 2009 at 4:15 PM



I don't know you exact scenario, but I think you have mainly two options depending that your exact needs.

If what you need for your application is to open a new window and have a module load views, regions, etc, into it, you might find useful the RegionPopupBehaviors used in the Stock Trader RI sample. The following thread deal with similar situations:

·         Popup Region

·         Showing a view in a region vs a modal dialog


If what you need for your application is to open a completely new application, you can use the approach you are suggesting. I used your code to reproduce your scenario (without the p.StartInfo.Arguments = query; line) and was able launched another instance of the application. To keep things decoupled I created a LoadApplication service that executes your code and called the service when a button is clicked.


Hope it helps!


Matias Bonaventura

May 7, 2009 at 6:20 PM
Hi Matias,
Thanks for trying the code block. "query" has the commandline arguments to open the selected module on startup and also suppress the login for the new instance of the application.

I am not trying to open a module/view in new window (Popup/Modal dialog). I am trying to open the same shell in as a new process.

For example, I have,
- Shell
- Module 1 (load on demand)
- Module 2 (load on demand)

First, I opened the Shell and clicked the Module 1 menu and it got loaded in the Workspace region. Again when I click Module 2, it should open in a new shell. Since I used p.StartInfo.FileName = System.Reflection.Assembly.GetEntryAssembly().Location, loading Module 2 will fail (all the modules are set to load on demand).

Here the ApplicationDeployment.IsNetworkDeployed will be false and getting ApplicationDeployment.CurrentDeployment.UpdateLocation is not possible to read and download the manifests and Module 2 binaries.

I changed System.Reflection.Assembly.GetEntryAssembly().Location to ApplicationDeployment.CurrentDeployment.ActivationUri (*.application location). I am facing two problems here.
1. This would work only after deployment and also the Shell should be activated/opened from the URL. But my application can be used in offline.
2. It always opens a IE to execute the ApplicationDeployment.CurrentDeployment.ActivationUri and then the Shell is invoked.

Is anyone has solution for this?