1.在application 里面注册 mainFacade:MainControl,mainFacade里注册一些命令(command)。
1.5 mainFacade.startUp(this); 用来做什么?
分两类一类是proxy,还有一个主mediator
this.facade.registerProxy(new LoginProxy());
this.facade.registerProxy(new RoleProxy());
this.facade.registerProxy(new LogoutProxy());
this.facade.registerMediator(new SoftPosMediator(notification.getBody() as TcSoftPosOnline));
因为以后其他的madiator就由这个主mediator注册了。
mediator用来做逻辑,原则上,一个页面的所有逻辑都应该对应的一个mediator里。
proxy就是来做一些物理的,比如新建一个httpservice,并设置服务器端对应的路径,端口,参数包装等。
command做包装,command可能指挥对应的proxy去做发远端请求,和监听返回并做处理的事情。
2.application中可以使用mainFacade来做逻辑,如mainFacade.sendNotifacation(command)。
3.1监听这个命令的Mediator,执行命令。
3.2这边继续做其他逻辑。
mainFacade.sendNotification(PropertyCollect.VIEWTO_LOGIN);