コード例 #1
0
        /// <summary>
        /// 点击杆塔序列按钮时的操作
        /// </summary>
        /// <param name="mv"></param>
        private void OnTowerSequenceModuleSeleced(ModuleMenu mv)
        {
            NewTowerSequenceTowerBtnVisibity = Visibility.Visible;
            NewStruCalsTowerBtnVisibity      = Visibility.Collapsed;

            //以前没有加载过子菜单,从配置文件中读出所有塔位名称
            if (mv.MenuItems == null || mv.MenuItems.Count() == 0)
            {
                var menuItems = new List <SubMenuBase>()
                {
                };

                var menuList = projectUtils.GetAllTowerSequenceNames();

                foreach (var name in menuList)
                {
                    SubMenuBase menu = new SubMenuBase("TowerSequenceModule", this, name, (e) => { OnSelectedTowerSequenceChanged(e); });
                    menu.SetIcon("Menu_weather.png");
                    menuItems.Add(menu);
                }

                mv.MenuItems = menuItems;
            }

            MenuItems = new ObservableCollection <SubMenuBase>(SelectedModuleInfo.MenuItems);
        }
コード例 #2
0
        //更新子模块,返回true; 不更新子模块,返回false
        protected bool UpdateSubModule(SubMenuBase subVm)
        {
            if (curSubModule == subVm.Title)
            {
                return(false);
            }
            else
            {
                subVm.Show();
                curSubModule = subVm.Title;

                return(true);
            }
        }
コード例 #3
0
        public void AddTowerSequenceWindowClosed(object sender, string newSequenceName)
        {
            AddTowerSequenceViewModel model = (AddTowerSequenceViewModel)sender;

            model.CloseWindowEvent -= AddTowerSequenceWindowClosed;
            if (addTowerSequenceWindow != null)
            {
                addTowerSequenceWindow.Close();
            }
            addTowerSequenceWindow = null;

            if (newSequenceName == null || newSequenceName == "")
            {
                return;
            }

            SubMenuBase newSequenceMenu = new SubMenuBase("TowerSequenceModule", this, newSequenceName, (e) => { OnSelectedTowerSequenceChanged(e); });

            newSequenceMenu.SetIcon("Menu_weather.png");

            SelectedModuleInfo.MenuItems.Add(newSequenceMenu);
            MenuItems = new ObservableCollection <SubMenuBase>(SelectedModuleInfo.MenuItems);

            //电气计算同步增加菜单
            var subMenu = new SubMenuBase("ElectricalCheckingParModule", this, "    " + newSequenceName, (e) => { OnSelectedBaseDataSubModuleChanged(e); });

            subMenu.ParentNode = ElectricalCalsMenu.MenuItems[0];
            var subList = new List <SubMenuBase>()
            {
            };

            var subMenu1 = new SubMenuBase("", this, "        悬垂塔", (e) => { OnSelectedSubModuleItemChanged(e); });

            subMenu1.ParentNode = subMenu;
            subList.Add(subMenu1);

            var subMenu2 = new SubMenuBase("", this, "        耐张塔", (e) => { OnSelectedSubModuleItemChanged(e); });

            subMenu2.ParentNode = subMenu;
            subList.Add(subMenu2);

            subMenu.ChildItems = subList;
            ElectricalCalsMenu.MenuItems[0].ChildItems.Add(subMenu);
        }