private void SelectLine_Handler(CustomLine line, MouseButtonEventArgs ea)
        {
            var parent = line.GetParent();

            if (ea.ClickCount == 3)
            {
                if (parent == null)
                {
                    DivideLine_Click(line, ea);
                }
            }
            else if (ea.ClickCount == 2)
            {
                additionLinesWindow?.Reset();

                if (parent != null)
                {
                    while (parent.GetParent() != null)
                    {
                        parent = parent.GetParent();
                    }
                }
                else
                {
                    parent = line;
                }

                if (parent.IsSelected())
                {
                    parent.UnSelect();
                    selectedObjects.Remove(parent);
                    morphWindow?.RemoveObject(parent);
                }
                else
                {
                    parent.Select();
                    selectedObjects.Add(parent);
                    morphWindow?.AddObject(parent);
                }
            }
        }
        private void AddEventsOnLine(CustomLine line)
        {
            line.MouseLeftButtonDown += delegate(object s, MouseButtonEventArgs ea)
            {
                var point = ea.GetPosition(Canvas);
                point.Offset(-CordCenter.X, -CordCenter.Y);

                if (line.GetParent() == null)
                {
                    ChoosePoint_handler(line, point);
                }
                SelectLine_Handler(line, ea);
            };

            line.MouseLeftButtonUp += delegate(object s, MouseButtonEventArgs ea)
            {
                line.IsPressed_Point_1 = false;
                line.IsPressed_Point_2 = false;
            };

            line.PreviewMouseRightButtonDown += delegate(object s, MouseButtonEventArgs ea)
            {
                var point = ea.GetPosition(Canvas);
                point.Offset(-CordCenter.X, -CordCenter.Y);
                if (line.GetParent() == null)
                {
                    ChoosePoint_handler(line, point);
                }
                SetPointsInfo(point, line);
            };

            line.PreviewMouseRightButtonUp += delegate(object s, MouseButtonEventArgs ea)
            {
                var point = ea.GetPosition(Canvas);
                point.Offset(CordCenter.X, CordCenter.Y);
            };

            line.MouseEnter += delegate(object s, MouseEventArgs ea)
            {
                if (line.IsSelected())
                {
                    Cursor = Cursors.Hand;
                }
                //line.IsNotEntered = true;
                //if (ea.LeftButton == MouseButtonState.Pressed && !(line.IsPressed_Point_1 || line.IsPressed_Point_2))
                //{
                //    line.IsNotEntered = false;
                //}
            };
            line.MouseMove += delegate(object s, MouseEventArgs ea)
            {
                if (ea.LeftButton != MouseButtonState.Pressed)
                {
                    line.IsPressed_Point_1 = false;
                    line.IsPressed_Point_2 = false;
                }

                onLine = line;
                SetPointsInfo(ea.GetPosition(Canvas), line);
                var position = ea.GetPosition(Canvas);
                position.Offset(-CordCenter.X, -CordCenter.Y);
                if (line.IsSelected())
                {
                    if (line.IsNearToPoint1(position) || line.IsNearToPoint2(position))
                    {
                        Cursor = Cursors.SizeAll;
                    }
                    else
                    {
                        Cursor = Cursors.Hand;
                    }
                }
            };
            line.MouseLeave += delegate(object s, MouseEventArgs ea)
            {
                onLine = null;
                Cursor = Cursors.Arrow;
            };
            line.MouseUp += delegate(object s, MouseButtonEventArgs ea)
            {
                Cursor = Cursors.Arrow;
            };
        }