开发者

Hosting WPF/Surface application within WPF/Surface application

I am trying to create a parent WPF/surface application which will host multiple WPF/surface applications. I am looking for some pointers of how to implement such functionality. Was reading http://msdn.microsoft.com/en-us/library/ms742522.aspx but it talks about hosting Win32 content in WPF and vice versa.

My idea is to have something similar to MDI forms where you have a main form and you can instantiate multiple child forms.

In my case, these would be different applications which will be launched using a config file and loaded within the main application.

Also, since is there a way to ensure that the main window's process memory is not hogged by the child process initiated.

Edit: The host application will launch different applications based on what user selects. One can say its like an application launcher which are build on WPF/Surface touch SDK. Now once the application开发者_如何学Python is launched the launcher goes in the background(except showing small button to bring it forward again at some point later) and when the user ends the current application launcher comes back again in foreground. The only interaction i feel which is necessary is knowing the launched application is terminated or invoking applications in a limited screen area. If someone has seen the Microsoft surface application launcher, even when the application is launched there are corner buttons which bring the app launcher to foreground.


I would first look at using Microsoft Prism, specifically the Modularity namespace.


Except for the "different applications" part, it sounds like a classic case for MVVM. Are these "different applications" actually separate applications, or could they simply be separate projects within the same application? That may simplify the choice of presentation.

I suppose you could still have a View called "Host" that presents a different app.

Of course, WPF doesn't have the concept of MDI, but you can open multiple, non-modal windows.

It really depends on what you mean by "hosting". Does the main window need to somehow handle and/or interact with the other applications, or is it just a launching pad for other applications?


I followed this approach to solve this problem. The launcher was not hosting the application within itself but would launch a new application and hide itself.

Steps I followed:

  1. The main launcher application will run in Kiosk mode i.e always on top/no option to close by capturing the close event/No instance shown in taskbar/no title bar/killing the explorer.exe/hiding the taskbar.
  2. The launcher populates a horizontal listbox (data templated for UI) which lets occupied main center area of screen and can be scrolled either ways.
  3. When user selected an item on listbox, click/tap event a separate process is launched with launcher window's visibility set to hidden and a small button(basically a window with just a button inside and size set to height/width of button) created on the either corner of the screen with always on top option.
  4. The functionality of button is to minimize the current working application and set visibility of launcher back to visible and setting the focus to this window.
  5. Since the process is launched by launcher, i trap the close event for the launched window to know user ended the application and then again pop up the launcher back.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜