コード例 #1
0
        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("不能修改!", "提示");
            }
        }
コード例 #2
0
ファイル: DeaEntity.cs プロジェクト: wangchunxiong/DEA_2.0
        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口!", "提示");
            }
        }