private void PutLine(Unit u1, Unit u2, int nameIndex, int delay)
        {
            var width = u2.Position.X > u1.Position.X
                ? u2.Position.X - u1.Position.X + 10
                : u1.Position.X - u2.Position.X + 10;
            var height = u2.Position.Y - u1.Position.Y;

            var lineGrid = new Grid
            {
                Height = height,
                Width = width,
                Name = "GridLine" + nameIndex,
                Margin = new Thickness(
                    u1.Position.X < u2.Position.X 
                        ? u1.Position.X - 5 + WidthOfUnit * 0.5
                        : u2.Position.X - 5 + WidthOfUnit * 0.5,
                    u1.Position.Y + WidthOfUnit * 0.5, 0, 0),
                //Background = Brushes.Aqua,
                
            };

            // RegisterName(ellipseGrid.Name, ellipseGrid);
            Panel.SetZIndex(lineGrid, 0);

            var line = new Line()
            {
                X1 = u1.Position.X < u2.Position.X ? 0 : width-5,
                Y1 = 0,
                X2 = u1.Position.X > u2.Position.X ? 0 : width-5,
                Y2 = height,
                StrokeThickness = 2,
                Stroke = Brushes.Black,
            };
            
            Panel.SetZIndex(line, 0);

            var textBlock = new TextBlock
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                TextAlignment = TextAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                Background = Brushes.White,
                FontSize = 12,
                Text = delay.ToString(),
                Padding = new Thickness(2,2,2,2)
            };

            Panel.SetZIndex(textBlock, 1);
            lineGrid.Children.Add(line);
            lineGrid.Children.Add(textBlock);
            MyCanvas.Children.Add(lineGrid);
            
        }
        private Binding CreateBinding(Unit unit1, Unit unit2, int delay, int index)
        {
            PutLine(unit1, unit2, index, delay);

            var binding = new Binding()
            {
                Index = index,
                Delay = delay,
                Name = "",
                Units = new List<int>() { unit1.Index, unit2.Index },
            };

            return binding;
        }