/// <summary> /// 构造函数... /// </summary> public FrmGetObjectDataAssistant(MB.WinBase.IFace.IClientRule clientRule) { InitializeComponent(); _ToolTip = new ToolTip(); panMain.Dock = DockStyle.Fill; _ClientRule = clientRule; lnkChecked.Visible = false; this.Load += new EventHandler(FrmGetObjectDataAssistant_Load); }
//根据当前活动的子窗口 格式化操作的菜单项 private void refreshToolsButtonItem(MB.Util.Model.ModuleTreeNodeInfo moduleInfo) { using (MB.Util.MethodTraceWithTime track = new Util.MethodTraceWithTime("XtraRibbonMdiMainForm::refreshToolsButtonItem")) { _RejectCommandItems.Clear(); foreach (DevExpress.XtraBars.BarButtonItem butItem in _AllCreateMenuItems.Keys) { butItem.Enabled = true; } //2009-21-29主要从兼容的角度来处理,以后需要去掉 (新订货会系统中有需要) if (!string.IsNullOrEmpty(moduleInfo.RejectCommands)) { string[] rejects = moduleInfo.RejectCommands.Split(','); foreach (DevExpress.XtraBars.BarButtonItem butItem in _AllCreateMenuItems.Keys) { System.ComponentModel.Design.CommandID cmdID = _AllCreateMenuItems[butItem]; UICommandType cType = (UICommandType)cmdID.ID; if (Array.IndexOf(rejects, cType.ToString()) >= 0) { butItem.Enabled = false; if (!_RejectCommandItems.ContainsKey(butItem)) { _RejectCommandItems.Add(butItem, false); } else { _RejectCommandItems[butItem] = false; } } } } MB.WinBase.IFace.IForm activeForm = this.GetActiveMdiChildForm(); if (activeForm == null || activeForm.ClientRuleObject == null) { foreach (DevExpress.XtraBars.BarButtonItem butItem in _AllCreateMenuItems.Keys) { butItem.Enabled = false; } return; } //根据业务类上的配置项来进行约束操作菜单项。 var rejectCfg = MB.WinBase.Atts.AttributeConfigHelper.Instance.GetModuleRejectCommands(activeForm.ClientRuleObject.GetType()); if (rejectCfg != null) { foreach (DevExpress.XtraBars.BarButtonItem butItem in _AllCreateMenuItems.Keys) { System.ComponentModel.Design.CommandID cmdID = _AllCreateMenuItems[butItem]; UICommandType cType = (UICommandType)cmdID.ID; if ((rejectCfg.RejectCommands & cType) != 0) { butItem.Enabled = false; if (!_RejectCommandItems.ContainsKey(butItem)) { _RejectCommandItems.Add(butItem, false); } else { _RejectCommandItems[butItem] = false; } } } } //如果是分析界面的话要屏蔽掉操作功能菜单项。 MB.WinBase.IFace.IClientRule editRule = activeForm.ClientRuleObject as MB.WinBase.IFace.IClientRule; if (editRule != null) { return; } foreach (DevExpress.XtraBars.BarButtonItem butItem in _AllCreateMenuItems.Keys) { System.ComponentModel.Design.CommandID cmdID = _AllCreateMenuItems[butItem]; var info = CommandGroups.EditCommands.FirstOrDefault(o => o.CommandID.Equals(cmdID)); if (info != null) { butItem.Enabled = false; if (!_RejectCommandItems.ContainsKey(butItem)) { _RejectCommandItems.Add(butItem, false); } else { _RejectCommandItems[butItem] = false; } continue; } if (cmdID.Equals(UICommands.DataImport)) { butItem.Enabled = false; if (!_RejectCommandItems.ContainsKey(butItem)) { _RejectCommandItems.Add(butItem, false); } else { _RejectCommandItems[butItem] = false; } continue; } } } }