private void DoActions(EventActionReleation ea, object sender) { try { base.DoBindActions(ea, sender); } catch (Exception ex) { MsgBox.ShowException(ex, this); } }
private bool DoClick(object sender) { if (_designEvents.ContainsKey(ButEventDefine.Click) == false) { return(false); } EventActionReleation ea = _designEvents[ButEventDefine.Click]; return(DoActions(ea, sender)); }
private void DoInterval() { if (_designEvents.ContainsKey(TimerEventDefine.Interval) == false) { return; } EventActionReleation ea = _designEvents[TimerEventDefine.Interval]; DoActions(ea, timer1); }
private bool DoActions(EventActionReleation ea, object sender) { try { return(base.DoBindActions(ea, sender)); } catch (Exception ex) { MsgBox.ShowException(ex, this); return(false); } }
private void gridView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { string strApplyID; if (gridView.GetSelectedRows().Length == 0) { return; } try { int intSelRow = gridView.GetSelectedRows()[0]; if (intSelRow < 0) { return; } DevExpress.XtraGrid.Columns.GridColumn gc = new DevExpress.XtraGrid.Columns.GridColumn(); _dicApplyID.Clear(); if (gridView.GetRowCellValue(intSelRow, "申请ID") is null) { _dicApplyID.Add("医嘱ID", gridView.GetRowCellValue(intSelRow, "医嘱ID").ToString()); } else { _dicApplyID.Add("申请ID", gridView.GetRowCellValue(intSelRow, "申请ID").ToString()); } //触发内部事件 if (UserControlFocusedRowChanged != null) { KeyValuePair <string, string> kvp = _dicApplyID.FirstOrDefault(); UserControlFocusedRowChanged(kvp.Value); } //没有对应的自定义事件配置 if (_designEvents.ContainsKey(ViewTableProviderEventDefine.Event_AfterChangeRow) == false) { return; } EventActionReleation ea = _designEvents[ViewTableProviderEventDefine.Event_AfterChangeRow]; DoActions(_designEvents[ViewTableProviderEventDefine.Event_AfterChangeRow], sender); } catch (Exception ex) { MsgBox.ShowException(ex, this); } }
private void DoUserToolEvent_StripItem(object sender, EventArgs e) { ToolStripItem tsi = (sender as ToolStripItem); if (tsi == null) { return; } //没有对应的事件配置 if (_designEvents.ContainsKey(tsi.Text) == false) { return; } EventActionReleation ea = _designEvents[tsi.Text]; DoActions(ea, sender); }
//protected override void BindEvents() //{ // //if (_designEvents.Count <= 0) return; // //foreach(EventAction ea in _designEvents.Values) // //{ // // if (ea.Actions.Count <= 0) continue; // // //绑定执行事件 // // switch(ea.ActType) // // { // // case ActionType.atSysFixedEvent: // // break; // // case ActionType.atUserToolEvent: // // break; // // //case ActionType.atSysToolEvent://该类型不需要绑定 // // // break; // // default: // // break; // // } // //} //} private void DoUserToolEvent_NavElement(object sender, NavElementEventArgs e) { NavElement ne = (sender as NavElement); if (ne == null) { return; } //没有对应的事件配置 if (_designEvents.ContainsKey(ne.Caption) == false) { return; } EventActionReleation ea = _designEvents[ne.Caption]; DoActions(ea, sender); }
/// <summary> /// 执行绑定事件 /// </summary> /// <param name="ea"></param> /// <returns></returns> protected bool DoBindActions(EventActionReleation ea, object sender, object eventArgs = null) { if (_regBizModules.Count <= 0) { return(true); } string moduleName = ""; string methodName = ""; foreach (KeyValuePair <string, ActionItem> act in ea.Actions) { moduleName = act.Key.Split('.')[0]; methodName = act.Key.Split('.')[1]; ISysDesign exeModule = null; if (act.Value.IsParentModule) { if (_regBizModules.ParentWindowBizModules == null) { exeModule = null; } else { if (_regBizModules.ParentWindowBizModules.ContainsKey(moduleName)) { exeModule = _regBizModules.ParentWindowBizModules[moduleName]; } } } else { if (_regBizModules.ContainsKey(moduleName)) { exeModule = _regBizModules[moduleName]; } } if (exeModule == null) { if (MessageBox.Show("[" + moduleName + "] 未能加载,不能执行该模块方法, 是否继续?", "提示", MessageBoxButtons.YesNo) == DialogResult.No) { return(false); } } ActionItem ai = act.Value; IBizDataItems bizDatas = null; if (string.IsNullOrEmpty(ai.RequestDataName) == false) { bizDatas = GetDataItem(_moduleName, ai, ai.RequestDataName); if (bizDatas == null) { return(false); } bizDatas.DataName = ai.RequestDataName; } if (bizDatas != null) { foreach (string requestDataName in ai.RequestAttachDataNames) { IBizDataItems curRequestData = GetDataItem(_moduleName, ai, requestDataName); bizDatas.AttachDatas.Add(curRequestData); } } if (exeModule.ExecuteAction(_moduleName, this, sender, act.Value.ActName, act.Value.ActTag, bizDatas) == false) { return(false); } } return(true); }
private void timer1_Tick(object sender, EventArgs e) { try { DoInterval(); bool isDo = false; if (WakeTime(_timerDesign.Timing1, _timerConfig.LastTime1)) { if (_designEvents.ContainsKey(TimerEventDefine.Time1)) { EventActionReleation ea = _designEvents[TimerEventDefine.Time1]; DoActions(ea, timer1); _timerConfig.LastTime1 = DateTime.Now; isDo = true; } } if (WakeTime(_timerDesign.Timing2, _timerConfig.LastTime2)) { if (_designEvents.ContainsKey(TimerEventDefine.Time2)) { EventActionReleation ea = _designEvents[TimerEventDefine.Time2]; DoActions(ea, timer1); _timerConfig.LastTime2 = DateTime.Now; isDo = true; } } if (WakeTime(_timerDesign.Timing3, _timerConfig.LastTime3)) { if (_designEvents.ContainsKey(TimerEventDefine.Time3)) { EventActionReleation ea = _designEvents[TimerEventDefine.Time3]; DoActions(ea, timer1); _timerConfig.LastTime3 = DateTime.Now; isDo = true; } } if (WakeTime(_timerDesign.Timing4, _timerConfig.LastTime4)) { if (_designEvents.ContainsKey(TimerEventDefine.Time4)) { EventActionReleation ea = _designEvents[TimerEventDefine.Time4]; DoActions(ea, timer1); _timerConfig.LastTime4 = DateTime.Now; isDo = true; } } if (WakeTime(_timerDesign.Timing5, _timerConfig.LastTime5)) { if (_designEvents.ContainsKey(TimerEventDefine.Time5)) { EventActionReleation ea = _designEvents[TimerEventDefine.Time5]; DoActions(ea, timer1); _timerConfig.LastTime5 = DateTime.Now; isDo = true; } } if (isDo) { TimerConfig.SetConfig(_timerConfig, _moduleName); } } catch { } }