public void EditECTowerParaNameWindowClosed(object sender, string newParaName) { ElecCalsTowerParaNameEditViewModel model = (ElecCalsTowerParaNameEditViewModel)sender; model.ElecCalsTowerParaNameEditCloseEvent -= EditECTowerParaNameWindowClosed; if (elecCalsTowerParaNameEditWindow != null) { elecCalsTowerParaNameEditWindow.Close(); } elecCalsTowerParaNameEditWindow = null; if (newParaName == null || newParaName == "") { return; } var calsMenu = SelectedModuleInfo.MenuItems.Where(item => item.Title.Trim() == "计算参数").FirstOrDefault(); if (calsMenu == null) { return; } var towerPaMenu = calsMenu.ChildItems.Where(item => item.Title.Trim() == "铁塔配置参数").FirstOrDefault(); if (towerPaMenu == null) { return; } SubMenuBase towerParaSubMenu = new SubMenuBase("", this, " " + newParaName, (e) => { OnSelectedECParaChanged(e); }); towerParaSubMenu.ParentNode = towerPaMenu; towerPaMenu.ChildItems.Add(towerParaSubMenu); OnSelectedECParaChanged(towerParaSubMenu); MenuItems = new ObservableCollection <SubMenuBase>(SelectedModuleInfo.MenuItems); }
public void ShowEidtECTowerParaNameWindow() { elecCalsTowerParaNameEditWindow = new ElecCalsTowerParaNameEditWindow(); ((ElecCalsTowerParaNameEditViewModel)(elecCalsTowerParaNameEditWindow.DataContext)).ElecCalsTowerParaNameEditCloseEvent += EditECTowerParaNameWindowClosed; elecCalsTowerParaNameEditWindow.ShowDialog(); }