Esempio n. 1
0
        private MB.Util.Model.ModuleTreeNodeInfo[] getDefaultModule()
        {
            MB.Util.Model.ModuleTreeNodeInfo mInfo  = new MB.Util.Model.ModuleTreeNodeInfo(1, "系统设置");
            MB.Util.Model.ModuleTreeNodeInfo mInfo1 = new MB.Util.Model.ModuleTreeNodeInfo(1, "商品管理");
            MB.Util.Model.ModuleTreeNodeInfo mInfo2 = new MB.Util.Model.ModuleTreeNodeInfo(1, "征订主题");
            MB.Util.Model.ModuleTreeNodeInfo mInfo3 = new MB.Util.Model.ModuleTreeNodeInfo(1, "征订主题控制");
            MB.Util.Model.ModuleTreeNodeInfo mInfo4 = new MB.Util.Model.ModuleTreeNodeInfo(1, "征订单");
            MB.Util.Model.ModuleTreeNodeInfo mInfo5 = new MB.Util.Model.ModuleTreeNodeInfo(1, "批量修改征订单");
            MB.Util.Model.ModuleTreeNodeInfo mInfo6 = new MB.Util.Model.ModuleTreeNodeInfo(1, "查询分析");
            MB.Util.Model.ModuleTreeNodeInfo mInfo7 = new MB.Util.Model.ModuleTreeNodeInfo(1, "期货合同");

            mInfo.Commands = new List <MB.Util.Model.ModuleCommandInfo>();
            mInfo.Commands.Add(new MB.Util.Model.ModuleCommandInfo("Open", "MyRuleTestUI.UITestRuleClient,MyRuleTestUI.dll", "MB.WinClientDefault.DefaultViewForm,MB.WinClientDefault.dll"));
            mInfo.Commands.Add(new MB.Util.Model.ModuleCommandInfo("AddNew", "MyRuleTestUI.UITestRuleClient,MyRuleTestUI.dll", "MyRuleTestUI.frmEditTestRule,MyRuleTestUI.dll"));
            MB.Util.Model.ModuleTreeNodeInfo[] ms = { mInfo, mInfo1, mInfo2, mInfo3, mInfo4, mInfo5, mInfo6, mInfo7 };
            return(ms);
        }
Esempio n. 2
0
        //根据当前活动的子窗口 格式化操作的菜单项
        private void refreshToolsButtonItem(MB.Util.Model.ModuleTreeNodeInfo moduleInfo)
        {
            _RejectCommandItems.Clear();
            foreach (DevExpress.XtraBars.BarButtonItem butItem in _AllCreateMenuItems.Keys)
            {
                butItem.Enabled = true;
            }
            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)
            {
                return;
            }

            //如果是分析界面的话要屏蔽掉操作功能菜单项。
            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;
                }
            }
        }
        //根据当前活动的子窗口 格式化操作的菜单项
        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;
                    }
                }
            }
        }