public void DrawVertex(double x, double y, MouseButtonEventHandler MouseLeftButtonUp, MouseButtonEventHandler MouseLeftButtonDown, MouseEventHandler MouseMove)
        {
            string  Name    = (Graph.Vertices.Count).ToString();
            Viewbox viewbox = UICreator.CreateViewBox("vertex");

            viewbox.MouseLeftButtonUp   += MouseLeftButtonUp;
            viewbox.MouseLeftButtonDown += MouseLeftButtonDown;
            viewbox.MouseMove           += MouseMove;
            SetElementCanvasPosition(viewbox, x, y);
            Grid      grid    = new Grid();
            Ellipse   ellipse = UICreator.CreateEllipse(x, y, 20, 20);
            TextBlock text    = UICreator.CreateTextBlock(Name);

            text.IsEnabled           = false;
            text.HorizontalAlignment = HorizontalAlignment.Center;
            text.VerticalAlignment   = VerticalAlignment.Center;
            grid.Children.Add(ellipse);
            grid.Children.Add(text);
            viewbox.Child = grid;
            Panel.SetZIndex(viewbox, 1);
            Canvas.Children.Add(viewbox);
            Vertex vertex = new Vertex(viewbox);

            Graph.AddVertex(vertex);
        }
        public void DrawEdge(Viewbox ViewBox1, Viewbox ViewBox2, KeyEventHandler TextboxHandler,
                             MouseButtonEventHandler MouseEvent)
        {
            if (Graph.FindEdge(Graph.FindVertex(
                                   ExtractElementFromViewBox <TextBlock>(ViewBox1).Text),
                               Graph.FindVertex(ExtractElementFromViewBox <TextBlock>(ViewBox2).Text)) != null)
            {
                CancelSelection(GetFrameworkElementCollection <Button>().FirstOrDefault(b => b.Name == "FindPathButton"));
                return;
            }
            Point point1 = GetControlPositionOnCanvas(ViewBox1);
            Point point2 = GetControlPositionOnCanvas(ViewBox2);
            Line  line   = new Line
            {
                Stroke          = Brushes.Black,
                StrokeThickness = 2,
                RenderTransform = new TranslateTransform(ViewBox1.ActualWidth / 2, ViewBox1.ActualHeight / 2)
            };

            SetLineBinding(ViewBox1, ViewBox2, line);
            double  MarginLeft   = (point1.X + point2.X) / 2;
            double  MarginTop    = (point1.Y + point2.Y) / 2;
            double  MarginRight  = point2.X > point1.X ? point2.X - MarginLeft - 12 : point1.X - MarginLeft - 12;
            double  MarginBottom = point2.Y > point1.Y ? point2.Y - MarginTop - 18 : point1.Y - MarginTop - 18;
            TextBox textBox      = UICreator.CreateTextBox(new Thickness(MarginLeft, MarginTop, MarginRight, MarginBottom));

            textBox.KeyUp += TextboxHandler;
            Grid    grid    = new Grid();
            Viewbox viewbox = UICreator.CreateViewBox($"edge " +
                                                      $"{ExtractElementFromViewBox<TextBlock>(ViewBox1).Text} " +
                                                      $"{ExtractElementFromViewBox<TextBlock>(ViewBox2).Text}");

            viewbox.MouseLeftButtonUp += MouseEvent;
            grid.Children.Add(line);
            grid.Children.Add(textBox);
            viewbox.Child = grid;
            Canvas.Children.Add(viewbox);
            textBox.SelectionStart = textBox.Text.Length;
            textBox.Focus();
        }