public override void ChgItem(object currentNode) { ComEntity _currentNode = currentNode as ComEntity; _currentNode.CURRENT_STAT = CurrentOpCType.Modify; Window_ComSet ComSetWindow; int _nodeNum; /// <summary> ///新增设备 /// </summary> if (_currentNode.NAME != null) { switch (_currentNode.DEPTI) { case 2: ComSetWindow = new Window_ComSet(_currentNode); ComSetWindow.Title = _currentNode.NAME + "【修改】详细设置"; ComSetWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen; ComSetWindow.ShowDialog(); break; } } else { MessageBox.Show("不能修改!", "提示"); } }
public override void DelItem(object currentNode) { ComEntity _currentNode = currentNode as ComEntity; string message = "确定删除[ " + _currentNode.NAME + " ]下所有设备配置数据 ?"; string caption = "删除!"; MessageBoxButton buttons = MessageBoxButton.OKCancel; MessageBoxImage icon = MessageBoxImage.Question; if (MessageBox.Show(message, caption, buttons, icon) == MessageBoxResult.OK) { switch (_currentNode.DEPTI) { case 0: break; case 2: ((DeaEntity)_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) { ComEntity _currentNode = currentNode as ComEntity; DeviceEntity _childrenNode = new DeviceEntity(); Window_DeviceSet DeviceSetWindow; int _nodeNum; /// <summary> ///新增设备 /// </summary> if (!_currentNode.IS_MAIN || _currentNode.ChildrenCount < 1) { switch (_currentNode.DEPTI) { case 2: _nodeNum = _currentNode.ChildrenCount; _childrenNode.NAME = (_nodeNum + 1) + "号设备"; _childrenNode.DEPTI = _currentNode.DEPTI + 1; _childrenNode.TYPE = NodeType.DeviceNode; _childrenNode.SITE_NUMBER = _nodeNum + 1; _childrenNode.PROTOCOL = _currentNode.PROTOCOL; _childrenNode.CURRENT_STAT = CurrentOpCType.Add; _childrenNode.AddIsEnabled = false; _childrenNode.ChgIsEnabled = true; _childrenNode.DelIsEnabled = true; _childrenNode.Parent = this; DeviceSetWindow = new Window_DeviceSet(_childrenNode); DeviceSetWindow.Title = _childrenNode.NAME + "详细设置"; DeviceSetWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen; DeviceSetWindow.ShowDialog(); this.COPY_NUM = DeviceSetWindow.COPY_NUM; if (DeviceSetWindow.IsExit) { return; } break; } /// <summary> ///生成设备自动复制数量 /// </summary> if (this.COPY_NUM > 0) { int a, b; string str; _nodeNum = _currentNode.ChildrenCount; str = _childrenNode.NAME.Substring(_childrenNode.NAME.IndexOf("号")); for (int i = 1; i <= this.COPY_NUM; i++) { DeviceEntity _newDeviceNode = new DeviceEntity(); _newDeviceNode.DEPTI = _childrenNode.DEPTI; _newDeviceNode.TYPE = _childrenNode.TYPE; _newDeviceNode.PROTOCOL = _childrenNode.PROTOCOL; _newDeviceNode.AddIsEnabled = false; _newDeviceNode.ChgIsEnabled = true; _newDeviceNode.DelIsEnabled = true; _newDeviceNode.Parent = this; _newDeviceNode.DEVICE_NAME_INFO = _childrenNode.DEVICE_NAME_INFO; _newDeviceNode.DEVICE_ID_INFO = _childrenNode.DEVICE_ID_INFO; _newDeviceNode.CHG_DATA_ARRY = _childrenNode.CHG_DATA_ARRY; _newDeviceNode.NAME = (_nodeNum + i) + str; _newDeviceNode.SITE_NUMBER = _nodeNum + i; Children.Add(_newDeviceNode); } } else { Children.Add(_childrenNode); } } else { MessageBox.Show("主站COM口只能设置1台设备!", "提示"); return; } this.COPY_NUM = 0; }