/// <summary> /// 这里需要基类调用才生效 /// </summary> public void RegisterMediator(string[] monitorNotify, string mediatorName) { listenceNotify = monitorNotify;//监听的消息分类 MediatorName = mediatorName; instance = FacadeFactory.GetInstance(); //注解 view BaseMediator bm = new BaseMediator(mediatorName, this, monitorNotify); instance.RegisterMediator(bm); //注解 controller // instance.RegisterCommand(MediatorName, () => new RegisterCommand()); //注解model }
public BasePureMVCMediator() { try { if (DesignMode) { return; } mediatorName = GetType().Name; component = this; if (Instance == null) { Instance = FacadeFactory.GetInstance(); } Instance.RegisterMediator(this); } catch (Exception ex) { } }
void Button_Click(object sender, EventArgs e) { Button b = (sender as Button); string formName = b.Name; Form frm = FacadeFactory.GetInstance().RetrieveMediator(formName) as Form; if (!frm.IsHandleCreated) { //判断窗体是否已经加载 if (!frm.IsDisposed) //如果没有被销毁【窗体为进行关闭】 { frm.Show(); } else { } } string tip = this.GetType().Name + " call " + frm.GetType().Name; // FormFacade fc = new FormFacade(formName, this); // OutSideCall.SendNotify(typeof(LoginFrm).Name, tip); }