组织多个复合 WPF 应用程序以共享单个 Shell

发布于 2024-07-25 04:39:40 字数 431 浏览 8 评论 0原文

如何组织多个复合 WPF 应用程序,以便它们共享单个 Shell 项目,但从不同的 App.config 文件填充其模块目录?

我正在使用 WPF 复合应用程序指南编写一套应用程序。 每个应用程序的功能由不同模块的可用性决定,这些模块列在 Shell 的 App.config 中。 通过为每个应用程序提供不同的 App.config,我可以指定每个应用程序可以使用哪些模块。

不过,我想在所有应用程序之间共享一个 Shell 项目,以获得共同的外观和感觉。 最初我为每个应用程序创建了一个解决方案,添加了 Shell 项目,然后添加了相关模块。 问题是常见的 Shell 项目只有一个 App.config 文件,我无法针对每个解决方案更改它。

通过代码填充目录并不能避免此问题 - Shell 中仍然存在特定于应用程序的代码,必须以某种方式由我正在使用的解决方案激活。

How can I organize multiple Composite WPF applications so that they share a single Shell project but populate their module catalogs from different App.config files?

I am writing a suite of applications using Composite Application Guidance for WPF. Each application's functionality is determined by the availability of different modules, which are listed in the Shell's App.config. By giving each application a different App.config, I can specify which modules each application may use.

However I would like to share a single Shell project between all of the applications for common look and feel. Initially I created a Solution for each application, added the Shell project, and then added the relevant modules. The problem is that the common Shell project only has one App.config file, and I cannot change it on a per-Solution basis.

Populating the catalog through code does not avoid this problem--there would still be application-specific code in the Shell that must somehow be activated by the Solution I am using.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

剩余の解释 2024-08-01 04:39:40

我决定将 Shell 视为自己的模块。 每个应用程序都有自己的解决方案和项目,其中包含单独的 App.config 文件。 他们也有自己的 Bootstrapper 类。 每个应用程序中的 Bootstrapper 都会实例化 Shell。

What I decided to do was to treat the Shell as its own module. Each application has its own solution and project, which contain the individual App.config files. They also have their own Bootstrapper classes. The Bootstrapper in each application instantiates the Shell.

扬花落满肩 2024-08-01 04:39:40

除了硬编码模块和从配置加载模块之外,您还可以从给定目录动态加载模块。

因此,为了设置所有使用相同 shell 的不同“应用程序”,我将创建一个批处理文件,将每个应用程序的正确模块复制到单独的文件夹,从而创建不同的应用程序。

复合指导库文档详细介绍了如何设置项目以从目录动态加载模块。

Apart from hard coding modules, and loading modules from the configuration, you can also load modules dynamically from a given directory.

So to set up different "apps" that all use the same shell, I'd create a batch file that copies the right modules for each app to separate folders, thus creating the different applications.

The Composite Guidance Library documentation has more on setting up your project to load modules dynamically from a directory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文