MVC是否定义一个控制器如何与另一个控制器进行通信? [英] Does MVC define how one controller should communicate with another?
问题描述
MVC一般定义了控制器应该如何与控制器通信?控制器可以是层次结构中更高的控制器的模型吗?
示例
假设我有一个窗口(由控制器/模型/视图表示),该窗口有能力启动另一个子窗口。子窗口是模态的,并且将接受某些输入。输入将影响主窗口中的某些进程。
否。你不能用MVC这样做。您要使用以下两种之一的某种分层模式:
I am referring to the general MVC design pattern (as defined in Wikipedia). When doing a GUI-intensive application, I would generally have many controllers, and sometimes a controller could send an event to another controller.
Does MVC in general defines how controller should communicate with controller? Could a controller be the model for a controller higher up in the hierarchy?
Example Suppose I have a window (which is represented by a controller/model/view), and that window is capable of launching another sub-window. The sub-window is modal, and will accept certain input. The input will affect certain processes in the main window.
No. You can not do that with MVC. You want to use some kind of hierarchical pattern like one of the following two:
这篇关于MVC是否定义一个控制器如何与另一个控制器进行通信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!