public override void DelItem(object currentNode) { DeaEntity _currentNode = currentNode as DeaEntity; string message = "确定删除[ " + _currentNode.NAME + " ]下所有COM口配置数据 ?"; string caption = "删除!"; MessageBoxButton buttons = MessageBoxButton.OKCancel; MessageBoxImage icon = MessageBoxImage.Question; if (MessageBox.Show(message, caption, buttons, icon) == MessageBoxResult.OK) { switch (_currentNode.DEPTI) { case 1: _currentNode.MAIN_EXISTS = 0; ((ProjectEntity)_currentNode.Parent).Children.Remove(this); break; default: break; } } else { return; } }
public override void AddNewItem(object currentNode) { DeaEntity _currentNode = currentNode as DeaEntity; ComEntity _childrenNode = new ComEntity(); Window_ComSet ComSetWindow; int _nodeNum; if (_currentNode.ChildrenCount < 2) { switch (_currentNode.DEPTI) { case 1: _nodeNum = _currentNode.ChildrenCount; _childrenNode.NAME = "COM" + (_nodeNum + 1); _childrenNode.PORT = _nodeNum + 1; _childrenNode.DEPTI = _currentNode.DEPTI + 1; _childrenNode.TYPE = NodeType.ComNode; _childrenNode.CURRENT_STAT = CurrentOpCType.Add; _childrenNode.AddIsEnabled = true; _childrenNode.ChgIsEnabled = true; _childrenNode.DelIsEnabled = true; _childrenNode.Parent = this; ComSetWindow = new Window_ComSet(_childrenNode); ComSetWindow.Title = _childrenNode.NAME + "【新增】详细设置"; ComSetWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen; ComSetWindow.ShowDialog(); if (ComSetWindow.IsExit) { return; } break; } Children.Add(_childrenNode); } else { MessageBox.Show("每台DEA只能设置2个COM口!", "提示"); } }
public override void AddNewItem(object currentNode) { ProjectEntity _currentNode = currentNode as ProjectEntity; DeaEntity _childrenNode = new DeaEntity(); int _nodeNum; switch (_currentNode.DEPTI) { case 0: _nodeNum = _currentNode.ChildrenCount; _childrenNode.NAME = (_nodeNum + 1) + "号DEA"; _childrenNode.DEPTI = _currentNode.DEPTI + 1; _childrenNode.TYPE = NodeType.DeaNode; _childrenNode.AddIsEnabled = true; _childrenNode.ChgIsEnabled = false; _childrenNode.DelIsEnabled = true; _childrenNode.Parent = this; break; default: break; } Children.Add(_childrenNode); }