[英]Which design pattern to manage windows?
I am using .NET 2.0 & C# to develop a WinForm Mdi application. 我正在使用.NET 2.0和C#开发WinForm Mdi应用程序。 It will have a Main Window and a lot of mdi windows. 它将有一个主窗口和许多mdi窗口。 I am thinking I should use which design pattern to manage mdi windows. 我在想应该使用哪种设计模式来管理MDI窗口。 Because I want only one instance for each window, if window is existed, I will show it on top, & otherwise I will create and show it. 因为每个窗口只需要一个实例,所以如果存在窗口,则将其显示在顶部,否则将创建并显示它。
Note: a mdi window is opened from Menus of Main Window or open from another mdi window. 注意:从主窗口的菜单中打开一个mdi窗口,或从另一个mdi窗口中打开。 An example is very good. 一个例子是非常好的。
Update: Menu's status is depended on mdi window's status. 更新:菜单的状态取决于mdi窗口的状态。 Ex: If Window 'A' is openned -> menu 'A' -> disabled. 例如:如果打开窗口“ A”->菜单“ A”->禁用。 When window 'A' is closed -> I update menu 'A' status to Enabled. 当窗口“ A”关闭时->我将菜单“ A”状态更新为“启用”。
Thanks. 谢谢。
I would suggest a good perusal of Martin Fowler's page on GUI Patterns. 我建议您仔细阅读Martin Fowler关于GUI模式的页面。
You won't find a quick example, but then again the problem set doesn't warrant a quick solution. 您不会找到快速的示例,但是问题集并不能保证快速的解决方案。 You need to spend some time understanding the different UI design patterns available and make an informed decision about which one will work best in your application. 您需要花费一些时间来了解可用的不同UI设计模式,并做出明智的决定,以确定哪种模式最适合您的应用程序。
Martin Fowler's site will give you enough information to begin your journey at least. Martin Fowler的网站将为您提供足够的信息,至少可以开始您的旅程。 You can dive perhaps a little deeper by looking over Jeremy Miller's series to get specific .Net examples. 通过查看Jeremy Miller的系列文章以获得特定的.Net示例,您可以深入研究。
Again, there won't be a quick fix around either of those corners, but it will be worth it to learn from industry leaders. 同样,在这两个方面都不会很快解决,但值得向行业领导者学习。
I dont think you will find one pattern to solve the problem, but will be a collaboration of pattern. 我认为您不会找到一种解决问题的模式,但是会成为一种模式的协作。 The links provided by Josh are interesting read. Josh提供的链接很有趣。
A simple suggestion based on GoF pattern will be as below: 基于GoF模式的简单建议如下:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.