[英]How to build modules for a WPF application that run in their own Windows processes?
I'm building my first WPF application which is basically a container window that loads a few pages or "modules" within it. 我正在构建我的第一个WPF应用程序,该应用程序基本上是一个容器窗口,在其中加载了几页或“模块”。 This works, however I would like to make each module its own process within Windows so it could be force quit and wouldn't affect the rest of the application.
这行得通,但是我想在Windows中使每个模块都有自己的进程,因此可以强制退出它,并且不会影响应用程序的其余部分。
As an example, I'd use Google's Chrome. 例如,我将使用Google的Chrome。 Each tab runs in its own Windows process, and Chrome even has its own internal task manager to manage them.
每个标签页都在其自己的Windows进程中运行,Chrome甚至具有自己的内部任务管理器来管理它们。 This is what I would like to accomplish but I'm not sure of the best way.
这是我要完成的工作,但我不确定最佳方法。
Do I have to create a separate project for each module and then run each executable within my MainWindow? 我是否必须为每个模块创建一个单独的项目,然后在MainWindow中运行每个可执行文件? I would prefer to be able to do this from within one project.
我希望能够从一个项目中做到这一点。
Use application domains to isolate tasks that might bring down a process. 使用应用程序域隔离可能导致进程中断的任务。 If the state of the AppDomain that's executing a task becomes unstable, the AppDomain can be unloaded without affecting the process.
如果正在执行任务的AppDomain的状态变得不稳定,则可以卸载AppDomain而不影响过程。 This is important when a process must run for long periods without restarting.
当进程必须长时间运行而不重新启动时,这一点很重要。 You can also use application domains to isolate tasks that should not share data
您还可以使用应用程序域来隔离不应共享数据的任务
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.