private void filling_the_board() { int s = 50; double x = 0.0; int f = -1; NEW: f++; if (f == 8) { x = x + 50; s = 50; } if (f == 16) { x = x + 50; s = 50; } if (f == 24) { x = x + 50; s = 50; } if (f == 32) { x = x + 50; s = 50; } if (f == 40) { x = x + 50; s = 50; } if (f == 48) { x = x + 50; s = 50; } if (f == 56) { x = x + 50; s = 50; } if (f >= 64) { goto Exit; } Storyboard down = new Storyboard(); DoubleAnimation doubleAnimation = new DoubleAnimation(); doubleAnimation.To = game_board.Height - s; doubleAnimation.Duration = TimeSpan.FromSeconds(0.5); Random r = new Random(f + Environment.TickCount - Environment.ProcessorCount - (int)x); switch (r.Next(1, 16)) { case 1: cercle cer = new cercle(); cer.SetValue(Canvas.LeftProperty, x); cer.SetValue(Canvas.TopProperty, (double)s); game_board.Children.Add(cer); Storyboard.SetTarget(doubleAnimation, cer); Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath("(Canvas.Top)")); down.Children.Add(doubleAnimation); down.Duration = doubleAnimation.Duration; cer.CordinateX = Canvas.GetLeft(cer); cer.CordinateY = Canvas.GetTop(cer); cer.MouseDown += Cer_MouseDown; down.Begin(); s = s + 50; goto NEW; case 9: goto case 1; case 11: goto case 1; case 2: hexagon hex = new hexagon(); hex.SetValue(Canvas.LeftProperty, x); hex.SetValue(Canvas.TopProperty, (double)s); game_board.Children.Add(hex); Storyboard.SetTarget(doubleAnimation, hex); Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath("(Canvas.Top)")); down.Children.Add(doubleAnimation); down.Duration = doubleAnimation.Duration; hex.CordinateX = Canvas.GetLeft(hex); hex.CordinateY = Canvas.GetTop(hex); hex.MouseDown += Hex_MouseDown; down.Begin(); s = s + 50; goto NEW; case 7: goto case 2; case 15: goto case 2; case 3: pentahedron pent = new pentahedron(); pent.SetValue(Canvas.LeftProperty, x); pent.SetValue(Canvas.TopProperty, (double)s); game_board.Children.Add(pent); Storyboard.SetTarget(doubleAnimation, pent); Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath("(Canvas.Top)")); down.Children.Add(doubleAnimation); down.Duration = doubleAnimation.Duration; pent.CordinateX = Canvas.GetLeft(pent); pent.CordinateY = Canvas.GetTop(pent); pent.MouseDown += Pent_MouseDown; down.Begin(); s = s + 50; goto NEW; case 6: goto case 3; case 10: goto case 3; case 4: square squ = new square(); squ.SetValue(Canvas.LeftProperty, x); squ.SetValue(Canvas.TopProperty, (double)s); game_board.Children.Add(squ); Storyboard.SetTarget(doubleAnimation, squ); Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath("(Canvas.Top)")); down.Children.Add(doubleAnimation); down.Duration = doubleAnimation.Duration; squ.CordinateX = Canvas.GetLeft(squ); squ.CordinateY = Canvas.GetTop(squ); squ.MouseDown += Squ_MouseDown; down.Begin(); s = s + 50; goto NEW; case 8: goto case 4; case 13: goto case 4; case 5: triangle tri = new triangle(); tri.SetValue(Canvas.LeftProperty, x); tri.SetValue(Canvas.TopProperty, (double)s); game_board.Children.Add(tri); Storyboard.SetTarget(doubleAnimation, tri); Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath("(Canvas.Top)")); down.Children.Add(doubleAnimation); down.Duration = doubleAnimation.Duration; tri.CordinateX = Canvas.GetLeft(tri); tri.CordinateY = Canvas.GetTop(tri); tri.MouseDown += Tri_MouseDown; down.Begin(); s = s + 50; goto NEW; case 14: goto case 5; case 12: goto case 5; } Exit: ; }