Ejemplo n.º 1
0
        private void OnCmdDelete()
        {
            ObservableCollection<IElement> deleteCollection = new ObservableCollection<IElement>();
            ObservableCollection<IElement> addCollection = new ObservableCollection<IElement>();
            ObservableCollection<ConnectIconVisibilityInfo> connectIconVisibleCollection = new ObservableCollection<ConnectIconVisibilityInfo>();
            _elementMoveInfo.Clear();
            _elementSizeInfo.Clear();
            for (int i = 0; i < _selectedElementCollection.Count; i++)
            {
                Point oldPoint = new Point();
                oldPoint.X = _selectedElementCollection[i].X;
                oldPoint.Y = _selectedElementCollection[i].Y;
                _elementMoveInfo.Add(new ElementMoveInfo(_selectedElementCollection[i], new Point(), oldPoint));
            }
            for (int itemIndex = 0; itemIndex < _myScreenLayer.ElementCollection.Count; itemIndex++)
            {
                if (_myScreenLayer.ElementCollection[itemIndex].EleType != ElementType.receive)
                {
                    continue;
                }
                IRectElement element = (IRectElement)_myScreenLayer.ElementCollection[itemIndex];
                if (element.ConnectedIndex >= 0)
                {
                    ConnectIconVisibilityInfo info = new ConnectIconVisibilityInfo();
                    info.Element = element;
                    OldAndNewVisibility oldAndNewMaxmaxVisible = new OldAndNewVisibility();
                    oldAndNewMaxmaxVisible.OldValue = element.MaxConnectIndexVisibile;
                    OldAndNewVisibility oldAndNewMaxminVisible = new OldAndNewVisibility();
                    oldAndNewMaxminVisible.OldValue =element.MinConnectIndexVisibile;
                    info.OldAndNewMaxConnectIndexVisibile = oldAndNewMaxmaxVisible;
                    info.OldAndNewMinConnectIndexVisibile = oldAndNewMaxminVisible;
                    connectIconVisibleCollection.Add(info);

                }
            }
                foreach (int key in _currentSelectedElement.Keys)
                {
                    if (_currentSelectedElement[key].SelectedGroupElementList.Count != 0 && key != -1)
                    {
                        Point oldPoint = new Point();
                        oldPoint.X = _groupframeList[key].X;
                        oldPoint.Y = _groupframeList[key].Y;
                        _elementMoveInfo.Add(new ElementMoveInfo(_groupframeList[key], new Point(), oldPoint));
                        Size oldSize = new Size();
                        oldSize.Width = _groupframeList[key].Width;
                        oldSize.Height = _groupframeList[key].Height;
                        _elementSizeInfo.Add(new ElementSizeInfo(_groupframeList[key], new Size(), oldSize));
                    }
                }
            foreach(int elementIndex in _currentSelectedElement.Keys)
            {
                ObservableCollection<IRectElement> selectedGroupList = _currentSelectedElement[elementIndex].SelectedGroupElementList;
                Rect noSelectedElementRect = _currentSelectedElement[elementIndex].NoSelectedElementRect;
                for (int i = 0; i < selectedGroupList.Count; i++)
                {
                    #region 删除
                    if (selectedGroupList[i].EleType == ElementType.receive)
                    {
                        #region 处理连线
                        RectElement rect = (RectElement)selectedGroupList[i];
                        PortConnectInfo portConnectInfo = new PortConnectInfo();
                        if (rect.SenderIndex != -1 && rect.PortIndex != -1)
                        {
                            portConnectInfo = _myScreenLayer.SenderConnectInfoList[rect.SenderIndex].PortConnectInfoList[rect.PortIndex];
                        }
                        if (rect.FrontLine == null && rect.EndLine == null)
                        {
                            //更新Map值(发送卡带载的x,y的改变,会影响给发送卡下网口的映射位置)
                            //记录删除前发送卡的带载的x,y
                            Point oldSenderPoint = new Point();
                            if (rect.SenderIndex >= 0 && rect.PortIndex >= 0)
                            {
                                oldSenderPoint = new Point(_myScreenLayer.SenderConnectInfoList[rect.SenderIndex].LoadSize.X, _myScreenLayer.SenderConnectInfoList[rect.SenderIndex].LoadSize.Y);
                            }

                            portConnectInfo.ConnectLineElementList.Remove(rect);
                            portConnectInfo.MaxConnectElement = null;
                            portConnectInfo.MaxConnectIndex = -1;
                            deleteCollection.Add(rect);
                            _myScreenLayer.ElementCollection.Remove(rect);

                            if (_myScreenLayer.IsStartSetMapLocation && rect.SenderIndex>=0 && rect.PortIndex>=0)
                            {
                                //更新该发送卡的带载
                                portConnectInfo.LoadSize = Function.UnionRectCollection(portConnectInfo.ConnectLineElementList);
                                if(portConnectInfo.LoadSize.Height==0 && portConnectInfo.LoadSize.Width==0)
                                {
                                    portConnectInfo.MapLocation=new Point();
                                }
                                _myScreenLayer.SenderConnectInfoList[rect.SenderIndex].LoadSize = Function.UnionRectCollection(_myScreenLayer.SenderConnectInfoList[rect.SenderIndex].PortConnectInfoList);
                                Rect newSenderLoadSize = _myScreenLayer.SenderConnectInfoList[rect.SenderIndex].LoadSize;
                                Point newSenderPoint=new Point();
                                Point difSenderPint=new Point();
                                if(newSenderLoadSize.Width==0 && newSenderLoadSize.Height==0)
                                {
                                    //发送卡带载的xy有变化的话更新该发送卡下所有网口的Map
                                    //更新网口的map
                                    for (int j = 0; j < _myScreenLayer.SenderConnectInfoList[rect.SenderIndex].PortConnectInfoList.Count; j++)
                                    {
                                        PortConnectInfo portConnect = _myScreenLayer.SenderConnectInfoList[rect.SenderIndex].PortConnectInfoList[j];
                                        portConnect.MapLocation = new Point();
                                    }
                                }
                                else
                                {
                                    newSenderPoint = new Point(newSenderLoadSize.X, newSenderLoadSize.Y);
                                    difSenderPint = new Point(newSenderLoadSize.X - oldSenderPoint.X, newSenderLoadSize.Y - oldSenderPoint.Y);
                                    //发送卡带载的xy有变化的话更新该发送卡下所有网口的Map
                                    if (difSenderPint.Y != 0 || difSenderPint.X != 0)
                                    {
                                        //更新网口的map
                                        for (int j = 0; j < _myScreenLayer.SenderConnectInfoList[rect.SenderIndex].PortConnectInfoList.Count; j++)
                                        {
                                            PortConnectInfo portConnect = _myScreenLayer.SenderConnectInfoList[rect.SenderIndex].PortConnectInfoList[j];
                                            if (portConnect.LoadSize.Height != 0 && portConnect.LoadSize.Width != 0)
                                            {
                                                Point newmapLocation = new Point(portConnect.MapLocation.X + difSenderPint.X, portConnect.MapLocation.Y + difSenderPint.Y);
                                                portConnect.MapLocation = newmapLocation;
                                            }
                                        }
                                    }
                                }

                            }

                            continue;
                        }
                        if (rect.EndLine != null)
                        {
                            rect.EndLine.EndElement.FrontLine = null;
                            deleteCollection.Add(rect.EndLine);
                            _myScreenLayer.ElementCollection.Remove(rect.EndLine);
                            rect.EndLine = null;
                        }
                        if (rect.FrontLine != null)
                        {
                            rect.FrontLine.FrontElement.EndLine = null;
                            deleteCollection.Add(rect.FrontLine);
                            _myScreenLayer.ElementCollection.Remove(rect.FrontLine);
                            rect.FrontLine = null;
                        }
                        deleteCollection.Add(rect);

                        if (portConnectInfo.MaxConnectIndex != rect.ConnectedIndex)
                        {
                            List<IRectElement> connectList = portConnectInfo.ConnectLineElementList.ToList<IRectElement>();
                            connectList.Sort(delegate(IRectElement first, IRectElement second)
                            {
                                return first.ConnectedIndex.CompareTo(second.ConnectedIndex);
                            });
                            int currentIndex = connectList.IndexOf(rect);
                            connectList[currentIndex + 1].ConnectedIndex = connectList[currentIndex + 1].ConnectedIndex;
                            if (currentIndex == 0)
                            {
                                ((RectElement)connectList[currentIndex + 1]).MinConnectIndexVisibile = Visibility.Visible;
                                ((RectElement)connectList[currentIndex + 1]).MaxConnectIndexVisibile = Visibility.Hidden;
                            }
                            if(connectList[currentIndex+1].FrontLine!=null)
                            addCollection.Add(connectList[currentIndex + 1].FrontLine);
                        }
                        else
                        {
                            List<IRectElement> connectList = portConnectInfo.ConnectLineElementList.ToList<IRectElement>();
                            connectList.Sort(delegate(IRectElement first, IRectElement second)
                            {
                                return first.ConnectedIndex.CompareTo(second.ConnectedIndex);
                            });
                            if (connectList.Count == 1)
                            {
                                portConnectInfo.MaxConnectIndex = -1;
                                portConnectInfo.MaxConnectElement = null;
                                rect.MinConnectIndexVisibile = Visibility.Hidden;
                                rect.MaxConnectIndexVisibile = Visibility.Hidden;
                            }
                            else
                            {
                                portConnectInfo.MaxConnectIndex = connectList[connectList.Count - 2].ConnectedIndex;
                                portConnectInfo.MaxConnectElement = (RectElement)connectList[connectList.Count - 2];
                                if (connectList.Count > 2)
                                {
                                    ((RectElement)connectList[connectList.Count - 2]).MaxConnectIndexVisibile = Visibility.Visible;
                                }
                            }
                        }
                        //更新Map值(发送卡带载的x,y的改变,会影响给发送卡下网口的映射位置)
                        //记录删除前发送卡的带载的x,y
                        Point oldSenderPoints = new Point(_myScreenLayer.SenderConnectInfoList[rect.SenderIndex].LoadSize.X, _myScreenLayer.SenderConnectInfoList[rect.SenderIndex].LoadSize.Y);
                        portConnectInfo.ConnectLineElementList.Remove(rect);
                        _myScreenLayer.ElementCollection.Remove(rect);
                        if (_myScreenLayer.IsStartSetMapLocation)
                        {
                            //更新该发送卡的带载
                            portConnectInfo.LoadSize = Function.UnionRectCollection(portConnectInfo.ConnectLineElementList);
                            if (portConnectInfo.LoadSize.Height == 0 && portConnectInfo.LoadSize.Width == 0)
                            {
                                portConnectInfo.MapLocation = new Point();
                            }
                            _myScreenLayer.SenderConnectInfoList[rect.SenderIndex].LoadSize = Function.UnionRectCollection(_myScreenLayer.SenderConnectInfoList[rect.SenderIndex].PortConnectInfoList);
                            Rect newSenderLoadSizes = _myScreenLayer.SenderConnectInfoList[rect.SenderIndex].LoadSize;
                            Point newSenderPoints = new Point();
                            Point difSenderPints = new Point();
                            if (newSenderLoadSizes.Height == 0 && newSenderLoadSizes.Width == 0)
                            {
                                //发送卡带载的xy有变化的话更新该发送卡下所有网口的Map
                                //更新网口的map
                                for (int j = 0; j < _myScreenLayer.SenderConnectInfoList[rect.SenderIndex].PortConnectInfoList.Count; j++)
                                {
                                    PortConnectInfo portConnect = _myScreenLayer.SenderConnectInfoList[rect.SenderIndex].PortConnectInfoList[j];
                                    portConnect.MapLocation = new Point();
                                }
                            }
                            else
                            {
                                newSenderPoints = new Point(newSenderLoadSizes.X, newSenderLoadSizes.Y);
                                difSenderPints = new Point(newSenderPoints.X - oldSenderPoints.X, newSenderPoints.Y - oldSenderPoints.Y);
                                //发送卡带载的xy有变化的话更新该发送卡下所有网口的Map
                                if (difSenderPints.Y != 0 || difSenderPints.X != 0)
                                {
                                    //更新网口的map
                                    for (int j = 0; j < _myScreenLayer.SenderConnectInfoList[rect.SenderIndex].PortConnectInfoList.Count; j++)
                                    {
                                        PortConnectInfo portConnect = _myScreenLayer.SenderConnectInfoList[rect.SenderIndex].PortConnectInfoList[j];
                                        if (portConnect.LoadSize.Height != 0 && portConnect.LoadSize.Width != 0)
                                        {
                                            Point newmapLocation = new Point(portConnect.MapLocation.X + difSenderPints.X, portConnect.MapLocation.Y + difSenderPints.Y);
                                            portConnect.MapLocation = newmapLocation;
                                        }
                                    }
                                }
                            }

                        }
                        #endregion
                    }
                    #endregion
                }

                for (int itemIndex = 0; itemIndex < connectIconVisibleCollection.Count; itemIndex++)
                {
                    ConnectIconVisibilityInfo info=connectIconVisibleCollection[itemIndex];
                    if (_myScreenLayer.ElementCollection.Contains(info.Element))
                    {
                        info.OldAndNewMaxConnectIndexVisibile.NewValue = info.Element.MaxConnectIndexVisibile;
                        info.OldAndNewMinConnectIndexVisibile.NewValue = info.Element.MinConnectIndexVisibile;
                    }
                    else
                    {
                        info.OldAndNewMaxConnectIndexVisibile.NewValue = Visibility.Hidden;
                        info.OldAndNewMinConnectIndexVisibile.NewValue = Visibility.Hidden;
                    }
                }
                    //组框大小和位置=该组内没有选中的接收卡大矩形
                    if (elementIndex != -1)
                    {
                        if (noSelectedElementRect.Width == 0 && noSelectedElementRect.Height == 0)
                        {
                            deleteCollection.Add(_groupframeList[elementIndex]);
                            _myScreenLayer.ElementCollection.Remove(_groupframeList[elementIndex]);
                            _groupframeList.Remove(elementIndex);
                        }
                        else
                        {
                            _groupframeList[elementIndex].X = noSelectedElementRect.X;
                            _groupframeList[elementIndex].Y = noSelectedElementRect.Y;
                            _groupframeList[elementIndex].Width = noSelectedElementRect.Width;
                            _groupframeList[elementIndex].Height = noSelectedElementRect.Height;
                        }
                    }
                    else
                    {
                        if (noSelectedElementRect.Width == 0 && noSelectedElementRect.Height == 0)
                        {
                            _groupframeList.Remove(elementIndex);
                        }
                    }
            }
            AddAction addAction = new AddAction(_myScreenLayer, addCollection);
            DeleteAction deleteAction = new DeleteAction(_myScreenLayer, deleteCollection);
            for(int m=0;m<addCollection.Count;m++)
            {
                if (m < 0)
                {
                    m = 0;
                }
                if(addCollection[m] is LineElement)
                {
                    LineElement addLine=(LineElement)addCollection[m];
                    for (int n = 0; n < deleteCollection.Count; n++)
                    {
                        if(deleteCollection[n] is LineElement)
                        {
                            LineElement deleteLine=(LineElement)deleteCollection[n];
                             if(addLine.FrontElement.SenderIndex==deleteLine.FrontElement.SenderIndex
                                 && addLine.FrontElement.PortIndex==deleteLine.FrontElement.PortIndex
                                 && addLine.FrontElement.ConnectedIndex==deleteLine.FrontElement.ConnectedIndex
                                 && addLine.EndElement.ConnectedIndex == deleteLine.EndElement.ConnectedIndex)
                             {
                                 addCollection.Remove(addLine);
                                 m = m - 1;
                                 deleteCollection.Remove(deleteLine);
                                 n = n - 1;

                             }
                        }

                    }
                }
            }
            ObservableCollection<ElementMoveInfo> elementMoveInfo = new ObservableCollection<ElementMoveInfo>();
            for (int i = 0; i < _elementMoveInfo.Count; i++)
            {
                Point newPoint = new Point();
                newPoint.X = _elementMoveInfo[i].Element.X;
                newPoint.Y = _elementMoveInfo[i].Element.Y;
                elementMoveInfo.Add(new ElementMoveInfo(_elementMoveInfo[i].Element, newPoint, _elementMoveInfo[i].OldPoint));
            }
            ElementMoveAction moveAction = new ElementMoveAction(elementMoveInfo);
            ObservableCollection<ElementSizeInfo> elementSizeInfo = new ObservableCollection<ElementSizeInfo>();
            for (int j = 0; j < _elementSizeInfo.Count; j++)
            {
                Size newSize = new Size();
                newSize.Width = _elementSizeInfo[j].Element.Width;
                newSize.Height = _elementSizeInfo[j].Element.Height;
                elementSizeInfo.Add(new ElementSizeInfo(_elementSizeInfo[j].Element, newSize, _elementSizeInfo[j].OldSize));
            }
            ElementSizeAction sizeAction = new ElementSizeAction(elementSizeInfo);
            ConnectIconVisibilityAction connectIconAction = new ConnectIconVisibilityAction(connectIconVisibleCollection);
            using (Transaction.Create(SmartLCTActionManager))
            {
                SmartLCTActionManager.RecordAction(moveAction);
                SmartLCTActionManager.RecordAction(sizeAction);
                SmartLCTActionManager.RecordAction(deleteAction);
                SmartLCTActionManager.RecordAction(addAction);
                SmartLCTActionManager.RecordAction(connectIconAction);
            }
            GetCurrentElementInfo();
            SelectedLayerAndElementChanged();
        }
Ejemplo n.º 2
0
 private void OnCmdCancelGroup()
 {
     ObservableCollection<IElement> deleteCollection = new ObservableCollection<IElement>();
     ObservableCollection<GroupInfo> groupInfoCollection = new ObservableCollection<GroupInfo>();
     foreach (int key in _currentSelectedElement.Keys)
     {
         if (_currentSelectedElement[key].SelectedGroupElementList.Count == 0)
         {
             continue;
         }
         for (int i = 0; i < _currentSelectedElement[key].SelectedGroupElementList.Count; i++)
         {
             IRectElement rect = _currentSelectedElement[key].SelectedGroupElementList[i];
             GroupInfo groupInfo = new GroupInfo(rect,new OldAndNewType(rect.GroupName,-1));
             groupInfoCollection.Add(groupInfo);
             rect.GroupName = -1;
         }
         deleteCollection.Add(_groupframeList[key]);
         _myScreenLayer.ElementCollection.Remove(_groupframeList[key]);
         _groupframeList.Remove(key);
     }
     if(!_groupframeList.Keys.Contains(-1))
     _groupframeList.Add(-1, null);
     GetCurrentElementInfo();
     DeleteAction deleteAction = new DeleteAction(_myScreenLayer,deleteCollection);
     CreatOrCancelGroupAction groupAction = new CreatOrCancelGroupAction(groupInfoCollection);
     using (Transaction.Create(SmartLCTActionManager))
     {
         SmartLCTActionManager.RecordAction(deleteAction);
         SmartLCTActionManager.RecordAction(groupAction);
     }
 }
Ejemplo n.º 3
0
        private void OnCmdClear()
        {
            ObservableCollection<IElement> deleteCollection = new ObservableCollection<IElement>();
            ObservableCollection<ConnectIconVisibilityInfo> connectIconVisibleCollection = new ObservableCollection<ConnectIconVisibilityInfo>();
            for (int i = 0; i < _myScreenLayer.ElementCollection.Count; i++)
            {
                IElement element = _myScreenLayer.ElementCollection[i];
                deleteCollection.Add(element);
                if(element.EleType==ElementType.receive && element.ConnectedIndex>=0)
                {
                    ConnectIconVisibilityInfo info = new ConnectIconVisibilityInfo();
                    info.Element = (IRectElement)element;
                    OldAndNewVisibility maxVisible = new OldAndNewVisibility();
                    maxVisible.OldValue = info.Element.MaxConnectIndexVisibile;
                    maxVisible.NewValue = Visibility.Hidden;
                    OldAndNewVisibility minVisible = new OldAndNewVisibility();
                    minVisible.OldValue = info.Element.MinConnectIndexVisibile;
                    minVisible.NewValue = Visibility.Hidden;
                    info.OldAndNewMaxConnectIndexVisibile = maxVisible;
                    info.OldAndNewMinConnectIndexVisibile = minVisible;
                    connectIconVisibleCollection.Add(info);
                }
            }
            _myScreenLayer.ElementCollection.Clear();
            UpdateSenderAndPortConnectInfo();
            UpdateGroupframeList();
            UpdateLoadAreaInfo();
            //GetCurrentElementInfo();

            DeleteAction deleteAction = new DeleteAction(_myScreenLayer, deleteCollection);
            ConnectIconVisibilityAction connectVisibleAction = new ConnectIconVisibilityAction(connectIconVisibleCollection);
            using (Transaction.Create(SmartLCTActionManager))
            {
                SmartLCTActionManager.RecordAction(deleteAction);
                SmartLCTActionManager.RecordAction(connectVisibleAction);
            }

            SelectedLayerAndElementValue.SelectedInfoList = null;
            SelectedLayerAndElementValue.SelectedLayer = _myScreenLayer;
            SelectedLayerAndElementValue.CurrentRectElement = null;
            SelectedLayerAndElementValue.GroupframeList = _groupframeList;
            SelectedLayerAndElementValue.SelectedInfoList = _currentSelectedElement;
            SelectedLayerAndElementValue.SelectedElement.Clear();
            SelectedLayerAndElementValue.MainControlSize = new Size(this.ActualWidth, this.ActualHeight);
            Messenger.Default.Send<SelectedLayerAndElement>(SelectedLayerAndElementValue, MsgToken.MSG_SELECTEDLAYERANDELEMENT_CHANGED);
        }
Ejemplo n.º 4
0
        private void OnClearLine()
        {
            ObservableCollection<PortInfo> selectedPortCollection = new ObservableCollection<PortInfo>();
            for (int i = 0; i < _selectedElementCollection.Count; i++)
            {
                if (_selectedElementCollection[i].SenderIndex < 0 && _selectedElementCollection[i].PortIndex < 0)
                {
                    continue;
                }
                PortInfo portInfo = new PortInfo(_selectedElementCollection[i].SenderIndex, _selectedElementCollection[i].PortIndex);
                if (!selectedPortCollection.Contains(portInfo))
                {
                    selectedPortCollection.Add(portInfo);
                }
            }

            ObservableCollection<IElement> deleteCollection = new ObservableCollection<IElement>();
            ObservableCollection<AddLineInfo> addLineCollection = new ObservableCollection<AddLineInfo>();
            ObservableCollection<ConnectIconVisibilityInfo> connectIconVisibleCollection = new ObservableCollection<ConnectIconVisibilityInfo>();
            for (int itemIndex = 0; itemIndex < _myScreenLayer.ElementCollection.Count; itemIndex++)
            {
                if (_myScreenLayer.ElementCollection[itemIndex].EleType != ElementType.receive)
                {
                    continue;
                }
                IRectElement element = (IRectElement)_myScreenLayer.ElementCollection[itemIndex];
                if (element.ConnectedIndex >= 0)
                {
                    bool isExist = false;
                    for (int i = 0; i < selectedPortCollection.Count; i++)
                    {
                        if (selectedPortCollection[i].SenderIndex == element.SenderIndex && selectedPortCollection[i].PortIndex == element.PortIndex)
                        {
                            isExist = true;
                            break;
                        }
                    }
                    if (!isExist)
                    {
                        continue;
                    }
                    ConnectIconVisibilityInfo info = new ConnectIconVisibilityInfo();
                    info.Element = element;
                    OldAndNewVisibility oldAndNewMaxmaxVisible = new OldAndNewVisibility();
                    oldAndNewMaxmaxVisible.OldValue = element.MaxConnectIndexVisibile;
                    oldAndNewMaxmaxVisible.NewValue = Visibility.Hidden;
                    OldAndNewVisibility oldAndNewMaxminVisible = new OldAndNewVisibility();
                    oldAndNewMaxminVisible.OldValue = element.MinConnectIndexVisibile;
                    oldAndNewMaxminVisible.NewValue = Visibility.Hidden;
                    info.OldAndNewMaxConnectIndexVisibile = oldAndNewMaxmaxVisible;
                    info.OldAndNewMinConnectIndexVisibile = oldAndNewMaxminVisible;
                    connectIconVisibleCollection.Add(info);

                }
            }
            for (int i = 0; i < selectedPortCollection.Count; i++)
            {
                int senderIndex = selectedPortCollection[i].SenderIndex;
                int portIndex = selectedPortCollection[i].PortIndex;

                PortConnectInfo portConnectInfo = _myScreenLayer.SenderConnectInfoList[senderIndex].PortConnectInfoList[portIndex];
                if (portConnectInfo.ConnectLineElementList != null && portConnectInfo.ConnectLineElementList.Count > 0)
                {
                    for (int m = 0; m < portConnectInfo.ConnectLineElementList.Count; m++)
                    {
                        AddLineInfo addLineInfo = new AddLineInfo();
                        addLineInfo.Element = portConnectInfo.ConnectLineElementList[m];
                        OldAndNewType oldAndNewConnect=new OldAndNewType();
                        oldAndNewConnect.OldValue=portConnectInfo.ConnectLineElementList[m].ConnectedIndex;
                        oldAndNewConnect.NewValue=-1;
                        addLineInfo.OldAndNewConnectIndex = oldAndNewConnect;
                        OldAndNewType oldAndNewSender = new OldAndNewType();
                        oldAndNewSender.OldValue = portConnectInfo.ConnectLineElementList[m].SenderIndex;
                        oldAndNewSender.NewValue = -1;
                        addLineInfo.OldAndNewSenderIndex = oldAndNewSender;
                        OldAndNewType oldAndNewPort = new OldAndNewType();
                        oldAndNewPort.OldValue = portConnectInfo.ConnectLineElementList[m].PortIndex;
                        oldAndNewPort.NewValue = -1;
                        addLineInfo.OldAndNewPortIndex = oldAndNewPort;
                        addLineCollection.Add(addLineInfo);
                        if (portConnectInfo.ConnectLineElementList[m].FrontLine != null)
                        {
                            deleteCollection.Add(portConnectInfo.ConnectLineElementList[m].FrontLine);
                            _myScreenLayer.ElementCollection.Remove(portConnectInfo.ConnectLineElementList[m].FrontLine);
                        }
                        if (portConnectInfo.ConnectLineElementList[m].EndLine != null)
                        {
                            deleteCollection.Add(portConnectInfo.ConnectLineElementList[m].EndLine);
                            _myScreenLayer.ElementCollection.Remove(portConnectInfo.ConnectLineElementList[m].EndLine);
                        }
                        portConnectInfo.ConnectLineElementList[m].ConnectedIndex = -1;
                        portConnectInfo.ConnectLineElementList[m].SenderIndex = -1;
                        portConnectInfo.ConnectLineElementList[m].PortIndex = -1;
                    }
                    portConnectInfo.ConnectLineElementList.Clear();
                }
                portConnectInfo.MaxConnectElement = null;
                portConnectInfo.MaxConnectIndex = -1;
            }
            #region 更新带载区域信息
            UpdateLoadAreaInfo();
            #endregion
            DeleteAction deleteAction = new DeleteAction(_myScreenLayer,deleteCollection);
            AddLineAction addLineAction = new AddLineAction(addLineCollection);
            ConnectIconVisibilityAction connectVisibleAction = new ConnectIconVisibilityAction(connectIconVisibleCollection);
            using (Transaction.Create(SmartLCTActionManager))
            {
                SmartLCTActionManager.RecordAction(addLineAction);
                SmartLCTActionManager.RecordAction(deleteAction);
                SmartLCTActionManager.RecordAction(connectVisibleAction);
            }
            SelectedLayerAndElementChanged();
        }