private void CreateGrip(int num,double height,double width)
        {
            // Scaling grip
            SmartLCTControl sControl = new SmartLCTControl();
          //  double h=hei
            RectLayer myRectLayer3 = new RectLayer(0, 0, 100, 100, null, 0, ElementType.baselayer, 0);
            RectLayer Layer3_sender1 = new RectLayer(0, 0, 100, 100, myRectLayer3, 3, ElementType.screen, 0);
            myRectLayer3.ElementSelectedState = SelectedState.None;
            myRectLayer3.ElementCollection.Add(Layer3_sender1);
            sControl.MyRectLayer = myRectLayer3;
            if(sControl._scrollViewer!=null)
            sControl._scrollViewer.Visibility=Visibility.Hidden;
                //Rectangle rect = new Rectangle();
                //rect.Stroke = Brushes.Blue;
                //rect.Fill = Brushes.White;
                //rect.Cursor = Cursors.SizeNWSE;

                //rect.MouseDown += OnGripMouseDown;
                //rect.MouseUp += OnGripMouseUp;
                //rect.MouseMove += OnGripMouseMove;
                AddVisualChild(sControl);
                _scalingGrip = sControl;
        


           
        }
        public override bool TryToMerge(IAction followingAction)
        {
            RectLayer r = new RectLayer();
            if (this.Property == r.GetType().GetProperty("ElementCollection"))
            {
                return false;
            }

            RectLayerChangedAction next = followingAction as RectLayerChangedAction;
            if (next != null && next.ParentObject == this.ParentObject && next.Property == this.Property)
            {
                Value = next.Value;
                Property.SetValue(ParentObject, Value, null);
                return true;
            }
            return false;
        }
Example #3
0
        /// <summary>
        /// 切换设计界面和调整映射位置界面
        /// </summary>
        private void OnSelectedEnvironmentChanged()
        {
            List<int> senderIndexList = new List<int>();
            int senderIndex;
            _oldSenderCount = _senderCount;
            int senderCount = Function.FindSenderCount(MyScreen.SenderConnectInfoList, out senderIndex);
            _senderCount = senderCount;
            if (_oldSenderCount != senderCount)
            {
                //发送卡个数更改,则map置为初始值
                for (int i = 0; i < MyScreen.ElementCollection.Count; i++)
                {
                    if (MyScreen.ElementCollection[i].EleType == ElementType.newLayer)
                    {
                        continue;
                    }
                    RectLayer screen = (RectLayer)((RectLayer)MyScreen.ElementCollection[i]).ElementCollection[0];
                    Function.InitMapLocation(screen);
                }
            }
            if (SelectedEnvironMentIndex == 0)
            {
                ScreenMapLocationVisible = Visibility.Collapsed;
                SenderVisible = Visibility.Collapsed;
                ScanVisible = Visibility.Collapsed;
                CustomScanVisible = Visibility.Collapsed;
                if (MyScreen!=null && MyScreen.ElementCollection!=null)
                {
                    if (MyScreen.ElementCollection.Count <= 1)
                    {
                        ScreenVisible = Visibility.Collapsed;
                    }
                    else
                    {
                        ScreenVisible = Visibility.Visible;
                    }
                }
                else
                {
                    ScreenVisible = Visibility.Collapsed;
                }
                PleaseSelElmentVisible = Visibility.Hidden;
            }
            else if (SelectedEnvironMentIndex == 1)
            {
                //查看用了多少个发送卡
                #region 单发送卡
                if (senderCount == 0)
                {
                    ScreenVisible = Visibility.Collapsed;
                    ScanVisible = Visibility.Collapsed;
                    CustomScanVisible = Visibility.Collapsed;
                    PleaseSelElmentVisible = Visibility.Hidden;
                    SenderVisible = Visibility.Collapsed;
                    ScreenMapLocationVisible = Visibility.Collapsed;
                    ScreenLocationRectLayer = new RectLayer(0, 0, SmartLCTViewModeBase.DviViewBoxWidth, SmartLCTViewModeBase.DviViewBoxHeight, null, 0, ElementType.baselayer, 0);
                }
                else if (senderCount == 1)
                {

                    ScreenMapLocationVisible = Visibility.Visible;
                    ScreenVisible = Visibility.Collapsed;
                    ScanVisible = Visibility.Collapsed;
                    CustomScanVisible = Visibility.Collapsed;
                    PleaseSelElmentVisible = Visibility.Hidden;
                    int selectedIndex = -1;
                    for (int i = 0; i < ScreenMapRealParametersValue.RectLayerCollection.Count; i++)
                    {
                        if (ScreenMapRealParametersValue.RectLayerCollection[i].ElementSelectedState != SelectedState.None)
                        {
                            selectedIndex = ScreenMapRealParametersValue.RectLayerCollection[i].ConnectedIndex;
                            break;
                        }
                    }
                    #region 显示屏映射(测试界面数据)
                    ScreenLocationRectLayer.ElementCollection.Clear();

                    RectLayer screenLocationRectLayer = new RectLayer(0, 0, SmartLCTViewModeBase.DviViewBoxWidth, SmartLCTViewModeBase.DviViewBoxHeight, null, 0, ElementType.baselayer, 0);
                    screenLocationRectLayer.OperateEnviron = OperatEnvironment.AdjustScreenLocation;
                    //显示屏移动区域的Layer(没有DVI则由发送卡最大带载决定)
                    Size screenLayerSize = MyScreen.SenderConnectInfoList[senderIndex].DviSize;
                    RectLayer screenBaseRectLayer = new RectLayer(0, 0, screenLayerSize.Width, screenLayerSize.Height, screenLocationRectLayer, 0, ElementType.screen, 0);
                    screenBaseRectLayer.OperateEnviron = OperatEnvironment.AdjustScreenLocation;

                    //由每个屏的发送卡带载生成各个显示屏带载
                    for (int i = 0; i < MyScreen.ElementCollection.Count; i++)
                    {
                        if (MyScreen.ElementCollection[i].ConnectedIndex < 0)
                        {
                            continue;
                        }
                        RectLayer screenRectLayer = ((RectLayer)(((RectLayer)MyScreen.ElementCollection[i]).ElementCollection[0]));
                        Rect screenRect = screenRectLayer.SenderConnectInfoList[senderIndex].LoadSize;
                        Point screenMapLocation = new Point();
                        for (int n = 0; n < screenRectLayer.SenderConnectInfoList[senderIndex].PortConnectInfoList.Count; n++)
                        {
                            if (screenRectLayer.SenderConnectInfoList[senderIndex].PortConnectInfoList[n].LoadSize.Width != 0 &&
                                screenRectLayer.SenderConnectInfoList[senderIndex].PortConnectInfoList[n].LoadSize.Height != 0)
                            {
                                screenMapLocation = screenRectLayer.SenderConnectInfoList[senderIndex].PortConnectInfoList[n].MapLocation;
                                break;
                            }
                        }
                        if (screenRect.Width == 0 || screenRect.Height == 0)
                        {
                            continue;
                        }
                        RectElement screen = new RectElement(screenMapLocation.X, screenMapLocation.Y, screenRect.Width, screenRect.Height, screenBaseRectLayer, i);
                        screen.OperateEnviron = OperatEnvironment.AdjustScreenLocation;
                        screen.ConnectedIndex = MyScreen.ElementCollection[i].ConnectedIndex;
                        screen.Opacity = 0.5;

                        string msg = "";
                        CommonStaticMethod.GetLanguageString("显示屏", "Lang_Global_Screen", out msg);

                        screen.DisplayName = msg + (screen.ConnectedIndex + 1);
                        screenBaseRectLayer.ElementCollection.Add(screen);
                    }

                    screenLocationRectLayer.ElementCollection.Add(screenBaseRectLayer);
                    screenLocationRectLayer.SenderIndex = senderIndex;
                    int increaseOrDecreaseIndex = GetIncreaseOrDecreaseIndex(senderIndex, ((RectLayer)screenLocationRectLayer.ElementCollection[0]));
                    ((RectLayer)screenLocationRectLayer.ElementCollection[0]).IncreaseOrDecreaseIndex = increaseOrDecreaseIndex;
                    Point newLocation=GetDviCenterPoint(increaseOrDecreaseIndex, ((RectLayer)screenLocationRectLayer.ElementCollection[0]));
                    ((RectLayer)screenLocationRectLayer.ElementCollection[0]).X = newLocation.X;
                    ((RectLayer)screenLocationRectLayer.ElementCollection[0]).Y = newLocation.Y;
                    ScreenLocationRectLayer = screenLocationRectLayer;
                    MyScreen.SenderConnectInfoList[senderIndex].IncreaseOrDecreaseIndex = increaseOrDecreaseIndex;
                    MyScreen.SenderConnectInfoList[senderIndex].IsStatIncreaseOrDecreaseIndex = true;

                    ScreenMapLocationVisible = Visibility.Visible;

                    ScreenMapRealParameters p = new ScreenMapRealParameters();
                    p.SenderLoadRectLayer = screenBaseRectLayer;
                    p.RectLayerCollection = screenBaseRectLayer.ElementCollection;
                    p.RectLayerType = ElementType.screen;

                    if (screenBaseRectLayer.ElementCollection.Count != 0)
                    {
                        if (selectedIndex != -1)
                        {
                            int realIndex = -1;
                            for (int i = 0; i < screenBaseRectLayer.ElementCollection.Count; i++)
                            {
                                if (screenBaseRectLayer.ElementCollection[i].ConnectedIndex == selectedIndex)
                                {
                                    realIndex = i;
                                    break;
                                }
                            }
                            if (realIndex != -1)
                            {
                                SenderRealParameters senderRealPara = new SenderRealParameters();
                                senderRealPara.Element = (IRectElement)screenBaseRectLayer.ElementCollection[realIndex];
                                senderRealPara.Element.ElementSelectedState = SelectedState.Selected;
                                senderRealPara.EleType = ElementType.screen;
                                SenderRealParametersValue = senderRealPara;
                                SenderVisible = Visibility.Visible;
                            }
                            else
                            {
                                SenderVisible = Visibility.Collapsed;
                            }
                        }
                        else
                        {
                            SenderVisible = Visibility.Collapsed;
                        }

                    }
                    else
                    {
                        SenderVisible = Visibility.Collapsed;
                    }
                    ScreenMapRealParametersValue = p;
                    PleaseSelElmentVisible = Visibility.Hidden;
                    #endregion

                }
                #endregion
                #region 多发送卡
                else if (senderCount > 1)
                {
                    #region 选中的网口
                    IRectElement selectedPort = new RectElement();
                    if (_currentScreen != null)
                    {
                        selectedPort.SenderIndex = _currentScreen.SenderIndex;
                        selectedPort.PortIndex = _currentScreen.PortIndex;
                        selectedPort.OperateEnviron = OperatEnvironment.AdjustSenderLocation;
                        selectedPort.ConnectedIndex = _currentScreen.ConnectedIndex;
                    }
                    if (selectedPort.SenderIndex >= 0 && selectedPort.PortIndex < 0)
                    {
                        RectLayer screenLayer = (RectLayer)((RectLayer)MyScreen.ElementCollection[selectedPort.ConnectedIndex]).ElementCollection[0];

                        ObservableCollection<PortConnectInfo> portConnectInfoList = screenLayer.SenderConnectInfoList[selectedPort.SenderIndex].PortConnectInfoList;
                        for (int m = 0; m < portConnectInfoList.Count; m++)
                        {
                            if (portConnectInfoList[m].LoadSize.Height == 0 && portConnectInfoList[m].LoadSize.Width == 0)
                            {
                                continue;
                            }
                            selectedPort.PortIndex = m;
                            break;
                        }
                    }
                    else if (selectedPort.SenderIndex < 0 && selectedPort.PortIndex < 0)
                    {
                        for (int i = 0; i < MyScreen.ElementCollection.Count; i++)
                        {
                            if (selectedPort.SenderIndex >= 0 && selectedPort.PortIndex >= 0)
                            {
                                break;
                            }
                            if (MyScreen.ElementCollection[i].EleType == ElementType.newLayer)
                            {
                                continue;
                            }
                            RectLayer screenLayer = (RectLayer)((RectLayer)MyScreen.ElementCollection[i]).ElementCollection[0];
                            for (int j = 0; j < screenLayer.SenderConnectInfoList.Count; j++)
                            {
                                if (selectedPort.SenderIndex >= 0 && selectedPort.PortIndex >= 0)
                                {
                                    break;
                                }
                                if (screenLayer.SenderConnectInfoList[j].LoadSize.Height == 0 && screenLayer.SenderConnectInfoList[j].LoadSize.Width == 0)
                                {
                                    continue;
                                }
                                ObservableCollection<PortConnectInfo> portConnectInfoList = screenLayer.SenderConnectInfoList[j].PortConnectInfoList;
                                for (int m = 0; m < portConnectInfoList.Count; m++)
                                {
                                    if (portConnectInfoList[m].LoadSize.Height == 0 && portConnectInfoList[m].LoadSize.Width == 0)
                                    {
                                        continue;
                                    }
                                    selectedPort = new RectElement();
                                    selectedPort.ConnectedIndex = i;
                                    selectedPort.SenderIndex = j;
                                    selectedPort.PortIndex = m;
                                    break;
                                }
                            }
                        }
                    }
                    #endregion

                    ScreenMapLocationVisible = Visibility.Visible;
                    ScreenVisible = Visibility.Collapsed;
                    ScanVisible = Visibility.Collapsed;
                    CustomScanVisible = Visibility.Collapsed;
                    PleaseSelElmentVisible = Visibility.Hidden;
                    #region 全部发送卡的带载(用于缩略图的大小)
                    Rect senderLoadSizeSum = new Rect();
                    for (int i = 0; i < MyScreen.SenderConnectInfoList.Count; i++)
                    {
                        if (MyScreen.SenderConnectInfoList[i].LoadSize.Height == 0 && MyScreen.SenderConnectInfoList[i].LoadSize.Width == 0)
                        {
                            continue;
                        }
                        if (senderLoadSizeSum == new Rect())
                        {
                            senderLoadSizeSum = MyScreen.SenderConnectInfoList[i].LoadSize;
                        }
                        else
                        {
                            senderLoadSizeSum = Rect.Union(senderLoadSizeSum, MyScreen.SenderConnectInfoList[i].LoadSize);
                        }
                    }
                    #endregion

                    #region 缩略图数据
                    RectLayer senderMapRectLayer = new RectLayer(0, 0, senderLoadSizeSum.Width, senderLoadSizeSum.Height, null, 0, ElementType.baselayer, 0);
                    senderMapRectLayer.OperateEnviron = OperatEnvironment.AdjustSenderLocation;

                    RectLayer screenBaseRectLayer = new RectLayer(0, 0, senderLoadSizeSum.Width, senderLoadSizeSum.Height, senderMapRectLayer, 0, ElementType.screen, 0);
                    screenBaseRectLayer.OperateEnviron = OperatEnvironment.AdjustSenderLocation;
                    //每个发送卡在所有显示屏中的网口带载 生成显示屏(缩略图中显示所有发送卡的网口)
                    for (int m = 0; m < MyScreen.SenderConnectInfoList.Count; m++)
                    {
                        //发送卡m在所有显示屏中的网口带载
                        for (int i = 0; i < MyScreen.ElementCollection.Count; i++)
                        {
                            if (MyScreen.ElementCollection[i].EleType == ElementType.newLayer)
                            {
                                continue;
                            }
                            RectLayer screenLayer = (RectLayer)((RectLayer)MyScreen.ElementCollection[i]).ElementCollection[0];
                            if (screenLayer.SenderConnectInfoList[m].LoadSize.Width == 0 && screenLayer.SenderConnectInfoList[m].LoadSize.Height == 0)
                            {
                                continue;
                            }
                            Rect senderLoadSize = screenLayer.SenderConnectInfoList[m].LoadSize;
                            ObservableCollection<PortConnectInfo> portConnectInfoList = screenLayer.SenderConnectInfoList[m].PortConnectInfoList;
                            ObservableCollection<IRectElement> portScreenCollection = new ObservableCollection<IRectElement>();
                            for (int n = 0; n < portConnectInfoList.Count; n++)
                            {
                                Rect portRect = portConnectInfoList[n].LoadSize;
                                if (portRect.Width == 0 && portRect.Height == 0)
                                {
                                    continue;
                                }
                                Point portMapLocation = portConnectInfoList[n].MapLocation;
                                RectElement portScreen = new RectElement(portRect.X - senderLoadSize.X + portMapLocation.X, portRect.Y - senderLoadSize.Y + portMapLocation.Y, portRect.Width, portRect.Height, screenBaseRectLayer, screenBaseRectLayer.MaxZorder + 1);
                                screenBaseRectLayer.MaxZorder += 1;
                                portScreen.OperateEnviron = OperatEnvironment.AdjustSenderLocation;
                                portScreen.ConnectedIndex = MyScreen.ElementCollection[i].ConnectedIndex;
                                portScreen.SenderIndex = m;
                                portScreen.PortIndex = portConnectInfoList[n].PortIndex;
                                portScreen.DisplayName = GetMultiSenderDisplayString(portScreen.ConnectedIndex + 1, portScreen.SenderIndex + 1, portScreen.PortIndex + 1);
                                screenBaseRectLayer.ElementCollection.Add(portScreen);
                                portScreenCollection.Add(portScreen);
                            }
                            //一个显示屏使用了一个发送卡的多个网口,则生成的带载显示屏成为一个组(因为一个屏里一个发送卡的网口之间的相对位置是有效的)
                            if (portScreenCollection.Count > 1)
                            {
                                Rect groupRect = Function.UnionRectCollection(portScreenCollection);
                                RectElement groupElement = new RectElement(groupRect.X, groupRect.Y, groupRect.Width, groupRect.Height, screenBaseRectLayer, screenBaseRectLayer.MaxZorder + 1);
                                screenBaseRectLayer.MaxZorder += 1;
                                groupElement.EleType = ElementType.groupframe;

                                groupElement.GroupName = screenBaseRectLayer.MaxGroupName + 1;
                                screenBaseRectLayer.MaxGroupName += 1;
                                groupElement.OperateEnviron = OperatEnvironment.DesignScreen;
                                groupElement.ConnectedIndex = MyScreen.ElementCollection[i].ConnectedIndex;
                                groupElement.SenderIndex = m;
                                screenBaseRectLayer.ElementCollection.Add(groupElement);
                                for (int j = 0; j < portScreenCollection.Count; j++)
                                {
                                    portScreenCollection[j].GroupName = groupElement.GroupName;
                                }
                            }

                        }
                    }

                    senderMapRectLayer.ElementCollection.Add(screenBaseRectLayer);
                    SenderVisible = Visibility.Visible;
                    #endregion

                    #region 选中网口
                    RectElement currentSelectedScreen = new RectElement();
                    Size sender1LoadSize = MyScreen.SenderConnectInfoList[selectedPort.SenderIndex].DviSize;
                    ScreenLocationRectLayer.ElementCollection.Clear();
                    RectLayer screenLocationRectLayer = new RectLayer(0, 0, SmartLCTViewModeBase.DviViewBoxWidth, SmartLCTViewModeBase.DviViewBoxHeight, null, 0, ElementType.baselayer, -1);
                    screenLocationRectLayer.OperateEnviron = OperatEnvironment.AdjustSenderLocation;
                    RectLayer screenBaseloaRectLayer = new RectLayer(0, 0, sender1LoadSize.Width, sender1LoadSize.Height, screenLocationRectLayer, 0, ElementType.screen, -1);
                    screenBaseloaRectLayer.OperateEnviron = OperatEnvironment.AdjustSenderLocation;
                    ObservableCollection<IRectElement> portCollection = new ObservableCollection<IRectElement>();
                    for (int j = 0; j < screenBaseRectLayer.ElementCollection.Count; j++)
                    {
                        IRectElement currentPortScreen = (IRectElement)screenBaseRectLayer.ElementCollection[j];
                        if (currentPortScreen.PortIndex < 0)
                        {
                            continue;
                        }
                        if (currentPortScreen.SenderIndex == selectedPort.SenderIndex && currentPortScreen.PortIndex == selectedPort.PortIndex)
                        {
                            RectLayer currentScreen = (RectLayer)((RectLayer)MyScreen.ElementCollection[currentPortScreen.ConnectedIndex]).ElementCollection[0];
                            RectElement e = (RectElement)((RectElement)screenBaseRectLayer.ElementCollection[j]).Clone();
                            e.ParentElement = screenBaseloaRectLayer;
                            screenBaseRectLayer.ElementCollection[j].ElementSelectedState = SelectedState.Selected;
                            e.ElementSelectedState = SelectedState.Selected;
                            e.EleType = ElementType.receive;
                            e.DisplayName = GetMultiSenderDisplayString(e.ConnectedIndex + 1, e.SenderIndex + 1, e.PortIndex + 1);
                            screenBaseloaRectLayer.ElementCollection.Add(e);
                            portCollection.Add(e);
                            SenderRealParameters senderRealPara = new SenderRealParameters();
                            senderRealPara.Element = e;
                            senderRealPara.EleType = ElementType.port;
                            SenderRealParametersValue = senderRealPara; //网口基本信息
                            currentSelectedScreen = e;
                        }
                        else if (currentPortScreen.SenderIndex == selectedPort.SenderIndex)
                        {
                            RectLayer currentScreen = (RectLayer)((RectLayer)MyScreen.ElementCollection[currentPortScreen.ConnectedIndex]).ElementCollection[0];
                            RectElement e = (RectElement)((RectElement)screenBaseRectLayer.ElementCollection[j]).Clone();
                            e.ParentElement = screenBaseloaRectLayer;
                            e.EleType = ElementType.receive;
                            e.DisplayName = GetMultiSenderDisplayString(e.ConnectedIndex + 1, e.SenderIndex + 1, e.PortIndex + 1);
                            screenBaseloaRectLayer.ElementCollection.Add(e);

                        }
                    }
                    for (int m = 0; m < screenBaseRectLayer.ElementCollection.Count; m++)
                    {
                        if (screenBaseRectLayer.ElementCollection[m].EleType == ElementType.groupframe)
                        {
                            ObservableCollection<IRectElement> portList = new ObservableCollection<IRectElement>();
                            for (int j = 0; j < screenBaseloaRectLayer.ElementCollection.Count; j++)
                            {
                                //同一个屏下面的同一张发送卡下的网口用组框框起来
                                if (((IRectElement)screenBaseloaRectLayer.ElementCollection[j]).ConnectedIndex == screenBaseRectLayer.ElementCollection[m].ConnectedIndex &&
                                    ((IRectElement)screenBaseloaRectLayer.ElementCollection[j]).SenderIndex == ((IRectElement)screenBaseRectLayer.ElementCollection[m]).SenderIndex)
                                {
                                    portList.Add((IRectElement)screenBaseloaRectLayer.ElementCollection[j]);
                                }
                            }
                            if (portList.Count < 2)
                            {
                                continue;
                            }

                            Rect groupRect = Function.UnionRectCollection(portList);
                            RectElement groupElement = (RectElement)((RectElement)screenBaseRectLayer.ElementCollection[m]).Clone();
                            groupElement.X = groupRect.X;
                            groupElement.Y = groupRect.Y;
                            groupElement.Width = groupRect.Width;
                            groupElement.Height = groupRect.Height;
                            groupElement.ParentElement = screenBaseloaRectLayer;
                            screenBaseloaRectLayer.ElementCollection.Add(groupElement);
                        }
                    }
                    screenLocationRectLayer.ElementCollection.Add(screenBaseloaRectLayer);
                    screenLocationRectLayer.SenderIndex = selectedPort.SenderIndex;
                    int increaseOrDecreaseIndex = GetIncreaseOrDecreaseIndex(selectedPort.SenderIndex, ((RectLayer)screenLocationRectLayer.ElementCollection[0]));
                    ((RectLayer)screenLocationRectLayer.ElementCollection[0]).IncreaseOrDecreaseIndex = increaseOrDecreaseIndex;
                    Point newLocation = GetDviCenterPoint(increaseOrDecreaseIndex, ((RectLayer)screenLocationRectLayer.ElementCollection[0]));
                    ((RectLayer)screenLocationRectLayer.ElementCollection[0]).X = newLocation.X;
                    ((RectLayer)screenLocationRectLayer.ElementCollection[0]).Y = newLocation.Y;
                    ScreenLocationRectLayer = screenLocationRectLayer;
                    MyScreen.SenderConnectInfoList[selectedPort.SenderIndex].IncreaseOrDecreaseIndex = increaseOrDecreaseIndex;
                    MyScreen.SenderConnectInfoList[selectedPort.SenderIndex].IsStatIncreaseOrDecreaseIndex = true;

                    ScreenMapRealParameters p = new ScreenMapRealParameters();
                    p.SenderLoadRectLayer = screenBaseloaRectLayer;
                    p.RectLayerCollection = screenBaseRectLayer.ElementCollection;
                    p.RectLayerType = ElementType.sender;
                    ScreenMapRealParametersValue = p;
                    CurrentScreen = currentSelectedScreen;
                    #endregion
                    PleaseSelElmentVisible = Visibility.Hidden;

                }
                //开始设置映射位置
                for (int i = 0; i < MyScreen.ElementCollection.Count; i++)
                {
                    if (MyScreen.ElementCollection[i].EleType == ElementType.newLayer)
                    {
                        continue;
                    }
                    RectLayer screenlayer = (RectLayer)((RectLayer)MyScreen.ElementCollection[i]).ElementCollection[0];
                }
                #endregion
                Function.UpdateSenderConnectInfo(MyScreen.SenderConnectInfoList, MyScreen);

            }
        }
Example #4
0
        private void UpdateSenderConnectInfo(RectLayer layer,SenderConnectInfo senderConnectInfo)
        {
            senderConnectInfo.IsExpand = false;
            senderConnectInfo.IsSelected = false;
            for (int m = 0; m < senderConnectInfo.PortConnectInfoList.Count; m++)
            {
                if (senderConnectInfo.PortConnectInfoList[m].ConnectLineElementList != null)
                {
                    ObservableCollection<IRectElement> connectLineElementList = senderConnectInfo.PortConnectInfoList[m].ConnectLineElementList;
                    for (int i = 0; i < connectLineElementList.Count; i++)
                    {
                        if (connectLineElementList[i].FrontLine != null)
                        {
                            layer.ElementCollection.Remove(connectLineElementList[i].FrontLine);
                        }
                        if (connectLineElementList[i].EndLine != null)
                        {
                            layer.ElementCollection.Remove(connectLineElementList[i].EndLine);
                        }
                        connectLineElementList[i].ConnectedIndex = -1;
                        connectLineElementList[i].SenderIndex = -1;
                        connectLineElementList[i].PortIndex = -1;
                    }
                    senderConnectInfo.PortConnectInfoList[m].ConnectLineElementList.Clear();
                }

                senderConnectInfo.PortConnectInfoList[m].MaxConnectIndex = -1;
                senderConnectInfo.PortConnectInfoList[m].MaxConnectElement = null;

                senderConnectInfo.PortConnectInfoList[m].IsSelected = false;
            }
        }
Example #5
0
        public static void FindConnectedIndex(RectLayer rectLayer)
        {
            if (rectLayer == null)
            {
                return;
            }
            for (int i = 0; i < rectLayer.ElementCollection.Count; i++)
            {
                if (rectLayer.ElementCollection[i] is RectElement)
                {
                    ((RectElement)rectLayer.ElementCollection[i]).ConnectedIndex = ((RectElement)rectLayer.ElementCollection[i]).ConnectedIndex;
                }
                if (rectLayer.ElementCollection[i] is RectLayer)
                {
                    FindConnectedIndex((RectLayer)rectLayer.ElementCollection[i]);
                }
            }

        }
Example #6
0
 private bool CanCmdNewLayer(RectLayer layer)
 {
     if (IsAddingReceive)
     {
         return false;
     }
     return true;
 }
Example #7
0
 public object Clonew()
 {
     RectLayer newObj = new RectLayer();
     bool res = this.CopyTow(newObj);
     if (!res)
     {
         return null;
     }
     else
     {
         return newObj;
     }
 }
Example #8
0
 private void SetElementParentElement(RectLayer layer)
 {
     for (int i = 0; i < layer.ElementCollection.Count; i++)
     {
         layer.ElementCollection[i].ParentElement = layer;
         if (layer.ElementCollection[i] is LineElement)
         {
             layer.ElementCollection.RemoveAt(i);
             i--;
         }
         if (layer.ElementCollection[i] is RectLayer)
         {
             SetElementParentElement((RectLayer)layer.ElementCollection[i]);
         }
     }
 }
Example #9
0
        public MainWindow_VM()
        {
            string msg = "显示屏连线配置";
            CommonStaticMethod.GetLanguageString(msg, "Lang_ScrCfg_ScreenName", out msg);
            WindowRealTitle = msg;
            MyScreen.ElementCollection = MyScreen.ElementCollection;
            MyScreen.EleType = ElementType.baseScreen;
            MyScreen.OperateEnviron = OperatEnvironment.DesignScreen;

            if (!this.IsInDesignMode)
            {
                ScannerTypeCollection = _globalParams.ScannerConfigCollection;
                SenderConfigCollection = _globalParams.SenderConfigCollection;
                LangItemCollection = _globalParams.LangItemCollection;
                if (_globalParams.SenderConfigCollection != null && _globalParams.SenderConfigCollection.Count != 0)
                {
                    CurrentSenderConfigInfo = _globalParams.SenderConfigCollection[0];
                }
                else
                {
                    SenderConfigInfo info = new SenderConfigInfo();
                    info.SenderTypeName = "MCTRL500";
                    info.PortCount = 4;
                    CurrentSenderConfigInfo = info;
                }
                if (_globalParams.SenderAndPortPicCollection != null && _globalParams.SenderAndPortPicCollection.Count != 0)
                {
                    SenderAndPortPicCollection = _globalParams.SenderAndPortPicCollection;
                }
            }
            else
            {
                LangItemCollection.Add(new LangItemData() { LangDisplayName = "中文", LangFlag = "zh-CN", IsSelected = false });
            }

            if (!this.IsInDesignMode)
            {
                #region 初始化显示屏的发送卡信息
                ObservableCollection<PortConnectInfo> portConnectList = new ObservableCollection<PortConnectInfo>();
                for (int i = 0; i < CurrentSenderConfigInfo.PortCount; i++)
                {
                    portConnectList.Add(new PortConnectInfo(i,0, -1, null, null, new Rect()));
                }
                MyScreen.SenderConnectInfoList.Add(new SenderConnectInfo(0, portConnectList, new Rect()));

                #endregion

                SenderRealParametersValue = new SenderRealParameters();
                SenderRealParametersValue.Element = new RectElement();
                SenderRealParametersValue = SenderRealParametersValue;
                #region 注册消息
                Messenger.Default.Register<SelectedLayerAndElement>(this, MsgToken.MSG_SELECTEDLAYERANDELEMENT_CHANGED, OnSelectedLayerAndElementChanged);
                Messenger.Default.Register<int>(this, MsgToken.MSG_INCREASEORDECREASEINDEX, OnIncreaseOrDecreaseIndexChanged);

                #endregion
                #region 显示屏
                RectLayer myRectLayer3 = new RectLayer(0, 0, SmartLCTViewModeBase.MaxScreenWidth + SmartLCTViewModeBase.ScrollWidth, SmartLCTViewModeBase.MaxScreenHeight + SmartLCTViewModeBase.ScrollWidth, MyScreen, 0, ElementType.baselayer, 0);
                myRectLayer3.OperateEnviron = OperatEnvironment.DesignScreen;
                RectLayer Layer3_sender1 = new RectLayer(0, 0, SmartLCTViewModeBase.MaxScreenWidth, SmartLCTViewModeBase.MaxScreenHeight, myRectLayer3, 3, ElementType.screen, 0);
                Layer3_sender1.OperateEnviron = OperatEnvironment.DesignScreen;
                myRectLayer3.ElementSelectedState = SelectedState.None;
                myRectLayer3.ElementCollection.Add(Layer3_sender1);
                MyScreen.ElementCollection.Add(myRectLayer3);
                SelectedScreenLayer = myRectLayer3;
                #endregion
                #region 显示屏映射
                RectLayer screenLocationRectLayer = new RectLayer(0, 0, 2000 * 4, 1000 * 4, null, 0, ElementType.baselayer, 0);
                screenLocationRectLayer.OperateEnviron = OperatEnvironment.AdjustScreenLocation;
                ScreenLocationRectLayer = screenLocationRectLayer;
                #endregion
                #region 新建
                RectLayer newLayer = new RectLayer(0, 0, SmartLCTViewModeBase.MaxScreenWidth, SmartLCTViewModeBase.MaxScreenHeight, MyScreen, -1, ElementType.newLayer, -1);
                MyScreen.ElementCollection.Add(newLayer);
                #endregion

                #region 定义命令执行函数
                CmdNewWizard = new RelayCommand(OnCmdWizardProject);
                CmdNewEmptyProject = new RelayCommand(OnCmdNewEmptyProject);
                CmdNewLayer = new RelayCommand<RectLayer>(OnCmdNewLayer, CanCmdNewLayer);
                CmdMenuNewLayer = new RelayCommand(OnCmdMenuNewLayer);
                CmdDeleteLayer = new RelayCommand<IElement>(OnCmdDeleteLayer, CanCmdDeleteLayer);

                //CmdSaveSysConfigFile = new RelayCommand(OnCmdSaveSysConfigFile);
                CmdSaveSysConfigFile = new RelayCommand(OnOtherSaveSysConfigFile);
                CmdOtherSaveSysConfigFile = new RelayCommand(OnOtherSaveSysConfigFile);
                CmdOpenConfigFile = new RelayCommand(OnCmdOpenConfigFile);

                CmdClose = new RelayCommand(OnCmdClose);
                CmdExit = new RelayCommand<CancelEventArgs>(OnCmdExit);

                CmdSelectedTreeViewValueWithSender = new RelayCommand<SenderConnectInfo>(OnCmdSelectedTreeViewValueWithSender);
                CmdSelectedTreeViewValueWithPort = new RelayCommand<PortConnectInfo>(OnCmdSelectedTreeViewValueWithPort);

                CmdShowSystemCheckDlg = new RelayCommand(OnCmdShowSystemCheckDlg);
                CmdShowSendDisplayInfoDlg = new RelayCommand(OnCmdShowSendDisplayInfoDlg);
                CmdShowScanBoardConfigManager = new RelayCommand(OnCmdShowScanBoardConfigManager);
                CmdShowEDIDManager = new RelayCommand(OnCmdShowEDIDManager);
                CmdShowBrightAdjust = new RelayCommand(OnCmdShowBrightAdjust);

                CmdStartTestTool = new RelayCommand(OnCmdStartTestTool);
                CmdStartCalculator = new RelayCommand(OnCmdStartCalculator);

                CmdChangedSkin = new RelayCommand<SkinType>(OnCmdChangedSkin);

                CmdChangedLang = new RelayCommand<string>(OnCmdChangedLang);
                #endregion
                ScreenMapLocationVisible = Visibility.Collapsed;
                SenderVisible = Visibility.Collapsed;
            }
        }
        private void _itemsControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (MyRectLayer.ElementCollection.Count == 0)
            {
                e.Handled = true;
                return;
            }
            #region 添加接收卡
            ObservableCollection<IElement> addCollection = new ObservableCollection<IElement>();
            ObservableCollection<ElementSizeInfo> elementSizeCollection = new ObservableCollection<ElementSizeInfo>();
            if (_addReceiveInfo != null && MyRectLayer.ElementCollection.Count != 0 && _myScreenLayer.OperateEnviron == OperatEnvironment.DesignScreen)
            {
                _selectedElementCollection.Clear();
                //取消所有元素的选中态
                for (int i = 0; i < _myScreenLayer.ElementCollection.Count; i++)
                {
                    if (_myScreenLayer.ElementCollection[i].EleType == ElementType.receive && _myScreenLayer.ElementCollection[i].ElementSelectedState != SelectedState.None)
                    {
                        _myScreenLayer.ElementCollection[i].ElementSelectedState = SelectedState.None;
                    }
                }
                Point pointInCanvas = e.GetPosition(_itemsControl);
                pointInCanvas.X -= _myScreenLayer.X;
                pointInCanvas.Y -= _myScreenLayer.Y;
                int cols = _addReceiveInfo.Cols;
                int rows = _addReceiveInfo.Rows;
                ScannerCofigInfo scanConfig = _addReceiveInfo.ScanConfig;
                ScanBoardProperty scanBdProp = scanConfig.ScanBdProp;
                double width = scanBdProp.Width;
                double height = scanBdProp.Height;
                RectElement groupframe;
                if (cols == 1 && rows == 1)
                {
                    groupframe = new RectElement(Math.Round(pointInCanvas.X - width / 2), Math.Round(pointInCanvas.Y - height / 2), width * cols, height * rows, null, -1);
                    RectElement rectElement = new RectElement(Math.Round(pointInCanvas.X - width / 2), Math.Round(pointInCanvas.Y - height / 2), width * cols, height * rows, _myScreenLayer, _myScreenLayer.MaxZorder + 1);
                    rectElement.EleType = ElementType.receive;
                    _myScreenLayer.MaxZorder += 1;
                    rectElement.Tag = scanConfig.Clone();
                    rectElement.IsLocked = true;
                    rectElement.ZIndex = 4;
                    rectElement.GroupName = -1;
                    rectElement.ElementSelectedState = SelectedState.Selected;
                    _selectedElementCollection.Add(rectElement);
                    _myScreenLayer.ElementCollection.Add(rectElement);
                    addCollection.Add(rectElement);

                }
                else
                {
                    groupframe = new RectElement(Math.Round(pointInCanvas.X - width / 2), Math.Round(pointInCanvas.Y - height / 2), width * cols, height * rows, _myScreenLayer, _myScreenLayer.MaxZorder + 1);
                    groupframe.EleType = ElementType.groupframe;
                    groupframe.ZIndex = 5;
                    groupframe.GroupName = _myScreenLayer.MaxGroupName + 1;
                    _myScreenLayer.MaxGroupName += 1;
                    _myScreenLayer.MaxZorder += 1;
                    groupframe.ElementSelectedState = SelectedState.SelectedAll;
                    _groupframeList.Add(groupframe.GroupName, groupframe);
                    for (int i = 0; i < cols; i++)
                    {
                        for (int j = 0; j < rows; j++)
                        {
                            RectElement rectElement = new RectElement(width * i + groupframe.X, height * j + groupframe.Y, width, height, _myScreenLayer, _myScreenLayer.MaxZorder + 1);
                            rectElement.EleType = ElementType.receive;
                            _myScreenLayer.MaxZorder += 1;
                            rectElement.Tag = scanConfig.Clone();
                            rectElement.IsLocked = true;
                            rectElement.ZIndex = 4;
                            rectElement.GroupName = groupframe.GroupName;
                            rectElement.ElementSelectedState = SelectedState.Selected;
                            _selectedElementCollection.Add(rectElement);
                            _myScreenLayer.ElementCollection.Add(rectElement);
                            addCollection.Add(rectElement);
                        }
                    }
                    _myScreenLayer.ElementCollection.Add(groupframe);
                    addCollection.Add(groupframe);

                }

                ElementSizeInfo info = new ElementSizeInfo();
                info.Element = _myScreenLayer;
                info.OldSize = new Size(_myScreenLayer.Width, _myScreenLayer.Height);
                bool isChangedSize = false;
                if (groupframe.X + groupframe.Width > _myScreenLayer.Width)
                {
                    _myScreenLayer.Width = groupframe.X + groupframe.Width;
                    isChangedSize = true;
                }
                if (groupframe.Y + groupframe.Height > _myScreenLayer.Height)
                {
                    _myScreenLayer.Height = groupframe.Y + groupframe.Height;
                    isChangedSize = true;
                }
                SelectedElementChangedHandle(MouseState.None);
                //记录
                if (isChangedSize)
                {
                    info.NewSize = new Size(_myScreenLayer.Width, _myScreenLayer.Height);
                    elementSizeCollection.Add(info);
                    ElementSizeAction elementSizeAction = new ElementSizeAction(elementSizeCollection);
                    AddAction addAction = new AddAction(_myScreenLayer, addCollection);
                    using (Transaction.Create(SmartLCTActionManager))
                    {
                        SmartLCTActionManager.RecordAction(elementSizeAction);
                        SmartLCTActionManager.RecordAction(addAction);
                    }
                }
                else
                {
                    AddAction addAction = new AddAction(_myScreenLayer, addCollection);
                    SmartLCTActionManager.RecordAction(addAction);
                }
                e.Handled = true;
                return;
            }
            #endregion

            if (_myScreenLayer != null)
            {
                Function.SetElementCollectionState(_myScreenLayer.ElementCollection, SelectedState.None);
            }
            if (MyRectLayer == null || MyRectLayer.ElementCollection.Count == 0)
            {
                return;
            }
            _myScreenLayer = (RectLayer)MyRectLayer.ElementCollection[0];
            _mousePoint = this.TranslatePoint(e.GetPosition(this), _itemsControl);
            CurrentRectElement = null;
            _isMouseLeftButtonDown = true;
            GetCurrentElementInfo();

            SelectedLayerAndElementValue.SelectedLayer = _myScreenLayer;
            SelectedLayerAndElementValue.GroupframeList = _groupframeList;
            SelectedLayerAndElementValue.SelectedInfoList = _currentSelectedElement;
            SelectedLayerAndElementValue.MainControlSize = new Size(this.ActualWidth, this.ActualHeight);
            Messenger.Default.Send<SelectedLayerAndElement>(SelectedLayerAndElementValue, MsgToken.MSG_SELECTEDLAYERANDELEMENT_CHANGED);
            //e.Handled = true;
        }
Example #11
0
        private bool LoadFromFile(string fileName, out RectLayer myscreen)
        {
            myscreen = null;
            XmlSerializer xmls = null;
            StreamReader sr = null;
            XmlReader xmlReader = null;
            string msg = string.Empty;
            bool res = false;
            try
            {
                xmls = new XmlSerializer(typeof(RectLayer));
                sr = new StreamReader(fileName);
                xmlReader = XmlReader.Create(sr);
                if (!xmls.CanDeserialize(xmlReader))
                {
                    res = false;
                    return res;
                }
                else
                {
                    RectLayer tempScanBdProp = (RectLayer)xmls.Deserialize(xmlReader);
                    myscreen = tempScanBdProp;

                    //for (int m = 0;m<myscreen.ElementCollection.Count; m++)
                    //{
                    //    if (myscreen.ElementCollection[m] != null && ((RectLayer)myscreen.ElementCollection[m]).ElementCollection.Count != 0
                    //        && ((RectLayer)myscreen.ElementCollection[m]).ElementCollection[0].EleType == ElementType.screen)
                    //    {
                    //        SetSenderConnectInfoList((RectLayer)((RectLayer)myscreen.ElementCollection[m]).ElementCollection[0]);
                    //        UpdateSenderAndPortConnectInfo((RectLayer)((RectLayer)myscreen.ElementCollection[m]).ElementCollection[0]);
                    //    }
                    //}
                    SetElementParentElement(myscreen);
                    ImproveElementCollectionProp(myscreen.ElementCollection);
                    return true;
                }
            }
            catch (System.Exception ex)
            {
                Debug.WriteLine(ex.ToString());
                res = false;
                return res;
            }
            finally
            {

                if (sr != null)
                {
                    sr.Close();
                    sr.Dispose();
                }
                if (xmlReader != null)
                {
                    xmlReader.Close();
                }
            }
        }
        private void SmartLCTControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (_myScreenLayer == null)
            {
                return;
            }
            #region 注册消息
            Messenger.Default.Register<object>(this, MsgToken.MSG_EXIT, OnExit);
            Messenger.Default.Register<NotificationMessageAction<AddReceiveInfo>>(this, MsgToken.MSG_ADDRECEIVE, OnAddReceive);
            #endregion
            if (_itemsControl == null)
            {
                return;
            }
            _itemsControl.AllowDrop = true;
            _itemsControl.MouseLeftButtonDown += new MouseButtonEventHandler(_itemsControl_MouseLeftButtonDown);
            _itemsControl.MouseMove += new MouseEventHandler(_itemsControl_MouseMove);
            _itemsControl.MouseUp += new MouseButtonEventHandler(_itemsControl_MouseUp);
            _itemsControl.MouseRightButtonDown += new MouseButtonEventHandler(_itemsControl_MouseRightButtonDown);
            _itemsControl.MouseWheel+=new MouseWheelEventHandler(_itemsControl_MouseWheel);
            if (_itemsControl != null)
            {
                Binding myBinding = new Binding("ElementCollection");
                myBinding.Source = MyRectLayer;
                myBinding.Mode = BindingMode.TwoWay;
                _itemsControl.SetBinding(ItemsControl.ItemsSourceProperty, myBinding);
                if (MyRectLayer != null)
                {
                    _itemsControl.Height = MyRectLayer.Height;
                    _itemsControl.Width = MyRectLayer.Width;
                }

            }

            InitContextMenu();

            if (MyRectLayer != null && MyRectLayer.ElementCollection.Count != 0)
            {
                _myScreenLayer = (RectLayer)MyRectLayer.ElementCollection[0];
                if (_myScreenLayer.OperateEnviron == OperatEnvironment.DesignScreen)
                {
                    _myScreenLayer.Width = 4000;
                    _myScreenLayer.Height = 3000;
                }

            }
            if (MyRectLayer != null && MyRectLayer.ElementCollection.Count != 0 && _myScreenLayer.OperateEnviron == OperatEnvironment.DesignScreen)
            {
                SelectedLayerAndElementValue.SelectedLayer = _myScreenLayer;
                SelectedLayerAndElementValue.CurrentRectElement = null;
                SelectedLayerAndElementValue.SelectedElement.Clear();
                SelectedLayerAndElementValue.GroupframeList = _groupframeList;
                SelectedLayerAndElementValue.SelectedInfoList = _currentSelectedElement;
                SelectedLayerAndElementValue.MainControlSize = new Size(this.ActualWidth, this.ActualHeight);
                Messenger.Default.Send<SelectedLayerAndElement>(SelectedLayerAndElementValue, MsgToken.MSG_SELECTEDLAYERANDELEMENT_CHANGED);
            }
            this.Focus();
        }
        public void Receive_MouseUp(object sender, MouseButtonEventArgs e, IElement element)
        {
            //if (element is LineElement)
            //{
            //    return;
            //}
            //清理工作
            _isScrollHorizon = false;
            _isScrollVertial = false;
            if (_addReceiveInfo != null)
            {
                this.Cursor = Cursors.Arrow;

            }
            if (this._adorner != null)
            {
                #region 移动与边框改变
                double changedValue = Math.Pow(SmartLCTViewModeBase.IncreaseOrDecreaseValue, _myScreenLayer.IncreaseOrDecreaseIndex);
                Point currentAdorner = new Point(_adorner.LeftOffset / changedValue, _adorner.TopOffset / changedValue);
                if (_myScreenLayer.OperateEnviron == OperatEnvironment.AdjustSenderLocation ||
                   _myScreenLayer.OperateEnviron == OperatEnvironment.AdjustScreenLocation)
                {
                    currentAdorner.X -= _myScreenLayer.X;
                    currentAdorner.Y -= _myScreenLayer.Y;
                }
                //currentAdorner = this.TranslatePoint(currentAdorner,_itemsControl);
                currentAdorner.X = Math.Round(currentAdorner.X);
                currentAdorner.Y = Math.Round(currentAdorner.Y);
                double controlMovingValueX = currentAdorner.X - _selectedReceiveArea.X;
                double controlMovingValueY = currentAdorner.Y - _selectedReceiveArea.Y;
                controlMovingValueX = Math.Round(controlMovingValueX);
                controlMovingValueY = Math.Round(controlMovingValueY);
                if (controlMovingValueX != 0 || controlMovingValueY != 0)
                {
                    _isMoving = true;
                }
                foreach (int i in _currentSelectedElement.Keys)
                {
                    if (_currentSelectedElement[i].SelectedGroupElementList.Count == 0)
                    {
                        continue;
                    }
                    ObservableCollection<IRectElement> selectedList = _currentSelectedElement[i].SelectedGroupElementList;
                    ObservableCollection<IRectElement> noSelectedList = _currentSelectedElement[i].NoSelectedGroupElementList;
                    Rect selectedElementRect = _currentSelectedElement[i].SelectedElementRect;
                    Rect noSelectedElementRect = _currentSelectedElement[i].NoSelectedElementRect;
                    if (controlMovingValueX != 0)
                    {
                        Function.SetElementCollectionX(selectedList, controlMovingValueX);
                        selectedElementRect.X += controlMovingValueX;
                        selectedElementRect.X = Math.Round(selectedElementRect.X);
                    }
                    if (controlMovingValueY != 0)
                    {
                        Function.SetElementCollectionY(selectedList, controlMovingValueY);
                        selectedElementRect.Y += controlMovingValueY;
                        selectedElementRect.Y = Math.Round(selectedElementRect.Y);
                    }
                    if (i != -1 && (controlMovingValueX != 0 || controlMovingValueY != 0))
                    {
                        if (noSelectedList.Count == 0)
                        {
                            _groupframeList[i].X += controlMovingValueX;
                            _groupframeList[i].Y += controlMovingValueY;
                        }
                        else
                        {
                            Rect unionrect = Rect.Union(selectedElementRect, noSelectedElementRect);
                            _groupframeList[i].Width = unionrect.Width;
                            _groupframeList[i].Height = unionrect.Height;
                            _groupframeList[i].X = unionrect.X;
                            _groupframeList[i].Y = unionrect.Y;

                        }
                        _currentSelectedElement[i].SelectedElementRect = selectedElementRect;
                        _currentSelectedElement[i].NoSelectedElementRect = noSelectedElementRect;
                    }
                    else if (i == -1 && (controlMovingValueX != 0 || controlMovingValueY != 0))
                    {
                        _currentSelectedElement[i].SelectedElementRect = selectedElementRect;
                    }
                }
                _selectedElementRect = new Rect();
                foreach (int key in _currentSelectedElement.Keys)
                {
                    if (_currentSelectedElement[key].SelectedGroupElementList.Count != 0)
                    {
                        if (_selectedElementRect == new Rect())
                        {
                            _selectedElementRect = _currentSelectedElement[key].SelectedElementRect;
                        }
                        else
                        {
                            _selectedElementRect = Rect.Union(_selectedElementRect, _currentSelectedElement[key].SelectedElementRect);
                        }

                    }
                }
                #endregion

                AdornerLayer.GetAdornerLayer(this._dragScope).Remove(this._adorner);
                AdornerLayer.GetAdornerLayer(this._dragScope).Remove(this._locationAdorner);
                this._adorner = null;
                this._locationAdorner = null;
                this._dragScope.MouseMove -= draghandler;
                this._dragScope.PreviewMouseMove -= draghandler;
            }

            #region 空格+鼠标移动屏体
            if ((Keyboard.GetKeyStates(Key.Space) == KeyStates.Down || (Keyboard.GetKeyStates(Key.Space) == (KeyStates.Down | KeyStates.Toggled))))
            {
                Layer_MouseLeftButtonUp(sender, e, _myScreenLayer);
                e.Handled = true;
                return;
            }
            #endregion
            _myScreenLayer = (RectLayer)MyRectLayer.ElementCollection[0];
            element.AddressVisible = Visibility.Hidden;
            FrameworkElement currentFramework = (FrameworkElement)sender;
            #region 记录移动动作
            if (_isMoving)
            {
                RecordEndMoveData();
            }
            _isMoving = false;
            #endregion

            #region 框选
            if (_isFrameSelected)
            {
                ObservableCollection<SelectedStateInfo> oldSelectedStateInfoCollection = new ObservableCollection<SelectedStateInfo>();
                oldSelectedStateInfoCollection = GetOldSelectedStateInfoCollection();
                Function.SetElementCollectionState(_selectedElementCollection, SelectedState.None);
                for (int elementIndex = 0; elementIndex < _myScreenLayer.ElementCollection.Count; elementIndex++)
                {
                    if (!(_myScreenLayer.ElementCollection[elementIndex] is RectElement))
                    {
                        continue;
                    }
                    if ((_myScreenLayer.ElementCollection[elementIndex]).ZOrder == -1)
                    {
                        #region 选中框选的元素
                        RectElement rect1 = (RectElement)_myScreenLayer.ElementCollection[elementIndex];
                        for (int i = 0; i < _myScreenLayer.ElementCollection.Count; i++)
                        {
                            if (_myScreenLayer.ElementCollection[i].EleType != ElementType.receive)
                            {
                                continue;
                            }
                            IRectElement rect2 = ((IRectElement)_myScreenLayer.ElementCollection[i]);
                            if (Function.IsRectIntersect(rect1, rect2))
                            {
                                if (rect2.EleType == ElementType.receive)
                                {
                                    ((IRectElement)_myScreenLayer.ElementCollection[i]).ElementSelectedState = SelectedState.Selected;
                                }
                            }
                        }
                        #endregion
                        ((RectLayer)_myScreenLayer).ElementCollection.RemoveAt(elementIndex);
                        break;
                    }
                }
            }
            #endregion

            GetCurrentElementInfo();

            SelectedElementChangedHandle(MouseState.MouseUp);

            _isLayerMouseLeftButtonDown = false;
            _isFrameSelected = false;
            _isMouseLeftButtonDown = false;
            currentFramework.ReleaseMouseCapture();
            e.Handled = true;
        }
        private void Receive_MouseLeftButtonDown(object sender, MouseButtonEventArgs e, IElement element)
        {
            if (element is LineElement)
            {
                ILineElement lineElement = (LineElement)element;
                IRectElement frontElment = lineElement.FrontElement;
                IRectElement endElement = lineElement.EndElement;
                Point mousePointInLine = e.GetPosition(_itemsControl);
                int clickNum = 0;
                if(mousePointInLine.X<=frontElment.X+frontElment.Width && mousePointInLine.X>=frontElment.X &&
                    mousePointInLine.Y <= frontElment.Y + frontElment.Height && mousePointInLine.Y >= frontElment.Y)
                {
                    element = frontElment;
                    clickNum += 1;
                }
                else if (mousePointInLine.X <= endElement.X + endElement.Width && mousePointInLine.X >= endElement.X &&
                    mousePointInLine.Y <= endElement.Y + endElement.Height && mousePointInLine.Y >= endElement.Y)
                {
                    element = endElement;
                    clickNum += 1;
                }
                if (clickNum == 2)
                {
                    if (frontElment.ZIndex > endElement.ZIndex)
                    {
                        element = frontElment;
                    }
                    else if(frontElment.ZIndex<endElement.ZIndex)
                    {
                        element = endElement;
                    }
                }
                if (clickNum == 0)
                {
                    e.Handled = true;
                    return;
                }

            }
            //if (element is RectLayer)
            //{
            //    Console.WriteLine("layer");
            //}
            //if (element is RectElement)
            //{
            //    Console.WriteLine("rect");
            //}
            if (element != null && element.EleType == ElementType.receive)
            {
                CurrentRectElement = (RectElement)element;
            }
            else
            {
                CurrentRectElement = null;
            }
            if (((IRectElement)element).OperateEnviron == OperatEnvironment.AdjustSenderLocation && element.EleType == ElementType.screen)
            {
                e.Handled = true;
                return;
            }
            if (MyRectLayer.ElementCollection.Count == 0)
            {
                e.Handled = true;
                return;
            }
            _myScreenLayer = (RectLayer)MyRectLayer.ElementCollection[0];
            UpdateGroupframeList();
            #region 添加接收卡
            ObservableCollection<IElement> addCollection = new ObservableCollection<IElement>();
            ObservableCollection<ElementSizeInfo> elementSizeCollection = new ObservableCollection<ElementSizeInfo>();
            if (_addReceiveInfo != null && _myScreenLayer.OperateEnviron == OperatEnvironment.DesignScreen)
            {
                this.Cursor = Cursors.Wait;
                _selectedElementCollection.Clear();
                //取消所有元素的选中态
                for (int i = 0; i < _myScreenLayer.ElementCollection.Count; i++)
                {
                    if (_myScreenLayer.ElementCollection[i].EleType == ElementType.receive && _myScreenLayer.ElementCollection[i].ElementSelectedState != SelectedState.None)
                    {
                        _myScreenLayer.ElementCollection[i].ElementSelectedState = SelectedState.None;
                    }
                }
                Point pointInCanvas = e.GetPosition(_itemsControl);
                pointInCanvas.X -= _myScreenLayer.X;
                pointInCanvas.Y -= _myScreenLayer.Y;
                int cols = _addReceiveInfo.Cols;
                int rows = _addReceiveInfo.Rows;
                ScannerCofigInfo scanConfig = _addReceiveInfo.ScanConfig;
                ScanBoardProperty scanBdProp = scanConfig.ScanBdProp;
                double width = scanBdProp.Width;
                double height = scanBdProp.Height;
                RectElement groupframe;
                if (cols == 1 && rows == 1)
                {
                    groupframe = new RectElement(Math.Round(pointInCanvas.X - width / 2), Math.Round(pointInCanvas.Y - height / 2), width * cols, height * rows, null, -1);
                    RectElement rectElement = new RectElement(Math.Round(pointInCanvas.X - width / 2), Math.Round(pointInCanvas.Y - height / 2), width * cols, height * rows, _myScreenLayer, _myScreenLayer.MaxZorder + 1);
                    rectElement.EleType = ElementType.receive;
                    _myScreenLayer.MaxZorder += 1;
                    rectElement.Tag = scanConfig.Clone();
                    rectElement.IsLocked = true;
                    rectElement.ZIndex = 4;
                    rectElement.GroupName = -1;
                    rectElement.ElementSelectedState = SelectedState.Selected;
                    _selectedElementCollection.Add(rectElement);
                    _myScreenLayer.ElementCollection.Add(rectElement);
                    addCollection.Add(rectElement);

                }
                else
                {
                    groupframe = new RectElement(Math.Round(pointInCanvas.X - width / 2), Math.Round(pointInCanvas.Y - height / 2), width * cols, height * rows, _myScreenLayer, _myScreenLayer.MaxZorder + 1);
                    groupframe.EleType = ElementType.groupframe;
                    groupframe.ZIndex = 5;
                    groupframe.GroupName = _myScreenLayer.MaxGroupName + 1;
                    _myScreenLayer.MaxGroupName += 1;
                    _myScreenLayer.MaxZorder += 1;
                    groupframe.ElementSelectedState = SelectedState.SelectedAll;
                    _groupframeList.Add(groupframe.GroupName, groupframe);
                    for (int i = 0; i < cols; i++)
                    {
                        for (int j = 0; j < rows; j++)
                        {
                            RectElement rectElement = new RectElement(width * i + groupframe.X, height * j + groupframe.Y, width, height, _myScreenLayer, _myScreenLayer.MaxZorder + 1);
                            rectElement.EleType = ElementType.receive;
                            _myScreenLayer.MaxZorder += 1;
                            rectElement.Tag = scanConfig.Clone();
                            rectElement.IsLocked = true;
                            rectElement.ZIndex = 4;
                            rectElement.GroupName = groupframe.GroupName;
                            rectElement.ElementSelectedState = SelectedState.Selected;
                            _selectedElementCollection.Add(rectElement);
                            _myScreenLayer.ElementCollection.Add(rectElement);
                            addCollection.Add(rectElement);
                        }
                    }
                    _myScreenLayer.ElementCollection.Add(groupframe);
                    addCollection.Add(groupframe);

                }

                ElementSizeInfo info = new ElementSizeInfo();
                info.Element = _myScreenLayer;
                info.OldSize = new Size(_myScreenLayer.Width, _myScreenLayer.Height);
                bool isChangedSize = false;
                if (groupframe.X + groupframe.Width > _myScreenLayer.Width)
                {
                    _myScreenLayer.Width = groupframe.X + groupframe.Width;
                    isChangedSize = true;
                }
                if (groupframe.Y + groupframe.Height > _myScreenLayer.Height)
                {
                    _myScreenLayer.Height = groupframe.Y + groupframe.Height;
                    isChangedSize = true;
                }
                SelectedElementChangedHandle(MouseState.None);
                //记录
                if (isChangedSize)
                {
                    info.NewSize = new Size(_myScreenLayer.Width, _myScreenLayer.Height);
                    elementSizeCollection.Add(info);
                    ElementSizeAction elementSizeAction = new ElementSizeAction(elementSizeCollection);
                    AddAction addAction = new AddAction(_myScreenLayer, addCollection);
                    using (Transaction.Create(SmartLCTActionManager))
                    {
                        SmartLCTActionManager.RecordAction(elementSizeAction);
                        SmartLCTActionManager.RecordAction(addAction);
                    }
                }
                else
                {
                    AddAction addAction = new AddAction(_myScreenLayer, addCollection);
                    SmartLCTActionManager.RecordAction(addAction);
                }
                e.Handled = true;
                return;
            }
            #endregion

            #region 空格+鼠标移动屏体
            if ((Keyboard.GetKeyStates(Key.Space) == KeyStates.Down || (Keyboard.GetKeyStates(Key.Space) == (KeyStates.Down | KeyStates.Toggled))))
            {
                _itemsControl.Cursor = _moveCursor;
                Layer_MouseLeftButtonDown(sender, e, _myScreenLayer);
                e.Handled = true;
                return;
            }
            #endregion
            #region 手动鼠标点击连线
            if (element.EleType == ElementType.receive)
            {
                if (_myScreenLayer.CLineType == ConnectLineType.Manual)
                {
                    if (element.ConnectedIndex >= 0)
                    {
                        e.Handled = true;
                        return;
                    }
                    ObservableCollection<IElement> addElement = new ObservableCollection<IElement>();
                    ObservableCollection<AddLineInfo> addElementInfo = new ObservableCollection<AddLineInfo>();
                    ObservableCollection<ConnectIconVisibilityInfo> connectIconVisibleCollection = new ObservableCollection<ConnectIconVisibilityInfo>();

                    //更新map
                    #region 连线前发送卡的带载
                    int senderIndex = _myScreenLayer.CurrentSenderIndex;
                    int portIndex = _myScreenLayer.CurrentPortIndex;
                    bool isSenderLoadSizeNull = false;//第一次添加该发送卡的数据
                    if (_myScreenLayer.SenderConnectInfoList[senderIndex].LoadSize.Height == 0 &&
                        _myScreenLayer.SenderConnectInfoList[senderIndex].LoadSize.Width == 0)
                    {
                        isSenderLoadSizeNull = true;
                    }
                    Rect oldSenderLoadSize = new Rect();
                    Point oldSenderPoint = new Point();
                    Point oldMap = new Point();
                    if (!isSenderLoadSizeNull)
                    {
                        oldSenderLoadSize = _myScreenLayer.SenderConnectInfoList[senderIndex].LoadSize;
                        oldSenderPoint = new Point(oldSenderLoadSize.X, oldSenderLoadSize.Y);
                        //原来的map
                        oldMap = new Point();
                        for (int j = 0; j < _myScreenLayer.SenderConnectInfoList[_myScreenLayer.CurrentSenderIndex].PortConnectInfoList.Count; j++)
                        {
                            if (_myScreenLayer.SenderConnectInfoList[_myScreenLayer.CurrentSenderIndex].PortConnectInfoList[j].LoadSize.Width != 0 &&
                                _myScreenLayer.SenderConnectInfoList[_myScreenLayer.CurrentSenderIndex].PortConnectInfoList[j].LoadSize.Height != 0)
                            {
                                oldMap = _myScreenLayer.SenderConnectInfoList[_myScreenLayer.CurrentSenderIndex].PortConnectInfoList[j].MapLocation;
                                break;
                            }
                        }
                    }
                    #endregion

                    #region 记录相关
                    //记下该元素的前一个元素的最大和最小连线图标是否显示
                    IRectElement maxConnectElement = _myScreenLayer.SenderConnectInfoList[_myScreenLayer.CurrentSenderIndex].PortConnectInfoList[_myScreenLayer.CurrentPortIndex].MaxConnectElement;
                    if (maxConnectElement != null)
                    {
                        ConnectIconVisibilityInfo info = new ConnectIconVisibilityInfo();
                        info.Element = maxConnectElement;
                        OldAndNewVisibility oldAndNewMaxConnectIndexVisibile = new OldAndNewVisibility();
                        oldAndNewMaxConnectIndexVisibile.OldValue = maxConnectElement.MaxConnectIndexVisibile;
                        OldAndNewVisibility oldAndNewMinConnectIndexVisibile = new OldAndNewVisibility();
                        oldAndNewMinConnectIndexVisibile.OldValue = maxConnectElement.MinConnectIndexVisibile;
                        info.OldAndNewMaxConnectIndexVisibile = oldAndNewMaxConnectIndexVisibile;
                        info.OldAndNewMinConnectIndexVisibile = oldAndNewMinConnectIndexVisibile;
                        connectIconVisibleCollection.Add(info);
                    }
                    #endregion

                    int connectIndex = _myScreenLayer.SenderConnectInfoList[_myScreenLayer.CurrentSenderIndex].PortConnectInfoList[_myScreenLayer.CurrentPortIndex].MaxConnectIndex + 1;

                    ((RectElement)element).SenderIndex = _myScreenLayer.CurrentSenderIndex;
                    ((RectElement)element).PortIndex = _myScreenLayer.CurrentPortIndex;
                    element.ConnectedIndex = connectIndex;

                    #region 记录相关
                    //记下连线后最大和最小连线图标是否显示
                    for (int itemIndex = 0; itemIndex < connectIconVisibleCollection.Count; itemIndex++)
                    {
                        connectIconVisibleCollection[itemIndex].OldAndNewMaxConnectIndexVisibile.NewValue = connectIconVisibleCollection[itemIndex].Element.MaxConnectIndexVisibile;
                        connectIconVisibleCollection[itemIndex].OldAndNewMinConnectIndexVisibile.NewValue = connectIconVisibleCollection[itemIndex].Element.MinConnectIndexVisibile;
                    }
                    //记下该元素最大和最小连线图标是否显示
                    ConnectIconVisibilityInfo connectIconinfo = new ConnectIconVisibilityInfo();
                    connectIconinfo.Element = (IRectElement)element;
                    OldAndNewVisibility oldAndNewMaxConnectIconVisibile = new OldAndNewVisibility();
                    oldAndNewMaxConnectIconVisibile.OldValue = Visibility.Hidden;
                    oldAndNewMaxConnectIconVisibile.NewValue = ((IRectElement)element).MaxConnectIndexVisibile;
                    OldAndNewVisibility oldAndNewMinConnectIconVisibile = new OldAndNewVisibility();
                    oldAndNewMinConnectIconVisibile.OldValue = Visibility.Hidden;
                    oldAndNewMinConnectIconVisibile.NewValue = ((IRectElement)element).MinConnectIndexVisibile;
                    connectIconinfo.OldAndNewMaxConnectIndexVisibile = oldAndNewMaxConnectIconVisibile;
                    connectIconinfo.OldAndNewMinConnectIndexVisibile = oldAndNewMinConnectIconVisibile;
                    connectIconVisibleCollection.Add(connectIconinfo);
                    #endregion

                    #region  连线后发送卡的带载
                    if (_myScreenLayer.IsStartSetMapLocation && (!isSenderLoadSizeNull))
                        {
                            //更新该发送卡的带载
                            Rect newSenderLoadSize = _myScreenLayer.SenderConnectInfoList[_myScreenLayer.CurrentSenderIndex].LoadSize;
                            Point newSenderPoint = new Point(newSenderLoadSize.X, newSenderLoadSize.Y);
                            Point difSenderPint = new Point(newSenderLoadSize.X - oldSenderPoint.X, newSenderLoadSize.Y - oldSenderPoint.Y);
                            //发送卡带载的xy有变化的话更新该发送卡下所有网口的Map
                            if (difSenderPint.Y != 0 || difSenderPint.X != 0)
                            {
                                Point newmapLocation = new Point(oldMap.X + difSenderPint.X, oldMap.Y + difSenderPint.Y);
                                if (newmapLocation.X < 0)
                                {
                                    newmapLocation.X = 0;
                                }
                                if (newmapLocation.Y < 0)
                                {
                                    newmapLocation.Y = 0;
                                }
                                //更新网口的map
                                for (int j = 0; j < _myScreenLayer.SenderConnectInfoList[senderIndex].PortConnectInfoList.Count; j++)
                                {
                                    PortConnectInfo portConnect = _myScreenLayer.SenderConnectInfoList[senderIndex].PortConnectInfoList[j];
                                    if (portConnect.LoadSize.Height != 0 && portConnect.LoadSize.Width != 0)
                                    {
                                        portConnect.MapLocation = newmapLocation;
                                    }
                                }
                            }
                            if (difSenderPint.X == 0 && difSenderPint.Y == 0)
                            {
                                _myScreenLayer.SenderConnectInfoList[senderIndex].PortConnectInfoList[portIndex].MapLocation = oldMap;
                            }
                        }
                    #endregion

                    #region 记录相关
                    if (((IRectElement)element).FrontLine != null)
                    {
                        addElement.Add(((IRectElement)element).FrontLine);
                    }

                    AddLineInfo addInfo = new AddLineInfo();
                    addInfo.Element = (IRectElement)element;
                    OldAndNewType oldAndNewConnect = new OldAndNewType();
                    oldAndNewConnect.NewValue = element.ConnectedIndex;
                    oldAndNewConnect.OldValue = -1;
                    OldAndNewType oldAndNewSender = new OldAndNewType();
                    oldAndNewSender.NewValue = ((IRectElement)element).SenderIndex;
                    oldAndNewSender.OldValue = -1;
                    OldAndNewType oldAndNewPort = new OldAndNewType();
                    oldAndNewPort.NewValue = ((IRectElement)element).PortIndex;
                    oldAndNewPort.OldValue = -1;
                    addInfo.OldAndNewConnectIndex = oldAndNewConnect;
                    addInfo.OldAndNewSenderIndex = oldAndNewSender;
                    addInfo.OldAndNewPortIndex = oldAndNewPort;
                    addElementInfo.Add(addInfo);

                    AddAction addAction = new AddAction(_myScreenLayer, addElement);
                    AddLineAction addLineAction = new AddLineAction(addElementInfo);
                    ConnectIconVisibilityAction connectIconVisibleAction = new ConnectIconVisibilityAction(connectIconVisibleCollection);
                    using (Transaction.Create(SmartLCTActionManager))
                    {
                        SmartLCTActionManager.RecordAction(addAction);
                        SmartLCTActionManager.RecordAction(addLineAction);
                        SmartLCTActionManager.RecordAction(connectIconVisibleAction);
                    }
                    #endregion
                    e.Handled = true;
                    return;
                }

            }
            #endregion
            #region 条件
            FrameworkElement currentFramework = (FrameworkElement)sender;
            _mousePoint = e.GetPosition(currentFramework);
            Point mouseLeftDownPointInThis=this.TranslatePoint(e.GetPosition(this), _itemsControl);
            _mouseLeftDownPointInThis = new Point(mouseLeftDownPointInThis.X,mouseLeftDownPointInThis.Y);

            _copyPoint = _mouseLeftDownPointInThis;

            _isMouseLeftButtonDown = true;
            _isStartMoveX = true;
            _isStartMoveY = true;
            #endregion
            GetCurrentElementInfo();

            #region 点击图层和矩形的处理
            ObservableCollection<SelectedStateInfo> oldSelectedStateInfoCollection = new ObservableCollection<SelectedStateInfo>();
            oldSelectedStateInfoCollection = GetOldSelectedStateInfoCollection();
            if (element.EleType == ElementType.screen)
            {
                #region 点击图层的处理
                ((RectLayer)element).CLineType = ConnectLineType.Auto;
                this.Cursor = Cursors.Arrow;
                foreach (int elementIndex in _currentSelectedElement.Keys)
                {
                    ObservableCollection<IRectElement> selectedGroupList = _currentSelectedElement[elementIndex].SelectedGroupElementList;
                    for (int i = 0; i < selectedGroupList.Count; i++)
                    {
                        selectedGroupList[i].ElementSelectedState = SelectedState.None;
                        if (selectedGroupList[i].EleType == ElementType.receive)
                        {
                            selectedGroupList[i].IsLocked = true;
                        }
                    }
                }
                #endregion
            }
            else if (element.EleType == ElementType.receive || element.EleType == ElementType.groupframe)
            {
                #region 展开
                RectLayer myScreen = MyRectLayer;
                while (myScreen != null && myScreen.EleType != ElementType.baseScreen)
                {
                    myScreen = (RectLayer)myScreen.ParentElement;
                }
                if (myScreen != null && myScreen.SenderConnectInfoList != null &&
               myScreen.SenderConnectInfoList.Count > 0)
                {
                    for (int m = 0; m < myScreen.SenderConnectInfoList.Count; m++)
                    {
                        bool isexpand = false;
                        ObservableCollection<PortConnectInfo> portConnectList = myScreen.SenderConnectInfoList[m].PortConnectInfoList;
                        if (portConnectList != null)
                        {
                            for (int i = 0; i < portConnectList.Count; i++)
                            {
                                if (portConnectList[i].IsOverLoad)
                                {
                                    isexpand = true;
                                    break;
                                }
                            }
                        }
                        if (isexpand)
                        {
                            myScreen.SenderConnectInfoList[m].IsExpand = true;
                        }
                        else
                        {
                            myScreen.SenderConnectInfoList[m].IsExpand = false;
                        }
                    }
                }

                if (myScreen != null && ((IRectElement)element).SenderIndex >= 0 && myScreen.SenderConnectInfoList != null &&
                    myScreen.SenderConnectInfoList.Count > 0 &&
                    myScreen.SenderConnectInfoList.Count >= ((IRectElement)element).SenderIndex)
                {
                    myScreen.SenderConnectInfoList[((IRectElement)element).SenderIndex].IsExpand = true;
                    myScreen.SenderConnectInfoList[((IRectElement)element).SenderIndex].PortConnectInfoList[((IRectElement)element).PortIndex].IsSelected = true;
                }
                #endregion
                if ((Keyboard.GetKeyStates(Key.LeftCtrl) == KeyStates.Down || (Keyboard.GetKeyStates(Key.LeftCtrl) == (KeyStates.Down | KeyStates.Toggled))) ||
                    (Keyboard.GetKeyStates(Key.RightCtrl) == KeyStates.Down || (Keyboard.GetKeyStates(Key.RightCtrl) == (KeyStates.Down | KeyStates.Toggled))))
                {
                    #region 按ctrl键
                    if (element.ElementSelectedState == SelectedState.None)
                    {
                        element.ElementSelectedState = SelectedState.Selected;
                    }
                    else if (element.ElementSelectedState != SelectedState.None)
                    {
                        element.ElementSelectedState = SelectedState.None;
                    }
                    #endregion
                }
                else
                {
                    #region 不按ctrl键
                    if (element.ElementSelectedState == SelectedState.None)
                    {
                        Function.SetElementCollectionState(_selectedElementCollection, SelectedState.None);
                        if (element.GroupName != -1)
                        {
                            ObservableCollection<IRectElement> noSelectedGroupElement = _currentSelectedElement[element.GroupName].NoSelectedGroupElementList;
                            ObservableCollection<IRectElement> selectedGroupElement = _currentSelectedElement[element.GroupName].SelectedGroupElementList;
                            Function.SetElementCollectionState(noSelectedGroupElement, SelectedState.Selected);
                            Function.SetElementCollectionState(selectedGroupElement, SelectedState.Selected);
                        }
                        element.ElementSelectedState = SelectedState.Selected;
                    }
                    #endregion
                }
            }
            #endregion
            GetCurrentElementInfo();

            RecordBeforeMoveData();
            SelectedElementChangedHandle(MouseState.None);
            e.Handled = true;
        }
        private void OnRectLayerPropertyChanged()
        {
            if (_itemsControl != null)
            {
                Binding myBinding = new Binding("ElementCollection");
                myBinding.Source = MyRectLayer;
                myBinding.Mode = BindingMode.TwoWay;
                _itemsControl.SetBinding(ItemsControl.ItemsSourceProperty, myBinding);

            }
            if (MyRectLayer != null && MyRectLayer.ElementCollection.Count != 0)
            {
                _myScreenLayer = (RectLayer)MyRectLayer.ElementCollection[0];
            }
            else
            {
                _myScreenLayer = new RectLayer();
                _myScreenLayer.EleType = ElementType.newLayer;
            }
            GetCurrentElementInfo();

            //缩放(先还原)
            if (_viewbox != null)
            {
                if (_myScreenLayer.OperateEnviron == OperatEnvironment.DesignScreen)
                {
                    _viewbox.Width = SmartLCTViewModeBase.ViewBoxWidth;
                    _viewbox.Height = SmartLCTViewModeBase.ViewBoxHeight;
                }
                else
                {
                    _viewbox.Width = SmartLCTViewModeBase.DviViewBoxWidth;
                    _viewbox.Height = SmartLCTViewModeBase.DviViewBoxHeight;
                }
                if (_myScreenLayer != new RectLayer() && _viewbox != null && _myScreenLayer.IncreaseOrDecreaseIndex > 0)
                {
                    _viewbox.Height = _viewbox.Height * Math.Pow(SmartLCTViewModeBase.IncreaseOrDecreaseValue, _myScreenLayer.IncreaseOrDecreaseIndex);
                    _viewbox.Width = _viewbox.Width * Math.Pow(SmartLCTViewModeBase.IncreaseOrDecreaseValue, _myScreenLayer.IncreaseOrDecreaseIndex);
                }
                else if (_myScreenLayer != new RectLayer() && _viewbox != null && _myScreenLayer.IncreaseOrDecreaseIndex < 0)
                {
                    _viewbox.Height = _viewbox.Height / Math.Pow(SmartLCTViewModeBase.IncreaseOrDecreaseValue, -_myScreenLayer.IncreaseOrDecreaseIndex);
                    _viewbox.Width = _viewbox.Width / Math.Pow(SmartLCTViewModeBase.IncreaseOrDecreaseValue, -_myScreenLayer.IncreaseOrDecreaseIndex);
                }
            }
            if (_myScreenLayer != new RectLayer() && _myScreenLayer.OperateEnviron == OperatEnvironment.DesignScreen)
            {
                SelectedLayerAndElementValue.SelectedLayer = _myScreenLayer;
                SelectedLayerAndElementValue.CurrentRectElement = null;
                SelectedLayerAndElementValue.SelectedElement = _selectedElementCollection;
                SelectedLayerAndElementValue.GroupframeList = _groupframeList;
                SelectedLayerAndElementValue.SelectedInfoList = _currentSelectedElement;
                SelectedLayerAndElementValue.MainControlSize = new Size(this.ActualWidth, this.ActualHeight);
                Messenger.Default.Send<SelectedLayerAndElement>(SelectedLayerAndElementValue, MsgToken.MSG_SELECTEDLAYERANDELEMENT_CHANGED);
            }

            this.Focus();
        }
        private void Layer_MouseLeftButtonDown(object sender, MouseButtonEventArgs e, IElement element)
        {
            FrameworkElement currentFramework = (FrameworkElement)sender;
            if (element.ParentElement.IsLocked)
            {
                return;
            }
            IElement parent = element.ParentElement;

            _isLayerMouseLeftButtonDown = true;
            if (element.ParentElement is RectLayer)
            {
                for (int i = 0; i < ((RectLayer)element.ParentElement).ElementCollection.Count; i++)
                {
                    if (((RectLayer)element.ParentElement).ElementCollection[i].ZOrder == element.ZOrder)
                    {
                        if (((RectLayer)element.ParentElement).ElementCollection[i] is RectLayer)
                        {
                            _selectedLayer = (RectLayer)((RectLayer)element.ParentElement).ElementCollection[i];
                            break;
                        }
                    }
                }
            }
            _mousePoint = e.GetPosition(currentFramework);
            SelectedElementChangedHandle(MouseState.None);
            e.Handled = true;
        }
Example #17
0
        private bool SaveToFile(string fileName, RectLayer myscreen)
        {
            XmlSerializer xmls = null;
            StreamWriter sw = null;
            string msg = string.Empty;
            try
            {
                xmls = new XmlSerializer(typeof(RectLayer));
                sw = new StreamWriter(fileName);
                //XmlWriterSettings setting = new XmlWriterSettings();
                //setting.CloseOutput = true;

                XmlWriter xmlWriter = XmlWriter.Create(sw);
                xmls.Serialize(sw, myscreen);
                sw.Close();
                return true;
            }
            catch (System.Exception ex)
            {
                Debug.WriteLine(ex.ToString());
                return false;
            }
            finally
            {
                if (sw != null)
                {
                    sw.Close();
                    sw.Dispose();
                }
            }
        }
Example #18
0
        private void NewProjectCallBack(ConfigurationData data)
        {
            if (data != null)
            {
                //新建工程
                MyScreen.ElementCollection.Clear();
                //更新发送卡信息
                MyScreen.SenderConnectInfoList = new ObservableCollection<SenderConnectInfo>();
                ObservableCollection<PortConnectInfo> portConnectInfoList = new ObservableCollection<PortConnectInfo>();
                for (int i = 0; i < CurrentSenderConfigInfo.PortCount; i++)
                {
                    PortConnectInfo portConnectInfo = new PortConnectInfo(i, 0, -1, null, null, new Rect());
                    portConnectInfoList.Add(portConnectInfo);
                }
                SenderConnectInfo senderConnectIinfo = new SenderConnectInfo(0, portConnectInfoList, new Rect());
                MyScreen.SenderConnectInfoList.Add(senderConnectIinfo);

                RectLayer myRectLayer3 = new RectLayer(0, 0, SmartLCTViewModeBase.MaxScreenWidth + SmartLCTViewModeBase.ScrollWidth, SmartLCTViewModeBase.MaxScreenHeight + SmartLCTViewModeBase.ScrollWidth, MyScreen, 0, ElementType.baselayer, 0);

                RectLayer Layer3_sender1 = new RectLayer(0, 0, SmartLCTViewModeBase.MaxScreenWidth, SmartLCTViewModeBase.MaxScreenHeight, myRectLayer3, 3, ElementType.screen, 0);
                myRectLayer3.ElementSelectedState = SelectedState.None;
                myRectLayer3.ElementCollection.Add(Layer3_sender1);
                MyScreen.ElementCollection.Add(myRectLayer3);

                RectLayer newLayer = new RectLayer(0, 0, SmartLCTViewModeBase.MaxScreenWidth, SmartLCTViewModeBase.MaxScreenHeight, MyScreen, -1, ElementType.newLayer, -1);
                MyScreen.ElementCollection.Add(newLayer);
                MyConfigurationData = data;
                if (SelectedEnvironMentIndex == 1)
                {
                    SelectedEnvironMentIndex = 1;
                }
            }
        }
Example #19
0
 private void SetElementFrontAndEndElement(RectLayer layer)
 {
     List<IElement> elementCollection = layer.ElementCollection.ToList<IElement>();
     elementCollection.Sort(delegate(IElement firse, IElement second)
     {
         return ((IRectElement)firse).ConnectedIndex.CompareTo(((IRectElement)second).ConnectedIndex);
     });
     layer.ElementCollection = new ObservableCollection<IElement>(elementCollection);
     for (int i = 0; i < layer.ElementCollection.Count; i++)
     {
         if (layer.ElementCollection[i] is RectElement)
         {
             ((RectElement)layer.ElementCollection[i]).FrontLine = null;
             ((RectElement)layer.ElementCollection[i]).EndLine = null;
             int connectIndex = layer.ElementCollection[i].ConnectedIndex;
             layer.ElementCollection[i].ConnectedIndex = -2;
             layer.ElementCollection[i].ConnectedIndex = connectIndex;
             if (((IRectElement)layer.ElementCollection[i]).FrontLine != null)
             {
                 ((IRectElement)layer.ElementCollection[i]).FrontLine.ZIndex = 7;
             }
         }
         if (layer.ElementCollection[i] is RectLayer)
         {
             SetElementFrontAndEndElement((RectLayer)layer.ElementCollection[i]);
         }
     }
 }
Example #20
0
 private void OnCmdClose()
 {
     string msg = "";
     CommonStaticMethod.GetLanguageString("是否保存?", "Lang_SmartLCT_VM_IsSave", out msg);
     MessageBoxResult result = ShowQuestionMessage(msg, MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
     if (result == MessageBoxResult.Yes)
     {
         OnOtherSaveSysConfigFile();
     }
     else if (result == MessageBoxResult.Cancel)
     {
         return;
     }
     MyScreen.ElementCollection.Clear();
     #region 新建
     RectLayer newLayer = new RectLayer(0, 0, SmartLCTViewModeBase.MaxScreenWidth, SmartLCTViewModeBase.MaxScreenHeight, MyScreen, -1, ElementType.newLayer, -1);
     MyScreen.ElementCollection.Add(newLayer);
     #endregion
 }
Example #21
0
        private void UpdateSenderAndPortConnectInfo(RectLayer layer)
        {
            for (int j = 0; j < layer.SenderConnectInfoList.Count; j++)
            {
                for (int m = 0; m < layer.SenderConnectInfoList[j].PortConnectInfoList.Count; m++)
                {
                    if (layer.SenderConnectInfoList[j].PortConnectInfoList[m].ConnectLineElementList != null)
                        layer.SenderConnectInfoList[j].PortConnectInfoList[m].ConnectLineElementList.Clear();
                    else
                    {
                        layer.SenderConnectInfoList[j].PortConnectInfoList[m].ConnectLineElementList = new ObservableCollection<IRectElement>();
                    }

                    layer.SenderConnectInfoList[j].PortConnectInfoList[m].MaxConnectIndex = -1;
                    layer.SenderConnectInfoList[j].PortConnectInfoList[m].MaxConnectElement = null;

                }
            }
            //更新各个网口的连线元素
            if (layer.ElementCollection.Count == 0)
            {
                return;
            }
            for (int i = 0; i < layer.ElementCollection.Count; i++)
            {
                if (layer.ElementCollection[i].ConnectedIndex != -1
                    && layer.ElementCollection[i].EleType == ElementType.receive
                    )
                {
                    IRectElement rect = (IRectElement)layer.ElementCollection[i];
                    layer.SenderConnectInfoList[rect.SenderIndex].PortConnectInfoList[rect.PortIndex].ConnectLineElementList.Add(rect);
                }
            }
            for (int i = 0; i < layer.SenderConnectInfoList.Count; i++)
            {
                for (int j = 0; j < layer.SenderConnectInfoList[i].PortConnectInfoList.Count; j++)
                {
                    if (layer.SenderConnectInfoList[i].PortConnectInfoList[j].ConnectLineElementList == null
                        || layer.SenderConnectInfoList[i].PortConnectInfoList[j].ConnectLineElementList.Count == 0)
                    {
                        continue;
                    }
                    List<IRectElement> connectList = layer.SenderConnectInfoList[i].PortConnectInfoList[j].ConnectLineElementList.ToList<IRectElement>();
                    connectList.Sort(delegate(IRectElement first, IRectElement second)
                    {
                        return first.ConnectedIndex.CompareTo(second.ConnectedIndex);
                    });
                    layer.SenderConnectInfoList[i].PortConnectInfoList[j].MaxConnectElement = ((RectElement)connectList[connectList.Count - 1]);
                    layer.SenderConnectInfoList[i].PortConnectInfoList[j].MaxConnectIndex = ((RectElement)connectList[connectList.Count - 1]).ConnectedIndex;
                }
            }
        }
Example #22
0
 private void OnCmdMenuNewLayer()
 {
     RectLayer newLayer = new RectLayer(0, 0, SmartLCTViewModeBase.MaxScreenWidth + SmartLCTViewModeBase.ScrollWidth, SmartLCTViewModeBase.MaxScreenHeight + SmartLCTViewModeBase.ScrollWidth, MyScreen, 0, ElementType.baselayer, MyScreen.ElementCollection.Count - 1);
     RectLayer newLayer_sender1 = new RectLayer(0, 0, SmartLCTViewModeBase.MaxScreenWidth, SmartLCTViewModeBase.MaxScreenHeight, newLayer, 1, ElementType.screen, 0);
     newLayer_sender1.ElementSelectedState = SelectedState.None;
     newLayer.ElementCollection.Add(newLayer_sender1);
     _myScreen.ElementCollection.Insert(MyScreen.ElementCollection.Count - 1, newLayer);
     SelectedValue = newLayer;
 }
Example #23
0
 public void SetRectElementConnectIndex(RectLayer layer)
 {
     //根据发送卡类型更新发送卡序号和网口序号
     for (int i = 0; i < layer.ElementCollection.Count; i++)
     {
         if (layer.ElementCollection[i] is RectElement)
         {
             RectElement rect = (RectElement)((RectElement)layer.ElementCollection[i]).Clone();
             int connectedIndex = rect.ConnectedIndex;
             layer.ElementCollection[i].ConnectedIndex = connectedIndex;
         }
         else if (layer.ElementCollection[i] is RectLayer)
         {
             SetRectElementConnectIndex((RectLayer)layer.ElementCollection[i]);
         }
     }
 }
Example #24
0
        private void OnCmdNewEmptyProject()
        {
            //保存当前工程
            string msg = "";
            CommonStaticMethod.GetLanguageString("是否保存?", "Lang_SmartLCT_VM_IsSave", out msg);
            MessageBoxResult result = ShowQuestionMessage(msg, MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
            if (result == MessageBoxResult.Yes)
            {
                //SaveSysConfigFile(MyConfigurationData.ProjectLocationPath + "\\" + MyConfigurationData.ProjectName + ".xml");
                OnOtherSaveSysConfigFile();
            }
            else if (result == MessageBoxResult.Cancel)
            {
                return;
            }
            //新建工程
            MyScreen.ElementCollection.Clear();
            //更新发送卡信息
            MyScreen.SenderConnectInfoList = new ObservableCollection<SenderConnectInfo>();
            ObservableCollection<PortConnectInfo> portConnectInfoList = new ObservableCollection<PortConnectInfo>();
            for (int i = 0; i < CurrentSenderConfigInfo.PortCount; i++)
            {
                PortConnectInfo portConnectInfo = new PortConnectInfo(i, 0, -1, null, null, new Rect());
                portConnectInfoList.Add(portConnectInfo);
            }
            SenderConnectInfo senderConnectIinfo = new SenderConnectInfo(0, portConnectInfoList, new Rect());
            MyScreen.SenderConnectInfoList.Add(senderConnectIinfo);

            RectLayer myRectLayer3 = new RectLayer(0, 0, SmartLCTViewModeBase.MaxScreenWidth + SmartLCTViewModeBase.ScrollWidth, SmartLCTViewModeBase.MaxScreenHeight + SmartLCTViewModeBase.ScrollWidth, MyScreen, 0, ElementType.baselayer, 0);

            RectLayer Layer3_sender1 = new RectLayer(0, 0, SmartLCTViewModeBase.MaxScreenWidth, SmartLCTViewModeBase.MaxScreenHeight, myRectLayer3, 3, ElementType.screen, 0);
            myRectLayer3.ElementSelectedState = SelectedState.None;
            myRectLayer3.ElementCollection.Add(Layer3_sender1);
            MyScreen.ElementCollection.Add(myRectLayer3);

            RectLayer newLayer = new RectLayer(0, 0, SmartLCTViewModeBase.MaxScreenWidth, SmartLCTViewModeBase.MaxScreenHeight, MyScreen, -1, ElementType.newLayer, -1);
            MyScreen.ElementCollection.Add(newLayer);
            if (SelectedEnvironMentIndex == 1)
            {
                SelectedEnvironMentIndex = 1;
            }

            //ConfigurationData ConfigData = new ConfigurationData();
            //ConfigData.OperateType = OperateScreenType.CreateScreen;
            //ConfigData.IsCreateEmptyProject = true;
            //ConfigData.SelectedScannerConfigInfo = null;
            //ConfigData.ProjectLocationPath = Function.GetDefaultCurrentProjectPath(_globalParams.RecentProjectPaths);
            //ConfigData.ProjectName = Function.GetDefaultProjectName(SmartLCTViewModeBase.DefaultProjectMainName, ".xml", ConfigData.ProjectLocationPath);
            //MyConfigurationData = ConfigData;
        }
Example #25
0
        private List<RectElement> FindRect(RectLayer layer)
        {
            List<RectElement> receiveList = new List<RectElement>();
            for (int i = 0; i < layer.ElementCollection.Count; i++)
            {
                if (layer.ElementCollection[i] is RectElement)
                {
                    receiveList.Add((RectElement)layer.ElementCollection[i]);
                }
                else if (layer.ElementCollection[i] is RectLayer)
                {
                    List<RectElement> receive = new List<RectElement>();
                    receive = FindRect((RectLayer)layer.ElementCollection[i]);
                    for (int j = 0; j < receive.Count; j++)
                    {
                        receiveList.Add(receive[j]);
                    }
                }

            }
            return receiveList;
        }
Example #26
0
 public static void SetElementSelectedState(RectLayer layer, SelectedState state)
 {
     for (int i = 0; i < layer.ElementCollection.Count; i++)
     {
         if (layer.ElementCollection[i] is RectElement)
         {
             layer.ElementCollection[i].ElementSelectedState = state;
         }
         else if (layer.ElementCollection[i] is RectLayer)
         {
             SetElementSelectedState((RectLayer)layer.ElementCollection[i], state);
         }
     }
 }
Example #27
0
        public bool CopyTow(object obj)
        {
            if (!(obj is RectLayer))
            {
                return false;
            }
            RectLayer temp = (RectLayer)obj;
            #region
            temp.BackgroundBrush = this.BackgroundBrush;
            temp.CenterX = this.CenterX;
            temp.CenterY = this.CenterY;
            temp.ElementSelectedState = this.ElementSelectedState;
            temp.Height = this.Height;
            temp.IsLocked = this.IsLocked;
            temp.IsOutlineDisplay = this.IsOutlineDisplay;
            temp.StartAndEndIconMargin = this.StartAndEndIconMargin;
            temp.Name = this.Name;
            temp.Opacity = this.Opacity;
            temp.OutlineBrush = this.OutlineBrush;
            temp.Visible = this.Visible;
            temp.Width = this.Width;
            temp.Tag = this.Tag;
            temp.EleType = this.EleType;
            temp.BorderThickness = this.BorderThickness;
            temp.SizeVisibility = this.SizeVisibility;
            temp.CLineType = this.CLineType;
            temp.MaxGroupName = this.MaxGroupName;
            temp.MaxZorder = this.MaxZorder;
            temp.CurrentPortIndex = this.CurrentPortIndex;
            temp.CurrentSenderIndex = this.CurrentSenderIndex;
            temp.RectSize = this.RectSize;
            temp.OperateEnviron = this.OperateEnviron;
            #endregion

            temp.ElementCollection = new ObservableCollection<IElement>();
            for (int i = 0; i < this.ElementCollection.Count; i++)
            {
                if (this.ElementCollection[i] is RectElement)
                {
                    RectElement rect = new RectElement();
                    rect = (RectElement)((RectElement)this.ElementCollection[i]).Clone();
                    rect.ParentElement = temp;
                    temp.ElementCollection.Add(rect);
                }
                else if (this.ElementCollection[i] is RectLayer)
                {
                    RectLayer rectLayer = new RectLayer();
                    rectLayer = (RectLayer)((RectLayer)this.ElementCollection[i]).Clone();
                    rectLayer.ParentElement = temp;
                    temp.ElementCollection.Add(rectLayer);
                }
                else if (this.ElementCollection[i] is LineElement)
                {
                    LineElement lineElement = new LineElement();
                    ((LineElement)this.ElementCollection[i]).CopyTo(lineElement);
                    lineElement.ParentElement = temp;
                    temp.ElementCollection.Add(lineElement);
                }
            }
            for (int i = 0; i < temp.ElementCollection.Count; i++)
            {
                if (temp.ElementCollection[i] is LineElement)
                {
                    for (int j = 0; j < temp.ElementCollection.Count; j++)
                    {
                        if ((temp.ElementCollection[j] is RectElement) && (((LineElement)temp.ElementCollection[i]).FrontElement.ZOrder == temp.ElementCollection[j].ZOrder))
                        {
                            ((LineElement)temp.ElementCollection[i]).FrontElement=(RectElement)temp.ElementCollection[j];
                        }
                        if ((temp.ElementCollection[j] is RectElement) && (((LineElement)temp.ElementCollection[i]).EndElement.ZOrder == temp.ElementCollection[j].ZOrder))
                        {
                            ((LineElement)temp.ElementCollection[i]).EndElement = (RectElement)temp.ElementCollection[j];
                        }
                    }
                    ((LineElement)temp.ElementCollection[i]).FrontElement.EndLine = (LineElement)temp.ElementCollection[i];
                    ((LineElement)temp.ElementCollection[i]).EndElement.FrontLine = (LineElement)temp.ElementCollection[i];
                }
            }
            return true;
        }
Example #28
0
        private void OnCmdShowSendDisplayInfoDlg()
        {
            if (_globalParams != null)
            {
                _globalParams.IsSendCurrentDisplayConfig = true;
                _globalParams.CurrentDisplayInfoList = new List<ILEDDisplayInfo>();

                #region 屏体信息
                List<ILEDDisplayInfo> ledInfoList = new List<ILEDDisplayInfo>();

                for (int i = 0; i < MyScreen.ElementCollection.Count; i++)
                {
                    if (MyScreen.ElementCollection[i].ConnectedIndex == -1)
                    {
                        continue;
                    }
                    ComplexLEDDisplayInfo info = new ComplexLEDDisplayInfo();

                    List<RectElement> receiveList = new List<RectElement>();
                    receiveList = FindRect((RectLayer)MyScreen.ElementCollection[i]);
                    for (int j = 0; j < receiveList.Count; j++)
                    {
                        ScanBoardRegionInfo receiveInfo = new ScanBoardRegionInfo();
                        receiveInfo.Height = (ushort)receiveList[j].Height;
                        receiveInfo.Width = (ushort)receiveList[j].Width;
                        receiveInfo.ConnectIndex = (ushort)receiveList[j].ConnectedIndex;
                        int portIndex = receiveList[j].ParentElement.ConnectedIndex;
                        receiveInfo.PortIndex = (byte)portIndex;
                        int senderIndex = receiveList[j].ParentElement.ParentElement.ConnectedIndex;
                        receiveInfo.SenderIndex = (byte)senderIndex;
                        receiveInfo.X = (ushort)receiveList[j].X;
                        receiveInfo.Y = (ushort)receiveList[j].Y;

                        RectLayer parent = new RectLayer();
                        parent = (RectLayer)receiveList[j].ParentElement;
                        while (parent.ParentElement != null)
                        {
                            receiveInfo.X += (ushort)parent.X;
                            receiveInfo.Y += (ushort)parent.Y;
                            parent = (RectLayer)parent.ParentElement;
                        }
                        receiveInfo.XInPort = (ushort)receiveList[j].X;
                        receiveInfo.YInPort = (ushort)receiveList[j].Y;

                        info.ScanBoardRegionInfoList.Add(receiveInfo);
                    }

                    ledInfoList.Add(info);
                }
                #endregion
                _globalParams.CurrentDisplayInfoList = GetLedDisplayInfoList();
                Messenger.Default.Send<string>("", MsgToken.MSG_SHOWEQUIPMENTMANAGER);
            }
        }
Example #29
0
 private void OnCmdNewLayer(RectLayer element)
 {
     if (element.ConnectedIndex == -1)
     {
         RectLayer newLayer = new RectLayer(0, 0, SmartLCTViewModeBase.MaxScreenWidth + SmartLCTViewModeBase.ScrollWidth, SmartLCTViewModeBase.MaxScreenHeight + SmartLCTViewModeBase.ScrollWidth, MyScreen, 0, ElementType.baselayer, MyScreen.ElementCollection.Count - 1);
         RectLayer newLayer_sender1 = new RectLayer(0, 0, SmartLCTViewModeBase.MaxScreenWidth, SmartLCTViewModeBase.MaxScreenHeight, newLayer, 1, ElementType.screen, 0);
         newLayer_sender1.SelectedSenderConfigInfo = MyScreen.SelectedSenderConfigInfo;
         CurrentSenderConfigInfo = MyScreen.SelectedSenderConfigInfo;
         newLayer_sender1.ElementSelectedState = SelectedState.None;
         newLayer.ElementCollection.Add(newLayer_sender1);
         MyScreen.ElementCollection.Insert(MyScreen.ElementCollection.Count - 1, newLayer);
         SelectedValue = (RectLayer)MyScreen.ElementCollection[MyScreen.ElementCollection.Count - 2];
     }
     else
     {
         SelectedValue = element;
     }
 }
Example #30
0
 public static void InitMapLocation(RectLayer screen)
 {
     for (int i = 0; i < screen.SenderConnectInfoList.Count; i++)
     {
         for (int j = 0; j < screen.SenderConnectInfoList[i].PortConnectInfoList.Count; j++)
         {
             PortConnectInfo portInfo = screen.SenderConnectInfoList[i].PortConnectInfoList[j];
             portInfo.MapLocation = new Point();
         }
     }
 }