Shell 布局和切换视图的最佳实践 - Prism、SL4、按需加载模块

发布于 2024-08-26 07:28:48 字数 429 浏览 5 评论 0原文

我正在学习 Prism,我有一个关于主 Shell 的最佳方法的问题。

假设 Shell 有 2 个区域:工具栏、主区域。 工具栏有 3 个主要按钮,每个按钮代表不同的按需加载模块。 这些模块中的每一个目前都将自己注册为适合主区域。

当我单击其中一个按钮时,我想要执行以下操作:

通知任何活动视图其正在切换,如果仍需要挂起的操作,则可以选择取消。 这可能会级联到子视图。

如果操作未取消,则加载按需模块(如果尚未加载),否则在区域内激活它。

这三个模块是否应该全部适合同一区域,或者我的 shell 是否应该在内容演示器中定义 3 个区域?

我遇到的问题之一是,当您从模块初始化注册视图时,它不会添加强类型名称,因此当我尝试确定我的视图是否已使用 GetView( viewname) 它总是返回 null,所以我最终向该区域添加了另一个视图。

I am learning Prism, and I have a question on the best approach for the main Shell.

Assuming the Shell has 2 regions: Toolbar, Main.
The toolbar has 3 main buttons that each represent a different On Demand Load Module.
Each of these modules currently register themselves as fitting in the Main Region.

When I click one of the buttons I want to do the following:

Notify any active view that its switching, with an option to cancel if there is a pending action still required.
This might cascade to child views.

If the action isn't cancelled then load the on demand module if it has not yet been loaded, else activate it within the region.

Should these three modules all fit in the same Region or should my shell have 3 regions defined within content presenters?

One of the areas I got stuck on was that when you register a view from the Module Initialize, it doesn't get added with a strongly typed name, so when I tried to determine if my view was already added to the region with GetView(viewname) it always returns null, so I end up adding another view to the region.

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

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

发布评论

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

评论(1

爱她像谁 2024-09-02 07:28:48

将所有视图注册在同一区域(例如“MenuRegion”)是一个好方法。至于检查脏视图,您可能会发现 Brian Noyes 的这篇博客文章很有用:

我希望这会有所帮助。

谢谢,
达米安

Having all views register in the same region (say "MenuRegion") is a good approach. As for checking for dirty views you might find this blog post from Brian Noyes useful:

I hope this helps.

Thanks,
Damian

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