public TestView() { InitializeComponent(); if (!DesignMode.IsInDesignModeStatic) { int i; // Add textures to Canvas ITextureManager textures = TextureManager.TextureManager.Instance; // Special textures i = 0; foreach (Specials special in EnumHelper.GetSpecials(available => available)) { // Brush bigBrush = textures.GetBigSpecial(special); Rectangle bigRectangle = new Rectangle { Width = 16, Height = 16, Fill = bigBrush, }; Canvas.Children.Add(bigRectangle); Canvas.SetLeft(bigRectangle, 5 + i * (16 + 5)); Canvas.SetTop(bigRectangle, 5); // Brush smallBrush = textures.GetSmallSpecial(special); Rectangle smallRectangle = new Rectangle { Width = 8, Height = 8, Fill = smallBrush, }; Canvas.Children.Add(smallRectangle); Canvas.SetLeft(smallRectangle, 5 + i * (8 + 5)); Canvas.SetTop(smallRectangle, 30); // i++; } // Pieces textures i = 0; foreach (Pieces piece in EnumHelper.GetPieces(available => available)) { // Brush bigBrush = textures.GetBigPiece(piece); Rectangle bigRectangle = new Rectangle { Width = 16, Height = 16, Fill = bigBrush, }; Canvas.Children.Add(bigRectangle); Canvas.SetLeft(bigRectangle, 5 + i * (16 + 5)); Canvas.SetTop(bigRectangle, 50); // Brush smallBrush = textures.GetSmallPiece(piece); Rectangle smallRectangle = new Rectangle { Width = 8, Height = 8, Fill = smallBrush, }; Canvas.Children.Add(smallRectangle); Canvas.SetLeft(smallRectangle, 5 + i * (8 + 5)); Canvas.SetTop(smallRectangle, 75); // i++; } // Draw pieces i = 0; foreach (IPiece piece in EnumHelper.GetPieces(available => available).Select(piece => Piece.CreatePiece(piece, 0, 0, 1, 0, false))) { for (int r = 1; r <= piece.MaxOrientations; r++) { DrawPiece(piece, 8, 5 + r * (8 * 4), 120 + i * (8 * 4)); piece.RotateCounterClockwise(); } // i++; } // Draw mutated pieces i = 0; foreach (IPiece piece in EnumHelper.GetPieces(available => available).Select(piece => Piece.CreatePiece(piece, 0, 0, 1, 0, true))) { for (int r = 1; r <= piece.MaxOrientations; r++) { DrawPiece(piece, 8, 200 + r * (8 * 4), 120 + i * (8 * 4)); piece.RotateCounterClockwise(); } // i++; } } }