//private DateTime _BeginDate; //private MB.WinBase.IFace.IViewGridForm _LastSetGridForm; //private bool _LastSetState; //[System.Diagnostics.DebuggerStepThrough()] //private void timer1_Tick(object sender, EventArgs e) { // var sp = System.DateTime.Now.Subtract(_BeginDate); // int house = sp.Hours; // TimeSpan nsp = new TimeSpan(house, sp.Minutes, sp.Seconds); // barStaticItemTime.Caption = string.Format("累计在线时间: {0}", nsp.ToString()); //} //控件权限检验。 private bool chenckButtonEnable(MB.WinBase.IFace.IViewGridForm gridViewForm, DevExpress.XtraBars.BarButtonItem item) { if (_ButtonValidatedCatch.ContainsKey(gridViewForm)) { var items = _ButtonValidatedCatch[gridViewForm]; if (items.ContainsKey(item)) { return(items[item]); } else { bool v = checkExistsRejectCommand(item) && ValidatedCommandButton(item); items.Add(item, v); return(v); } } else { bool v = checkExistsRejectCommand(item) && ValidatedCommandButton(item); var keys = new Dictionary <DevExpress.XtraBars.BarButtonItem, bool>(); keys.Add(item, v); _ButtonValidatedCatch.Add(gridViewForm, keys); return(v); } }
void refreshToolsButton() { using (MB.Util.MethodTraceWithTime track = new Util.MethodTraceWithTime("XtraRibbonMdiMainForm::refreshToolsButton")) { try { if (this.ActiveMdiChild != null) { MB.WinBase.IFace.IViewGridForm gridViewForm = this.ActiveMdiChild as MB.WinBase.IFace.IViewGridForm; if (gridViewForm != null) { bool existsUnSave = gridViewForm.ExistsUnSaveData(); //if (_LastSetGridForm != null && gridViewForm.Equals(_LastSetGridForm) && _LastSetState == existsUnSave) { // //setAllButtonEnabled(false); // return; //} setAllButtonEnabled(true); //_LastSetState = existsUnSave; //_LastSetGridForm = gridViewForm; // MB.Util.TraceEx.Write("开始执行 existsUnSave..."); bButSave.Enabled = existsUnSave && chenckButtonEnable(gridViewForm, bButSave); // checkExistsRejectCommand(bButSave) && ValidatedCommandButton(bButSave); bButAddNew.Enabled = !existsUnSave && chenckButtonEnable(gridViewForm, bButAddNew); //checkExistsRejectCommand(bButAddNew) && ValidatedCommandButton(bButAddNew); bButDelete.Enabled = !existsUnSave && chenckButtonEnable(gridViewForm, bButDelete); //checkExistsRejectCommand(bButDelete) && ValidatedCommandButton(bButDelete); bButFilter.Enabled = !existsUnSave && chenckButtonEnable(gridViewForm, bButFilter); // checkExistsRejectCommand(bButFilter) && ValidatedCommandButton(bButFilter); bButAdvanceFilter.Enabled = !existsUnSave && chenckButtonEnable(gridViewForm, bButAdvanceFilter); //checkExistsRejectCommand(bButAdvanceFilter) && ValidatedCommandButton(bButAdvanceFilter); bButRefresh.Enabled = !existsUnSave && chenckButtonEnable(gridViewForm, bButRefresh); //checkExistsRejectCommand(bButRefresh) && ValidatedCommandButton(bButRefresh); bButOpen.Enabled = !existsUnSave && chenckButtonEnable(gridViewForm, bButOpen); //checkExistsRejectCommand(bButOpen) && ValidatedCommandButton(bButOpen); bButImport.Enabled = !existsUnSave && chenckButtonEnable(gridViewForm, bButImport); //checkExistsRejectCommand(bButImport) && ValidatedCommandButton(bButImport); //判断动态聚组设定按钮是否需要可用 IViewDynamicGroupGridForm dynamicViewForm = gridViewForm as IViewDynamicGroupGridForm; bButDynamicGroupSetting.Enabled = (dynamicViewForm != null) && dynamicViewForm.IsDynamicGroupIsActive; // MB.Util.TraceEx.Write("结束执行 existsUnSave..."); } else { setAllButtonEnabled(false); } } else { setAllButtonEnabled(false); } } catch (Exception ex) { throw new MB.Util.APPException("自动刷新主界面功能菜单项出错" + ex.Message, Util.APPMessageType.SysErrInfo); } } }
/// <summary> /// 构造函数... /// </summary> public ucFilterCondition(MB.WinBase.IFace.IViewGridForm viewGridForm, MB.WinBase.IFace.IClientRuleQueryBase clientRule, string filterCfgName) { InitializeComponent(); _ViewGridForm = viewGridForm; _ClientRule = clientRule; if (!string.IsNullOrEmpty(filterCfgName)) { _FilterCfgName = filterCfgName; } else { _FilterCfgName = DATA_FILTER_MAIN_CFG_NAME; } this.Load += new EventHandler(ucFilterCondition_Load); _ErrorProvider = new ErrorProvider(); _ErrorProvider.ContainerControl = this; }
//打开焦点模块 protected void OpenFavoritesModuleByTreeNode(DevExpress.XtraTreeList.Nodes.TreeListNode treeNode) { try { using (MB.WinBase.WaitCursor cursor = new MB.WinBase.WaitCursor(this)) { if (treeNode.Nodes.Count > 0) { return; } ModuleTreeNodeInfo nodeInfo = GetFocusedFavoritesModuleId(treeNode); //判断是否已经打开 foreach (Form f in this.MdiChildren) { MB.WinBase.IFace.IViewGridForm iView = f as MB.WinBase.IFace.IViewGridForm; if (iView == null) { continue; } if (iView.ClientRuleObject.ModuleTreeNodeInfo.ID == nodeInfo.ID) { (iView as Form).BringToFront(); return; } } UICreateHelper.Instance.ShowViewGridForm(this, nodeInfo); } } catch (Exception ex) { MB.WinBase.ApplicationExceptionTerminate.DefaultInstance.ExceptionTerminate(ex); } }