/// <summary> /// 注册ui事件 /// </summary> private void RegistUIEvents() { foreach (var item in bridges) { var bridgeInfo = item; if (!string.IsNullOrEmpty(bridgeInfo.inNode) && !string.IsNullOrEmpty(bridgeInfo.outNode)) { Func <PanelBase, object, IUIHandle> action = (x, y) => { var parentPanel = x; var panelName = bridgeInfo.outNode; return(UIFacade.Instence.Open(parentPanel, panelName, y)); }; UIBindingController.RegistPanelEvent(bridgeInfo.inNode, bridgeInfo.index, action); this.onDestroy += () => { //在本组合关闭时销毁事件 UIBindingController.RemovePanelEvent(bridgeInfo.inNode, bridgeInfo.index, action); }; } } }
/// <summary> /// 注册ui事件 /// </summary> protected void RegistUIEvents() { foreach (var item in Bridges) { var bridgeInfo = item; if (!string.IsNullOrEmpty(bridgeInfo.inNode) && !string.IsNullOrEmpty(bridgeInfo.outNode)) { UIBindingItem bindingItem = new UIBindingItem(); var index = item.index; bindingItem.openAction = (x, y) => { var parentPanel = x; var panelName = bridgeInfo.outNode; UIFacade.Instence.Open(parentPanel, panelName, index, y); }; bindingItem.closeAction = () => { var panelName = bridgeInfo.outNode; UIFacade.Instence.Close(this, panelName); }; bindingItem.hideAction = () => { var panelName = bridgeInfo.outNode; UIFacade.Instence.Hide(this, panelName); }; bindingItem.isOpenAction = () => { var panelName = bridgeInfo.outNode; return(UIFacade.Instence.IsPanelOpen(this, panelName)); }; bindingCtrl.RegistPanelEvent(bridgeInfo.inNode, bridgeInfo.index, bindingItem); this.onDestroy += () => { //在本组合关闭时销毁事件 bindingCtrl.RemovePanelEvent(bridgeInfo.inNode, bridgeInfo.index, bindingItem); }; } } }