示例#1
0
        void Pipe90SerSave(Pipe90 pipe90)
        {
            pipe90.Pipe90Ser.TopLenghtSize.point[0] = pipe90.PathFigureTopLenghtSize.StartPoint;
            pipe90.Pipe90Ser.TopLenghtSize.point[1] = pipe90.LineSegmentTopLenghtSize.Point;

            pipe90.Pipe90Ser.DownLenghtSize.point[0] = pipe90.PathFigureDownLenghtSize.StartPoint;
            pipe90.Pipe90Ser.DownLenghtSize.point[1] = pipe90.LineSegmentDownLenghtSize.Point;

            pipe90.Pipe90Ser.TopSize.point[0] = pipe90.PathFigureTopSize.StartPoint;
            pipe90.Pipe90Ser.TopSize.point[1] = pipe90.LineSegmentTopSize.Point;

            pipe90.Pipe90Ser.DownSize.point[0] = pipe90.PathFigureDownSize.StartPoint;
            pipe90.Pipe90Ser.DownSize.point[1] = pipe90.LineSegmentDownSize.Point;

            pipe90.Pipe90Ser.LeftFlange.point[0] = pipe90.PathFigureLeftFlange.StartPoint;
            pipe90.Pipe90Ser.LeftFlange.point[1] = pipe90.PolyLineSegmentLeftFlange.Points[0];
            pipe90.Pipe90Ser.LeftFlange.point[2] = pipe90.PolyLineSegmentLeftFlange.Points[1];
            pipe90.Pipe90Ser.LeftFlange.point[3] = pipe90.PolyLineSegmentLeftFlange.Points[2];
            pipe90.Pipe90Ser.LeftFlange.point[4] = pipe90.PolyLineSegmentLeftFlange.Points[3];

            pipe90.Pipe90Ser.RightFlange.point[0] = pipe90.PathFigureRightFlange.StartPoint;
            pipe90.Pipe90Ser.RightFlange.point[1] = pipe90.PolyLineSegmentRightFlange.Points[0];
            pipe90.Pipe90Ser.RightFlange.point[2] = pipe90.PolyLineSegmentRightFlange.Points[1];
            pipe90.Pipe90Ser.RightFlange.point[3] = pipe90.PolyLineSegmentRightFlange.Points[2];
            pipe90.Pipe90Ser.RightFlange.point[4] = pipe90.PolyLineSegmentRightFlange.Points[3];

            pipe90.Pipe90Ser.TopImage.point[0] = pipe90.PathFigureTopImage.StartPoint;
            pipe90.Pipe90Ser.TopImage.point[1] = pipe90.PolyLineSegmentTopImage.Points[0];
            pipe90.Pipe90Ser.TopImage.point[2] = pipe90.PolyLineSegmentTopImage.Points[1];
            pipe90.Pipe90Ser.TopImage.point[3] = pipe90.PolyLineSegmentTopImage.Points[2];
            pipe90.Pipe90Ser.TopImage.point[4] = pipe90.PolyLineSegmentTopImage.Points[3];

            pipe90.Pipe90Ser.DownImage.point[0] = pipe90.PathFigureDownImage.StartPoint;
            pipe90.Pipe90Ser.DownImage.point[1] = pipe90.PolyLineSegmentDownImage.Points[0];
            pipe90.Pipe90Ser.DownImage.point[2] = pipe90.PolyLineSegmentDownImage.Points[1];
            pipe90.Pipe90Ser.DownImage.point[3] = pipe90.PolyLineSegmentDownImage.Points[2];
            pipe90.Pipe90Ser.DownImage.point[4] = pipe90.PolyLineSegmentDownImage.Points[3];

            pipe90.Pipe90Ser.LeftDownSize.point[0] = pipe90.PathFigureLeftDownSize.StartPoint;
            pipe90.Pipe90Ser.LeftDownSize.point[1] = pipe90.LineSegmentLeftDownSize.Point;

            pipe90.Pipe90Ser.RightDownSize.point[0] = pipe90.PathFigureRightDownSize.StartPoint;
            pipe90.Pipe90Ser.RightDownSize.point[1] = pipe90.LineSegmentRightDownSize.Point;

            pipe90.Pipe90Ser.BorderPipe90.point[0] = pipe90.PathFigureBorder.StartPoint;
            pipe90.Pipe90Ser.BorderPipe90.point[1] = pipe90.PolyLineSegmentBorder.Points[0];
            pipe90.Pipe90Ser.BorderPipe90.point[2] = pipe90.PolyLineSegmentBorder.Points[1];
            pipe90.Pipe90Ser.BorderPipe90.point[3] = pipe90.PolyLineSegmentBorder.Points[2];
            pipe90.Pipe90Ser.BorderPipe90.point[4] = pipe90.PolyLineSegmentBorder.Points[3];
        }
        public override void DeleteItem(ControlOnCanvas objectOnCanvas)
        {
            Page page = ((AppWPF)Application.Current).CollectionPage[objectOnCanvas.IS.Path];

            if (objectOnCanvas is Pipe)
            {
                Pipe pipe = objectOnCanvas as Pipe;
                page.CollectionPipe.Remove(pipe.PipeSer);
            }
            else if (objectOnCanvas is Pipe90)
            {
                Pipe90 pipe90 = objectOnCanvas as Pipe90;
                page.CollectionPipe90.Remove(pipe90.Pipe90Ser);
            }
            else if (objectOnCanvas is Text)
            {
                Text text = objectOnCanvas as Text;
                page.CollectionText.Remove(text.TextSer);
            }
            else if (objectOnCanvas is Display)
            {
                Display display = objectOnCanvas as Display;
                page.CollectionDisplay.Remove(display.DisplaySer);
            }
            else if (objectOnCanvas is ImageControl)
            {
                ImageControl imageControl = objectOnCanvas as ImageControl;
                page.CollectionImage.Remove(imageControl.ImageSer);
            }
            else if (objectOnCanvas is EthernetControl)
            {
                EthernetControl ethernetControl = objectOnCanvas as EthernetControl;
                page.CollectionEthernet.Remove(ethernetControl.EthernetSer);
                ((AppWPF)Application.Current).CollectionEthernetSers.Remove(((EthernetControl)objectOnCanvas).EthernetSer);
            }
            else if (objectOnCanvas is ComControl)
            {
                ComControl comControl = objectOnCanvas as ComControl;
                page.CollectionCom.Remove(comControl.ComSer);
                ((AppWPF)Application.Current).CollectionComSers.Remove(((ComControl)objectOnCanvas).ComSer);
            }
            else if (objectOnCanvas is ModbusControl)
            {
                ModbusControl modbusControl = objectOnCanvas as ModbusControl;
                page.CollectionModbus.Remove(modbusControl.ModbusSer);
                ((AppWPF)Application.Current).CollectionModbusSers.Remove(modbusControl.ModbusSer);
            }

            objectOnCanvas.CanvasTab.Children.Remove(objectOnCanvas);
        }
示例#3
0
        public TabItemPage(PageScada ps)
        {
            PS = ps;
            CanvasPage canvasPage = new CanvasPage(this.PS, this);

            CanvasPage = canvasPage;

            MainWindow mainWindow = (MainWindow)Application.Current.MainWindow;

            Image imageClose = new Image();

            imageClose.Source = new BitmapImage(new Uri("Images/Close16.png", UriKind.Relative));

            Button close = new Button();

            close.Tag     = this;
            close.Click  += CloseTabItem;
            close.ToolTip = "Закрыть";
            close.Content = imageClose;
            close.Height  = 16;
            close.Width   = 16;

            Label lPageName = new Label();

            lPageName.Content = PS.Name;

            ScrollViewer scroll = new ScrollViewer();

            scroll.VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;
            scroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            scroll.SetValue(Grid.RowProperty, 0);

            Image insertImage = new Image();

            insertImage.Source = new BitmapImage(new Uri("Images/Insert16.ico", UriKind.Relative));

            Binding BindingInsert = new Binding();

            BindingInsert.Source = mainWindow;
            BindingInsert.Path   = new PropertyPath("IsBindingInsertObject");
            BindingInsert.Mode   = BindingMode.OneWay;

            MenuItem menuItemInsert = new MenuItem();

            menuItemInsert.SetBinding(MenuItem.IsEnabledProperty, BindingInsert);
            menuItemInsert.Icon   = insertImage;
            menuItemInsert.Click += canvasPage.Insert;
            menuItemInsert.Header = "Вставить";

            ContextMenu contextMenuCanvas = new ContextMenu();

            contextMenuCanvas.Items.Add(menuItemInsert);

            canvasPage.ContextMenu = contextMenuCanvas;

            StackPanel panelTabItem = new StackPanel();

            panelTabItem.ToolTip     = PS.Path;
            panelTabItem.Orientation = Orientation.Horizontal;
            panelTabItem.Children.Add(lPageName);
            panelTabItem.Children.Add(close);

            this.Header    = panelTabItem;
            this.Content   = scroll;
            scroll.Content = canvasPage;

            ((AppWPF)Application.Current).CollectionTabItemParent.Add(PS.Path, this);

            Page page = ((AppWPF)Application.Current).CollectionPage[PS.Path];

            foreach (PipeSer pipeSer in page.CollectionPipe)
            {
                Pipe pipe = new Pipe(PS, CanvasPage, pipeSer);

                pipe.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
                {
                    pipe.PathFigureLeftSize.StartPoint = pipeSer.LeftSize.point[0];
                    pipe.LineSegmentLeftSize.Point     = pipeSer.LeftSize.point[1];

                    pipe.PathFigureRightSize.StartPoint = pipeSer.RightSize.point[0];
                    pipe.LineSegmentRightSize.Point     = pipeSer.RightSize.point[1];

                    pipe.PathFigureTopSize.StartPoint = pipeSer.TopSize.point[0];
                    pipe.LineSegmentTopSize.Point     = pipeSer.TopSize.point[1];

                    pipe.PathFigureDownSize.StartPoint = pipeSer.DownSize.point[0];
                    pipe.LineSegmentDownSize.Point     = pipeSer.DownSize.point[1];

                    pipe.PathFigureLeftFlange.StartPoint     = pipeSer.LeftFlange.point[0];
                    pipe.PolyLineSegmentLeftFlange.Points[0] = pipeSer.LeftFlange.point[1];
                    pipe.PolyLineSegmentLeftFlange.Points[1] = pipeSer.LeftFlange.point[2];
                    pipe.PolyLineSegmentLeftFlange.Points[2] = pipeSer.LeftFlange.point[3];
                    pipe.PolyLineSegmentLeftFlange.Points[3] = pipeSer.LeftFlange.point[4];

                    pipe.PathFigureRightFlange.StartPoint     = pipeSer.RightFlange.point[0];
                    pipe.PolyLineSegmentRightFlange.Points[0] = pipeSer.RightFlange.point[1];
                    pipe.PolyLineSegmentRightFlange.Points[1] = pipeSer.RightFlange.point[2];
                    pipe.PolyLineSegmentRightFlange.Points[2] = pipeSer.RightFlange.point[3];
                    pipe.PolyLineSegmentRightFlange.Points[3] = pipeSer.RightFlange.point[4];

                    pipe.PathFigurePipe.StartPoint     = pipeSer.Pipe.point[0];
                    pipe.PolyLineSegmentPipe.Points[0] = pipeSer.Pipe.point[1];
                    pipe.PolyLineSegmentPipe.Points[1] = pipeSer.Pipe.point[2];
                    pipe.PolyLineSegmentPipe.Points[2] = pipeSer.Pipe.point[3];
                    pipe.PolyLineSegmentPipe.Points[3] = pipeSer.Pipe.point[4];

                    pipe.PathFigureBorder.StartPoint     = pipeSer.BorderPipe.point[0];
                    pipe.PolyLineSegmentBorder.Points[0] = pipeSer.BorderPipe.point[1];
                    pipe.PolyLineSegmentBorder.Points[1] = pipeSer.BorderPipe.point[2];
                    pipe.PolyLineSegmentBorder.Points[2] = pipeSer.BorderPipe.point[3];
                    pipe.PolyLineSegmentBorder.Points[3] = pipeSer.BorderPipe.point[4];

                    pipe.Diameter = (pipe.PathFigureDownSize.StartPoint.Y - pipe.PathFigureTopSize.StartPoint.Y);
                }));

                pipe.SetValue(Canvas.LeftProperty, pipeSer.Сoordinates.X);
                pipe.SetValue(Canvas.TopProperty, pipeSer.Сoordinates.Y);

                canvasPage.Children.Add(pipe);
                pipe.ApplyTemplate();
            }
            foreach (Pipe90Ser pipe90Ser in page.CollectionPipe90)
            {
                Pipe90 pipe90 = new Pipe90(PS, CanvasPage, pipe90Ser);

                pipe90.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
                {
                    pipe90.PathFigureTopLenghtSize.StartPoint = pipe90Ser.TopLenghtSize.point[0];
                    pipe90.LineSegmentTopLenghtSize.Point     = pipe90Ser.TopLenghtSize.point[1];

                    pipe90.PathFigureDownLenghtSize.StartPoint = pipe90Ser.DownLenghtSize.point[0];
                    pipe90.LineSegmentDownLenghtSize.Point     = pipe90Ser.DownLenghtSize.point[1];

                    pipe90.PathFigureTopSize.StartPoint = pipe90Ser.TopSize.point[0];
                    pipe90.LineSegmentTopSize.Point     = pipe90Ser.TopSize.point[1];

                    pipe90.PathFigureDownSize.StartPoint = pipe90Ser.DownSize.point[0];
                    pipe90.LineSegmentDownSize.Point     = pipe90Ser.DownSize.point[1];

                    pipe90.PathFigureLeftFlange.StartPoint     = pipe90Ser.LeftFlange.point[0];
                    pipe90.PolyLineSegmentLeftFlange.Points[0] = pipe90Ser.LeftFlange.point[1];
                    pipe90.PolyLineSegmentLeftFlange.Points[1] = pipe90Ser.LeftFlange.point[2];
                    pipe90.PolyLineSegmentLeftFlange.Points[2] = pipe90Ser.LeftFlange.point[3];
                    pipe90.PolyLineSegmentLeftFlange.Points[3] = pipe90Ser.LeftFlange.point[4];

                    pipe90.PathFigureRightFlange.StartPoint     = pipe90Ser.RightFlange.point[0];
                    pipe90.PolyLineSegmentRightFlange.Points[0] = pipe90Ser.RightFlange.point[1];
                    pipe90.PolyLineSegmentRightFlange.Points[1] = pipe90Ser.RightFlange.point[2];
                    pipe90.PolyLineSegmentRightFlange.Points[2] = pipe90Ser.RightFlange.point[3];
                    pipe90.PolyLineSegmentRightFlange.Points[3] = pipe90Ser.RightFlange.point[4];

                    pipe90.PathFigureTopImage.StartPoint     = pipe90Ser.TopImage.point[0];
                    pipe90.PolyLineSegmentTopImage.Points[0] = pipe90Ser.TopImage.point[1];
                    pipe90.PolyLineSegmentTopImage.Points[1] = pipe90Ser.TopImage.point[2];
                    pipe90.PolyLineSegmentTopImage.Points[2] = pipe90Ser.TopImage.point[3];
                    pipe90.PolyLineSegmentTopImage.Points[3] = pipe90Ser.TopImage.point[4];

                    pipe90.PathFigureDownImage.StartPoint     = pipe90Ser.DownImage.point[0];
                    pipe90.PolyLineSegmentDownImage.Points[0] = pipe90Ser.DownImage.point[1];
                    pipe90.PolyLineSegmentDownImage.Points[1] = pipe90Ser.DownImage.point[2];
                    pipe90.PolyLineSegmentDownImage.Points[2] = pipe90Ser.DownImage.point[3];
                    pipe90.PolyLineSegmentDownImage.Points[3] = pipe90Ser.DownImage.point[4];

                    pipe90.PathFigureLeftDownSize.StartPoint = pipe90Ser.LeftDownSize.point[0];
                    pipe90.LineSegmentLeftDownSize.Point     = pipe90Ser.LeftDownSize.point[1];

                    pipe90.PathFigureRightDownSize.StartPoint = pipe90Ser.RightDownSize.point[0];
                    pipe90.LineSegmentRightDownSize.Point     = pipe90Ser.RightDownSize.point[1];

                    pipe90.PathFigureBorder.StartPoint     = pipe90Ser.BorderPipe90.point[0];
                    pipe90.PolyLineSegmentBorder.Points[0] = pipe90Ser.BorderPipe90.point[1];
                    pipe90.PolyLineSegmentBorder.Points[1] = pipe90Ser.BorderPipe90.point[2];
                    pipe90.PolyLineSegmentBorder.Points[2] = pipe90Ser.BorderPipe90.point[3];
                    pipe90.PolyLineSegmentBorder.Points[3] = pipe90Ser.BorderPipe90.point[4];

                    pipe90.Diameter = (pipe90.PathFigureDownSize.StartPoint.Y - pipe90.PathFigureTopSize.StartPoint.Y);
                }));

                pipe90.SetValue(Canvas.LeftProperty, pipe90Ser.Сoordinates.X);
                pipe90.SetValue(Canvas.TopProperty, pipe90Ser.Сoordinates.Y);

                canvasPage.Children.Add(pipe90);
                pipe90.ApplyTemplate();
            }
            foreach (TextSer textSer in page.CollectionText)
            {
                Text text = new Text(PS, CanvasPage, textSer);

                text.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
                {
                    text.PathFigureBorder.StartPoint     = textSer.Border.point[0];
                    text.PolyLineSegmentBorder.Points[0] = textSer.Border.point[1];
                    text.PolyLineSegmentBorder.Points[1] = textSer.Border.point[2];
                    text.PolyLineSegmentBorder.Points[2] = textSer.Border.point[3];
                    text.PolyLineSegmentBorder.Points[3] = textSer.Border.point[4];

                    text.PathFigureDownSize.StartPoint = textSer.DownSize.point[0];
                    text.LineSegmentDownSize.Point     = textSer.DownSize.point[1];

                    text.PathFigureLeftSize.StartPoint = textSer.LeftSize.point[0];
                    text.LineSegmentLeftSize.Point     = textSer.LeftSize.point[1];

                    text.PathFigureRightSize.StartPoint = textSer.RightSize.point[0];
                    text.LineSegmentRightSize.Point     = textSer.RightSize.point[1];

                    text.PathFigureTopSize.StartPoint = textSer.TopSize.point[0];
                    text.LineSegmentTopSize.Point     = textSer.TopSize.point[1];
                }));

                text.SetValue(Canvas.LeftProperty, textSer.Сoordinates.X);
                text.SetValue(Canvas.TopProperty, textSer.Сoordinates.Y);

                canvasPage.Children.Add(text);

                text.ApplyTemplate();
            }
            foreach (DisplaySer displaySer in page.CollectionDisplay)
            {
                Display display = new Display(PS, CanvasPage, displaySer);

                display.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
                {
                    display.PathFigureBorder.StartPoint     = displaySer.Border.point[0];
                    display.PolyLineSegmentBorder.Points[0] = displaySer.Border.point[1];
                    display.PolyLineSegmentBorder.Points[1] = displaySer.Border.point[2];
                    display.PolyLineSegmentBorder.Points[2] = displaySer.Border.point[3];
                    display.PolyLineSegmentBorder.Points[3] = displaySer.Border.point[4];

                    display.PathFigureDownSize.StartPoint = displaySer.DownSize.point[0];
                    display.LineSegmentDownSize.Point     = displaySer.DownSize.point[1];

                    display.PathFigureLeftSize.StartPoint = displaySer.LeftSize.point[0];
                    display.LineSegmentLeftSize.Point     = displaySer.LeftSize.point[1];

                    display.PathFigureRightSize.StartPoint = displaySer.RightSize.point[0];
                    display.LineSegmentRightSize.Point     = displaySer.RightSize.point[1];

                    display.PathFigureTopSize.StartPoint = displaySer.TopSize.point[0];
                    display.LineSegmentTopSize.Point     = displaySer.TopSize.point[1];
                }));

                display.SetValue(Canvas.LeftProperty, displaySer.Сoordinates.X);
                display.SetValue(Canvas.TopProperty, displaySer.Сoordinates.Y);

                canvasPage.Children.Add(display);

                display.ApplyTemplate();

                if (display.DisplaySer.IsEthernet)
                {
                    foreach (EthernetSer ethernetSer in ((AppWPF)Application.Current).CollectionEthernetSers)
                    {
                        if (ethernetSer.ID == displaySer.EthernetID)
                        {
                            if (displaySer.IsCollRec)
                            {
                                foreach (ItemEthernet itemEthernet in ethernetSer.CollectionItemNetRec)
                                {
                                    if (displaySer.ItemEthernetID == itemEthernet.ID)
                                    {
                                        displaySer.ItemEthernet = itemEthernet;

                                        display.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
                                        {
                                            Binding valueBinding   = new Binding();
                                            valueBinding.Converter = new ValueItemNetConverter(displaySer.ItemEthernet);
                                            valueBinding.Source    = displaySer.ItemEthernet;
                                            valueBinding.Path      = new PropertyPath("Value");

                                            display.RunBinding.SetBinding(Run.TextProperty, valueBinding);
                                        }));

                                        break;
                                    }
                                }
                            }

                            if (displaySer.IsCollSend)
                            {
                                foreach (ItemEthernet itemEthernet in ethernetSer.CollectionItemNetSend)
                                {
                                    if (displaySer.ItemEthernetID == itemEthernet.ID)
                                    {
                                        displaySer.ItemEthernet = itemEthernet;

                                        display.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
                                        {
                                            Binding valueBinding   = new Binding();
                                            valueBinding.Converter = new ValueItemNetConverter(displaySer.ItemEthernet);
                                            valueBinding.Source    = displaySer.ItemEthernet;
                                            valueBinding.Path      = new PropertyPath("Value");

                                            display.RunBinding.SetBinding(Run.TextProperty, valueBinding);
                                        }));

                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
                else if (display.DisplaySer.IsModbus)
                {
                    foreach (ModbusSer modbusSer in ((AppWPF)Application.Current).CollectionModbusSers)
                    {
                        if (modbusSer.ID == displaySer.ModbusID)
                        {
                            foreach (ItemModbus itemModbus in modbusSer.CollectionItemModbus)
                            {
                                if (displaySer.ItemModbusID == itemModbus.ID)
                                {
                                    displaySer.ItemModbus = itemModbus;

                                    display.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
                                    {
                                        Binding valueBinding   = new Binding();
                                        valueBinding.Converter = new ValueItemModbusConverter(displaySer.ItemModbus);
                                        valueBinding.Source    = displaySer.ItemModbus;
                                        valueBinding.Path      = new PropertyPath("Value");

                                        display.RunBinding.SetBinding(Run.TextProperty, valueBinding);
                                    }));

                                    break;
                                }
                            }

                            break;
                        }
                    }
                }
            }
            foreach (ImageSer imageSer in page.CollectionImage)
            {
                ImageControl imageControl = new ImageControl(PS, CanvasPage, imageSer);

                imageControl.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
                {
                    imageControl.PathFigureBorder.StartPoint     = imageSer.Border.point[0];
                    imageControl.PolyLineSegmentBorder.Points[0] = imageSer.Border.point[1];
                    imageControl.PolyLineSegmentBorder.Points[1] = imageSer.Border.point[2];
                    imageControl.PolyLineSegmentBorder.Points[2] = imageSer.Border.point[3];
                    imageControl.PolyLineSegmentBorder.Points[3] = imageSer.Border.point[4];

                    imageControl.PathFigureDownSize.StartPoint = imageSer.DownSize.point[0];
                    imageControl.LineSegmentDownSize.Point     = imageSer.DownSize.point[1];

                    imageControl.PathFigureLeftSize.StartPoint = imageSer.LeftSize.point[0];
                    imageControl.LineSegmentLeftSize.Point     = imageSer.LeftSize.point[1];

                    imageControl.PathFigureRightSize.StartPoint = imageSer.RightSize.point[0];
                    imageControl.LineSegmentRightSize.Point     = imageSer.RightSize.point[1];

                    imageControl.PathFigureTopSize.StartPoint = imageSer.TopSize.point[0];
                    imageControl.LineSegmentTopSize.Point     = imageSer.TopSize.point[1];

                    if (imageSer.PathImage != null)
                    {
                        try
                        {
                            BitmapImage bi = new BitmapImage(new Uri(@imageSer.PathImage, UriKind.RelativeOrAbsolute));

                            if (bi.PixelWidth < 10 || bi.PixelWidth < 10)
                            {
                                new Exception();
                            }

                            imageControl.templateImage.Source = bi;
                        }
                        catch
                        {
                            imageControl.templateImage.Source = new BitmapImage(new Uri("../Images/ImageNotFound.png", UriKind.RelativeOrAbsolute));

                            bool rotate0   = false;
                            bool rotate90  = false;
                            bool rotate180 = false;
                            bool rotate270 = false;

                            if ((int)imageControl.RenderTransform.Value.M11 == 0 && (int)imageControl.RenderTransform.Value.M12 == -1)
                            {
                                rotate90 = true;
                            }
                            else if ((int)imageControl.RenderTransform.Value.M11 == -1 && (int)imageControl.RenderTransform.Value.M12 == 0)
                            {
                                rotate180 = true;
                            }
                            else if ((int)imageControl.RenderTransform.Value.M11 == 0 && (int)imageControl.RenderTransform.Value.M12 == 1)
                            {
                                rotate270 = true;
                            }
                            else
                            {
                                rotate0 = true;
                            }

                            if (rotate0)
                            {
                                SizeImage((BitmapImage)imageControl.templateImage.Source, imageControl);
                            }
                            else if (rotate90)
                            {
                                SizeImage((BitmapImage)imageControl.templateImage.Source, imageControl);
                            }
                            else if (rotate180)
                            {
                                SizeImage((BitmapImage)imageControl.templateImage.Source, imageControl);
                            }
                            else if (rotate270)
                            {
                                SizeImage((BitmapImage)imageControl.templateImage.Source, imageControl);
                            }
                        }
                    }
                    else if (imageControl.ImageSer.LibraryImage != null)
                    {
                        BitmapImage bi = new BitmapImage(new Uri(@"pack://application:,,,/Images/" + imageControl.ImageSer.LibraryImage + ".png", UriKind.RelativeOrAbsolute));

                        imageControl.templateImage.Source = bi;
                    }
                    else
                    {
                        imageControl.templateImage.Source = new BitmapImage(new Uri("../Images/ImageNotFound.png", UriKind.RelativeOrAbsolute));

                        bool rotate0   = false;
                        bool rotate90  = false;
                        bool rotate180 = false;
                        bool rotate270 = false;

                        if ((int)imageControl.RenderTransform.Value.M11 == 0 && (int)imageControl.RenderTransform.Value.M12 == -1)
                        {
                            rotate90 = true;
                        }
                        else if ((int)imageControl.RenderTransform.Value.M11 == -1 && (int)imageControl.RenderTransform.Value.M12 == 0)
                        {
                            rotate180 = true;
                        }
                        else if ((int)imageControl.RenderTransform.Value.M11 == 0 && (int)imageControl.RenderTransform.Value.M12 == 1)
                        {
                            rotate270 = true;
                        }
                        else
                        {
                            rotate0 = true;
                        }

                        if (rotate0)
                        {
                            SizeImage((BitmapImage)imageControl.templateImage.Source, imageControl);
                        }
                        else if (rotate90)
                        {
                            SizeImage((BitmapImage)imageControl.templateImage.Source, imageControl);
                        }
                        else if (rotate180)
                        {
                            SizeImage((BitmapImage)imageControl.templateImage.Source, imageControl);
                        }
                        else if (rotate270)
                        {
                            SizeImage((BitmapImage)imageControl.templateImage.Source, imageControl);
                        }
                    }

                    if (imageControl.ImageSer.StretchImage == "None")
                    {
                        imageControl.templateImage.Stretch = Stretch.None;
                    }
                    else if (imageControl.ImageSer.StretchImage == "Fill")
                    {
                        imageControl.templateImage.Stretch = Stretch.Fill;
                    }
                    else if (imageControl.ImageSer.StretchImage == "Uniform")
                    {
                        imageControl.templateImage.Stretch = Stretch.Uniform;
                    }
                    else if (imageControl.ImageSer.StretchImage == "UniformToFill")
                    {
                        imageControl.templateImage.Stretch = Stretch.UniformToFill;
                    }
                }));

                imageControl.SetValue(Canvas.LeftProperty, imageSer.Сoordinates.X);
                imageControl.SetValue(Canvas.TopProperty, imageSer.Сoordinates.Y);

                canvasPage.Children.Add(imageControl);

                imageControl.ApplyTemplate();
            }
            foreach (EthernetSer ethernetSer in page.CollectionEthernet)
            {
                EthernetControl ethernetControl = new EthernetControl(PS, CanvasPage, ethernetSer);

                ((AppWPF)Application.Current).CollectionEthernetSers.Add(ethernetSer);

                ethernetControl.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
                {
                    ethernetControl.PathFigureBorder.StartPoint     = ethernetSer.Border.point[0];
                    ethernetControl.PolyLineSegmentBorder.Points[0] = ethernetSer.Border.point[1];
                    ethernetControl.PolyLineSegmentBorder.Points[1] = ethernetSer.Border.point[2];
                    ethernetControl.PolyLineSegmentBorder.Points[2] = ethernetSer.Border.point[3];
                    ethernetControl.PolyLineSegmentBorder.Points[3] = ethernetSer.Border.point[4];

                    ethernetControl.PathFigureDownSize.StartPoint = ethernetSer.DownSize.point[0];
                    ethernetControl.LineSegmentDownSize.Point     = ethernetSer.DownSize.point[1];

                    ethernetControl.PathFigureLeftSize.StartPoint = ethernetSer.LeftSize.point[0];
                    ethernetControl.LineSegmentLeftSize.Point     = ethernetSer.LeftSize.point[1];

                    ethernetControl.PathFigureRightSize.StartPoint = ethernetSer.RightSize.point[0];
                    ethernetControl.LineSegmentRightSize.Point     = ethernetSer.RightSize.point[1];

                    ethernetControl.PathFigureTopSize.StartPoint = ethernetSer.TopSize.point[0];
                    ethernetControl.LineSegmentTopSize.Point     = ethernetSer.TopSize.point[1];
                }));

                ethernetControl.SetValue(Canvas.LeftProperty, ethernetSer.Сoordinates.X);
                ethernetControl.SetValue(Canvas.TopProperty, ethernetSer.Сoordinates.Y);

                canvasPage.Children.Add(ethernetControl);

                ethernetControl.ApplyTemplate();
            }
            foreach (ComSer comSer in page.CollectionCom)
            {
                ComControl comControl = new ComControl(PS, CanvasPage, comSer);

                ((AppWPF)Application.Current).CollectionComSers.Add(comSer);

                comControl.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
                {
                    comControl.PathFigureBorder.StartPoint     = comSer.Border.point[0];
                    comControl.PolyLineSegmentBorder.Points[0] = comSer.Border.point[1];
                    comControl.PolyLineSegmentBorder.Points[1] = comSer.Border.point[2];
                    comControl.PolyLineSegmentBorder.Points[2] = comSer.Border.point[3];
                    comControl.PolyLineSegmentBorder.Points[3] = comSer.Border.point[4];

                    comControl.PathFigureDownSize.StartPoint = comSer.DownSize.point[0];
                    comControl.LineSegmentDownSize.Point     = comSer.DownSize.point[1];

                    comControl.PathFigureLeftSize.StartPoint = comSer.LeftSize.point[0];
                    comControl.LineSegmentLeftSize.Point     = comSer.LeftSize.point[1];

                    comControl.PathFigureRightSize.StartPoint = comSer.RightSize.point[0];
                    comControl.LineSegmentRightSize.Point     = comSer.RightSize.point[1];

                    comControl.PathFigureTopSize.StartPoint = comSer.TopSize.point[0];
                    comControl.LineSegmentTopSize.Point     = comSer.TopSize.point[1];
                }));

                comControl.SetValue(Canvas.LeftProperty, comSer.Сoordinates.X);
                comControl.SetValue(Canvas.TopProperty, comSer.Сoordinates.Y);

                canvasPage.Children.Add(comControl);

                comControl.ApplyTemplate();
            }
            foreach (ModbusSer modbusSer in page.CollectionModbus)
            {
                ModbusControl modbusControl = new ModbusControl(PS, CanvasPage, modbusSer);

                ((AppWPF)Application.Current).CollectionModbusSers.Add(modbusSer);

                modbusControl.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
                {
                    modbusControl.PathFigureBorder.StartPoint     = modbusSer.Border.point[0];
                    modbusControl.PolyLineSegmentBorder.Points[0] = modbusSer.Border.point[1];
                    modbusControl.PolyLineSegmentBorder.Points[1] = modbusSer.Border.point[2];
                    modbusControl.PolyLineSegmentBorder.Points[2] = modbusSer.Border.point[3];
                    modbusControl.PolyLineSegmentBorder.Points[3] = modbusSer.Border.point[4];

                    modbusControl.PathFigureDownSize.StartPoint = modbusSer.DownSize.point[0];
                    modbusControl.LineSegmentDownSize.Point     = modbusSer.DownSize.point[1];

                    modbusControl.PathFigureLeftSize.StartPoint = modbusSer.LeftSize.point[0];
                    modbusControl.LineSegmentLeftSize.Point     = modbusSer.LeftSize.point[1];

                    modbusControl.PathFigureRightSize.StartPoint = modbusSer.RightSize.point[0];
                    modbusControl.LineSegmentRightSize.Point     = modbusSer.RightSize.point[1];

                    modbusControl.PathFigureTopSize.StartPoint = modbusSer.TopSize.point[0];
                    modbusControl.LineSegmentTopSize.Point     = modbusSer.TopSize.point[1];
                }));

                modbusControl.SetValue(Canvas.LeftProperty, modbusSer.Сoordinates.X);
                modbusControl.SetValue(Canvas.TopProperty, modbusSer.Сoordinates.Y);

                canvasPage.Children.Add(modbusControl);

                modbusControl.ApplyTemplate();
            }
        }
示例#4
0
        public DialogWindowPropertiesPipe90(Pipe90 pipe)
        {
            InitializeComponent();

            Pipe90 = pipe;
        }
示例#5
0
        private void Apply(object sender, RoutedEventArgs e)
        {
            pipe90.ComboBoxEnvironment.SelectedIndex = ComboBoxEnvironment.SelectedIndex;
            pipe90.TextBoxDiameter.Text = string.Format("{0:F2}", Convert.ToDouble(textBoxDiameter.Text));

            int    selectEnvironment = ComboBoxEnvironment.SelectedIndex;
            double selectDiameter    = Math.Round(Convert.ToDouble(textBoxDiameter.Text), 2, MidpointRounding.AwayFromZero);

            int countPipeSelected = 0;

            foreach (ControlOnCanvasPage controlOnCanvas in pipe90.CanvasPage.Children)
            {
                if (controlOnCanvas.IsSelected)
                {
                    countPipeSelected += 1;
                }
            }

            foreach (ControlOnCanvasPage objectOnCanvas in pipe90.CanvasPage.Children)
            {
                if (objectOnCanvas is Pipe90 && objectOnCanvas.IsSelected)
                {
                    Pipe90 pipe90OnCanvas = objectOnCanvas as Pipe90;

                    if (pipe90OnCanvas.Pipe90Ser.Environment != selectEnvironment)
                    {
                        IsSave = true;

                        pipe90OnCanvas.IntEnvironment = ComboBoxEnvironment.SelectedIndex;
                    }

                    if (pipe90OnCanvas.Diameter != selectDiameter)
                    {
                        IsSave = true;

                        double delta = selectDiameter - pipe90OnCanvas.Diameter;

                        Point topSizePoint = pipe90OnCanvas.PathFigureTopSize.StartPoint;
                        topSizePoint.X += delta;
                        pipe90OnCanvas.PathFigureTopSize.StartPoint = topSizePoint;

                        Point downSizePoint = pipe90OnCanvas.PathFigureDownSize.StartPoint;
                        downSizePoint.Y += delta;
                        downSizePoint.X += delta;
                        pipe90OnCanvas.PathFigureDownSize.StartPoint = downSizePoint;
                        Point downSizePoint2 = pipe90OnCanvas.LineSegmentDownSize.Point;
                        downSizePoint2.Y += delta;
                        downSizePoint2.X += delta;
                        pipe90OnCanvas.LineSegmentDownSize.Point = downSizePoint2;

                        Point leftSizePoint2 = pipe90OnCanvas.PathFigureTopLenghtSize.StartPoint;
                        leftSizePoint2.X += delta;
                        pipe90OnCanvas.PathFigureTopLenghtSize.StartPoint = leftSizePoint2;
                        Point leftSizePoint = pipe90OnCanvas.LineSegmentTopLenghtSize.Point;
                        leftSizePoint.Y += delta;
                        leftSizePoint.X += delta;
                        pipe90OnCanvas.LineSegmentTopLenghtSize.Point = leftSizePoint;

                        Point rightFlangePoint = pipe90OnCanvas.PathFigureRightFlange.StartPoint;
                        rightFlangePoint.X += delta;
                        rightFlangePoint.Y += delta;
                        pipe90OnCanvas.PathFigureRightFlange.StartPoint = rightFlangePoint;
                        Point rightFlangePoint2 = pipe90OnCanvas.PolyLineSegmentRightFlange.Points[0];
                        Point rightFlangePoint3 = pipe90OnCanvas.PolyLineSegmentRightFlange.Points[3];
                        Point rightFlangePoint4 = pipe90OnCanvas.PolyLineSegmentRightFlange.Points[1];
                        Point rightFlangePoint5 = pipe90OnCanvas.PolyLineSegmentRightFlange.Points[2];
                        rightFlangePoint2.Y += delta;
                        rightFlangePoint2.X += delta;
                        rightFlangePoint3.Y += delta;
                        rightFlangePoint3.X += delta;
                        rightFlangePoint4.X += delta;
                        rightFlangePoint5.X += delta;
                        pipe90OnCanvas.PolyLineSegmentRightFlange.Points[0] = rightFlangePoint2;
                        pipe90OnCanvas.PolyLineSegmentRightFlange.Points[3] = rightFlangePoint3;
                        pipe90OnCanvas.PolyLineSegmentRightFlange.Points[1] = rightFlangePoint4;
                        pipe90OnCanvas.PolyLineSegmentRightFlange.Points[2] = rightFlangePoint5;

                        Point borderPipePoint1 = pipe90OnCanvas.PolyLineSegmentBorder.Points[0];
                        Point borderPipePoint2 = pipe90OnCanvas.PolyLineSegmentBorder.Points[1];
                        Point borderPipePoint3 = pipe90OnCanvas.PolyLineSegmentBorder.Points[2];
                        borderPipePoint1.X += delta;
                        pipe90OnCanvas.PolyLineSegmentBorder.Points[0] = borderPipePoint1;
                        borderPipePoint2.Y += delta;
                        borderPipePoint2.X += delta;
                        pipe90OnCanvas.PolyLineSegmentBorder.Points[1] = borderPipePoint2;
                        borderPipePoint3.Y += delta;
                        pipe90OnCanvas.PolyLineSegmentBorder.Points[2] = borderPipePoint3;

                        Point pointPipe = pipe90OnCanvas.PathFigureTopImage.StartPoint;
                        pointPipe.Y += delta;
                        pointPipe.X += delta;
                        pipe90OnCanvas.PathFigureTopImage.StartPoint = pointPipe;
                        Point pointPipe4 = pipe90OnCanvas.PolyLineSegmentTopImage.Points[1];
                        Point pointPipe2 = pipe90OnCanvas.PolyLineSegmentTopImage.Points[2];
                        Point pointPipe3 = pipe90OnCanvas.PolyLineSegmentTopImage.Points[3];
                        pointPipe2.Y += delta;
                        pointPipe3.Y += delta;
                        pointPipe2.X += delta;
                        pointPipe3.X += delta;
                        pointPipe4.X += delta;
                        pipe90OnCanvas.PolyLineSegmentTopImage.Points[1] = pointPipe4;
                        pipe90OnCanvas.PolyLineSegmentTopImage.Points[2] = pointPipe2;
                        pipe90OnCanvas.PolyLineSegmentTopImage.Points[3] = pointPipe3;

                        Point topSizePoint3 = pipe90OnCanvas.PathFigureLeftDownSize.StartPoint;
                        topSizePoint3.Y += delta;
                        pipe90OnCanvas.PathFigureLeftDownSize.StartPoint = topSizePoint3;

                        Point downSizePoint3 = pipe90OnCanvas.PathFigureRightDownSize.StartPoint;
                        downSizePoint3.Y += delta;
                        downSizePoint3.X += delta;
                        pipe90OnCanvas.PathFigureRightDownSize.StartPoint = downSizePoint3;
                        Point downSizePoint4 = pipe90OnCanvas.LineSegmentRightDownSize.Point;
                        downSizePoint4.X += delta;
                        downSizePoint4.Y += delta;
                        pipe90OnCanvas.LineSegmentRightDownSize.Point = downSizePoint4;

                        Point leftFlangePoint = pipe90OnCanvas.PathFigureLeftFlange.StartPoint;
                        leftFlangePoint.Y += delta;
                        pipe90OnCanvas.PathFigureLeftFlange.StartPoint = leftFlangePoint;
                        Point leftFlangePoint2 = pipe90OnCanvas.PolyLineSegmentLeftFlange.Points[0];
                        Point leftFlangePoint3 = pipe90OnCanvas.PolyLineSegmentLeftFlange.Points[1];
                        Point leftFlangePoint4 = pipe90OnCanvas.PolyLineSegmentLeftFlange.Points[2];
                        Point leftFlangePoint5 = pipe90OnCanvas.PolyLineSegmentLeftFlange.Points[3];
                        leftFlangePoint2.Y += delta;
                        leftFlangePoint3.Y += delta;
                        leftFlangePoint3.X += delta;
                        leftFlangePoint4.Y += delta;
                        leftFlangePoint4.X += delta;
                        leftFlangePoint5.Y += delta;
                        pipe90OnCanvas.PolyLineSegmentLeftFlange.Points[0] = leftFlangePoint2;
                        pipe90OnCanvas.PolyLineSegmentLeftFlange.Points[1] = leftFlangePoint3;
                        pipe90OnCanvas.PolyLineSegmentLeftFlange.Points[2] = leftFlangePoint4;
                        pipe90OnCanvas.PolyLineSegmentLeftFlange.Points[3] = leftFlangePoint5;

                        Point pipe3 = pipe90OnCanvas.PolyLineSegmentDownImage.Points[0];
                        Point pipe4 = pipe90OnCanvas.PolyLineSegmentDownImage.Points[1];
                        Point pipe5 = pipe90OnCanvas.PolyLineSegmentDownImage.Points[2];
                        pipe3.Y += delta;
                        pipe3.X += delta;
                        pipe4.Y += delta;
                        pipe4.X += delta;
                        pipe5.Y += delta;
                        pipe90OnCanvas.PolyLineSegmentDownImage.Points[0] = pipe3;
                        pipe90OnCanvas.PolyLineSegmentDownImage.Points[1] = pipe4;
                        pipe90OnCanvas.PolyLineSegmentDownImage.Points[2] = pipe5;

                        Point downLenghtPoint = pipe90OnCanvas.PathFigureDownLenghtSize.StartPoint;
                        downLenghtPoint.Y += delta;
                        pipe90OnCanvas.PathFigureDownLenghtSize.StartPoint = downLenghtPoint;
                        Point downLenghtPoint2 = pipe90OnCanvas.LineSegmentDownLenghtSize.Point;
                        downLenghtPoint2.Y += delta;
                        downLenghtPoint2.X += delta;
                        pipe90OnCanvas.LineSegmentDownLenghtSize.Point = downLenghtPoint2;

                        pipe90OnCanvas.Diameter = (downSizePoint.Y - topSizePoint.Y);

                        this.SetValue(Canvas.TopProperty, (double)GetValue(Canvas.TopProperty) + delta);

                        Pipe90SerSave(pipe90OnCanvas);
                    }

                    pipe90.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
                    {
                        if (countPipeSelected == 1)
                        {
                            if (pipe90OnCanvas.controlOnCanvasSer.Transform == 0)
                            {
                                pipe90OnCanvas.CoordinateX.Text = string.Format("{0:F2}", (double)pipe90OnCanvas.GetValue(Canvas.LeftProperty));
                                pipe90OnCanvas.CoordinateY.Text = string.Format("{0:F2}", (double)pipe90OnCanvas.GetValue(Canvas.TopProperty));
                            }
                            else if (pipe90OnCanvas.controlOnCanvasSer.Transform == -90 || pipe90OnCanvas.controlOnCanvasSer.Transform == 270)
                            {
                                pipe90OnCanvas.CoordinateY.Text = string.Format("{0:F2}", (double)pipe90OnCanvas.GetValue(Canvas.TopProperty) - pipe90OnCanvas.ActualWidth);
                                pipe90OnCanvas.CoordinateX.Text = string.Format("{0:F2}", (double)pipe90OnCanvas.GetValue(Canvas.LeftProperty));
                            }
                            else if (pipe90OnCanvas.controlOnCanvasSer.Transform == -180 || pipe90OnCanvas.controlOnCanvasSer.Transform == 180)
                            {
                                pipe90OnCanvas.CoordinateY.Text = string.Format("{0:F2}", (double)pipe90OnCanvas.GetValue(Canvas.TopProperty) - pipe90OnCanvas.ActualHeight);
                                pipe90OnCanvas.CoordinateX.Text = string.Format("{0:F2}", (double)pipe90OnCanvas.GetValue(Canvas.LeftProperty) - pipe90OnCanvas.ActualWidth);
                            }
                            else if (pipe90OnCanvas.controlOnCanvasSer.Transform == -270 || pipe90OnCanvas.controlOnCanvasSer.Transform == 90)
                            {
                                pipe90OnCanvas.CoordinateY.Text = string.Format("{0:F2}", (double)pipe90OnCanvas.GetValue(Canvas.TopProperty));
                                pipe90OnCanvas.CoordinateX.Text = string.Format("{0:F2}", (double)pipe90OnCanvas.GetValue(Canvas.LeftProperty) - pipe90OnCanvas.ActualHeight);
                            }
                        }
                    }));
                }
                else if (objectOnCanvas is Pipe && objectOnCanvas.IsSelected)
                {
                    Pipe pipeOnCanvas = objectOnCanvas as Pipe;

                    if (pipeOnCanvas.PipeSer.Environment != selectEnvironment)
                    {
                        IsSave = true;

                        pipeOnCanvas.IntEnvironment = ComboBoxEnvironment.SelectedIndex;
                    }

                    if (pipeOnCanvas.Diameter != selectDiameter)
                    {
                        IsSave = true;

                        double delta = selectDiameter - pipeOnCanvas.Diameter;

                        Point topSizePoint = pipeOnCanvas.PathFigureTopSize.StartPoint;

                        Point downSizePoint = pipeOnCanvas.PathFigureDownSize.StartPoint;
                        downSizePoint.Y += delta;
                        pipeOnCanvas.PathFigureDownSize.StartPoint = downSizePoint;
                        Point downSizePoint2 = pipeOnCanvas.LineSegmentDownSize.Point;
                        downSizePoint2.Y += delta;
                        pipeOnCanvas.LineSegmentDownSize.Point = downSizePoint2;

                        Point leftSizePoint = pipeOnCanvas.LineSegmentLeftSize.Point;
                        leftSizePoint.Y += delta;
                        pipeOnCanvas.LineSegmentLeftSize.Point = leftSizePoint;

                        Point rightSizePoint = pipeOnCanvas.PathFigureRightSize.StartPoint;
                        rightSizePoint.Y += delta;
                        pipeOnCanvas.PathFigureRightSize.StartPoint = rightSizePoint;

                        Point rightFlangePoint2 = pipeOnCanvas.PolyLineSegmentRightFlange.Points[1];
                        Point rightFlangePoint3 = pipeOnCanvas.PolyLineSegmentRightFlange.Points[2];
                        rightFlangePoint2.Y += delta;
                        rightFlangePoint3.Y += delta;
                        pipeOnCanvas.PolyLineSegmentRightFlange.Points[1] = rightFlangePoint2;
                        pipeOnCanvas.PolyLineSegmentRightFlange.Points[2] = rightFlangePoint3;

                        Point leftFlangePoint2 = pipeOnCanvas.PolyLineSegmentLeftFlange.Points[1];
                        Point leftFlangePoint3 = pipeOnCanvas.PolyLineSegmentLeftFlange.Points[2];
                        leftFlangePoint2.Y += delta;
                        leftFlangePoint3.Y += delta;
                        pipeOnCanvas.PolyLineSegmentLeftFlange.Points[1] = leftFlangePoint2;
                        pipeOnCanvas.PolyLineSegmentLeftFlange.Points[2] = leftFlangePoint3;

                        Point borderPipePoint2 = pipeOnCanvas.PolyLineSegmentBorder.Points[1];
                        Point borderPipePoint3 = pipeOnCanvas.PolyLineSegmentBorder.Points[2];
                        borderPipePoint2.Y += delta;
                        pipeOnCanvas.PolyLineSegmentBorder.Points[1] = borderPipePoint2;
                        borderPipePoint3.Y += delta;
                        pipeOnCanvas.PolyLineSegmentBorder.Points[2] = borderPipePoint3;

                        Point pointPipe = pipeOnCanvas.PathFigurePipe.StartPoint;
                        pointPipe.Y += delta;
                        pipeOnCanvas.PathFigurePipe.StartPoint = pointPipe;
                        Point pointPipe2 = pipeOnCanvas.PolyLineSegmentPipe.Points[2];
                        Point pointPipe3 = pipeOnCanvas.PolyLineSegmentPipe.Points[3];
                        pointPipe2.Y += delta;
                        pointPipe3.Y += delta;
                        pipeOnCanvas.PolyLineSegmentPipe.Points[2] = pointPipe2;
                        pipeOnCanvas.PolyLineSegmentPipe.Points[3] = pointPipe3;

                        pipeOnCanvas.Diameter = (downSizePoint.Y - topSizePoint.Y);

                        PipeSerSave(pipeOnCanvas);
                    }

                    pipe90.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
                    {
                        if (countPipeSelected == 1)
                        {
                            if (pipeOnCanvas.controlOnCanvasSer.Transform == 0)
                            {
                                pipeOnCanvas.CoordinateX.Text = string.Format("{0:F2}", (double)pipeOnCanvas.GetValue(Canvas.LeftProperty));
                                pipeOnCanvas.CoordinateY.Text = string.Format("{0:F2}", (double)pipeOnCanvas.GetValue(Canvas.TopProperty));
                            }
                            else if (pipeOnCanvas.controlOnCanvasSer.Transform == -90 || pipeOnCanvas.controlOnCanvasSer.Transform == 270)
                            {
                                pipeOnCanvas.CoordinateY.Text = string.Format("{0:F2}", (double)pipeOnCanvas.GetValue(Canvas.TopProperty) - pipeOnCanvas.ActualWidth);
                                pipeOnCanvas.CoordinateX.Text = string.Format("{0:F2}", (double)pipeOnCanvas.GetValue(Canvas.LeftProperty));
                            }
                            else if (pipeOnCanvas.controlOnCanvasSer.Transform == -180 || pipeOnCanvas.controlOnCanvasSer.Transform == 180)
                            {
                                pipeOnCanvas.CoordinateY.Text = string.Format("{0:F2}", (double)pipeOnCanvas.GetValue(Canvas.TopProperty) - pipeOnCanvas.ActualHeight);
                                pipeOnCanvas.CoordinateX.Text = string.Format("{0:F2}", (double)pipeOnCanvas.GetValue(Canvas.LeftProperty) - pipeOnCanvas.ActualWidth);
                            }
                            else if (pipeOnCanvas.controlOnCanvasSer.Transform == -270 || pipeOnCanvas.controlOnCanvasSer.Transform == 90)
                            {
                                pipeOnCanvas.CoordinateY.Text = string.Format("{0:F2}", (double)pipeOnCanvas.GetValue(Canvas.TopProperty));
                                pipeOnCanvas.CoordinateX.Text = string.Format("{0:F2}", (double)pipeOnCanvas.GetValue(Canvas.LeftProperty) - pipeOnCanvas.ActualHeight);
                            }
                        }
                    }));
                }
            }

            if (IsSave)
            {
                ((AppWPF)Application.Current).SaveTabItem(pipe90.CanvasPage.TabItemPage);
            }

            e.Handled = true;
            this.Close();
        }