private void Btn_6x6_Hard_Click(object sender, RoutedEventArgs e) { Puzzles_Repository_6x6 Puzzles_6x6 = new Puzzles_Repository_6x6(); new Button(); Button Btn = (Button)sender; int index; for (index = 0; index < Puzzles_6x6.Puzzles_6x6_Hard.ListPuzzles.Count(); index++) { if (Btn.Content.ToString() == "Grid " + (index + 1).ToString()) { Play(2, 3, Puzzles_6x6.Puzzles_6x6_Hard.ListPuzzles[index]); } } }
private void Window_6x6(object sender, RoutedEventArgs e) { int index; int jndex; //Window 6x6 Puzzles_Repository_6x6 Puzzles_6x6 = new Puzzles_Repository_6x6(); // Window Wind_4x4 = new Window(); Window Wind_6x6 = new Window(); Grid Grids_6x6 = new Grid(); Wind_6x6.Content = Grids_6x6; for (index = 0; index < 3; index++) { RowDefinition Row = new RowDefinition(); Grids_6x6.RowDefinitions.Add(Row); StackPanel StackP = new StackPanel(); Grids_6x6.Children.Add(StackP); Grid.SetRow(StackP, index); WrapPanel WrapP = new WrapPanel(); Label Lab = new Label { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, FontSize = 30 }; StackP.Children.Add(Lab); StackP.Children.Add(WrapP); switch (index) { case 0: Lab.Content = "Easy"; for (jndex = 0; jndex < Puzzles_6x6.Puzzles_6x6_Easy.ListPuzzles.Count; jndex++) { Button Btn_Easy = new Button { Content = "Grid " + (jndex + 1).ToString(), FontSize = 30, Margin = new Thickness(30), Padding = new Thickness(5) }; WrapP.Children.Add(Btn_Easy); Btn_Easy.Click += Btn_6x6_Easy_Click; } break; case 1: Lab.Content = "Medium"; for (jndex = 0; jndex < Puzzles_6x6.Puzzles_6x6_Medium.ListPuzzles.Count; jndex++) { Button Btn_Medium = new Button { Content = "Grid " + (jndex + 1).ToString(), FontSize = 30, Margin = new Thickness(30), Padding = new Thickness(5) }; WrapP.Children.Add(Btn_Medium); Btn_Medium.Click += Btn_6x6_Medium_Click; } break; case 2: Lab.Content = "Hard"; for (jndex = 0; jndex < Puzzles_6x6.Puzzles_6x6_Hard.ListPuzzles.Count; jndex++) { Button Btn_Hard = new Button { Content = "Grid " + (jndex + 1).ToString(), FontSize = 30, Margin = new Thickness(30), Padding = new Thickness(5) }; WrapP.Children.Add(Btn_Hard); Btn_Hard.Click += Btn_6x6_Hard_Click; } break; } } Wind_6x6.Show(); }