private void Btn_9x9_Diabolic_Click(object sender, RoutedEventArgs e) { Puzzles_Repository_9x9 Puzzles_9x9 = new Puzzles_Repository_9x9(); new Button(); Button Btn = (Button)sender; int index; for (index = 0; index < Puzzles_9x9.Puzzles_9x9_Diabolic.ListPuzzles.Count(); index++) { if (Btn.Content.ToString() == "Grid " + (index + 1).ToString()) { Play(3, 3, Puzzles_9x9.Puzzles_9x9_Diabolic.ListPuzzles[index]); } } }
private void Window_9x9(object sender, RoutedEventArgs e) { int index; int jndex; //Window 9x9 Puzzles_Repository_9x9 Puzzles_9x9 = new Puzzles_Repository_9x9(); // Window Wind_9x9 = new Window(); Window Wind_9x9 = new Window(); Grid Grids_9x9 = new Grid(); Wind_9x9.Content = Grids_9x9; for (index = 0; index < 5; index++) { RowDefinition Row = new RowDefinition(); Grids_9x9.RowDefinitions.Add(Row); StackPanel StackP = new StackPanel(); Grids_9x9.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_9x9.Puzzles_9x9_Easy.ListPuzzles.Count; jndex++) { Button Btn_Easy = new Button { Content = "Grid " + (jndex + 1).ToString(), FontSize = 15, Margin = new Thickness(30, 5, 30, 30), Padding = new Thickness(5) }; WrapP.Children.Add(Btn_Easy); Btn_Easy.Click += Btn_9x9_Easy_Click; } break; case 1: Lab.Content = "Medium"; for (jndex = 0; jndex < Puzzles_9x9.Puzzles_9x9_Medium.ListPuzzles.Count; jndex++) { Button Btn_Medium = new Button { Content = "Grid " + (jndex + 1).ToString(), FontSize = 15, Margin = new Thickness(30, 5, 30, 30), Padding = new Thickness(5) }; WrapP.Children.Add(Btn_Medium); Btn_Medium.Click += Btn_9x9_Medium_Click; } break; case 2: Lab.Content = "Hard"; for (jndex = 0; jndex < Puzzles_9x9.Puzzles_9x9_Hard.ListPuzzles.Count; jndex++) { Button Btn_Hard = new Button { Content = "Grid " + (jndex + 1).ToString(), FontSize = 15, Margin = new Thickness(30, 5, 30, 30), Padding = new Thickness(5) }; WrapP.Children.Add(Btn_Hard); Btn_Hard.Click += Btn_9x9_Hard_Click; } break; case 3: Lab.Content = "Expert"; for (jndex = 0; jndex < Puzzles_9x9.Puzzles_9x9_Expert.ListPuzzles.Count; jndex++) { Button Btn_Expert = new Button { Content = "Grid " + (jndex + 1).ToString(), FontSize = 15, Margin = new Thickness(30, 5, 30, 30), Padding = new Thickness(5) }; WrapP.Children.Add(Btn_Expert); Btn_Expert.Click += Btn_9x9_Expert_Click; } break; case 4: Lab.Content = "Diablolic"; for (jndex = 0; jndex < Puzzles_9x9.Puzzles_9x9_Diabolic.ListPuzzles.Count; jndex++) { Button Btn_Diabolic = new Button { Content = "Grid " + (jndex + 1).ToString(), FontSize = 15, Margin = new Thickness(30, 5, 30, 30), Padding = new Thickness(5) }; WrapP.Children.Add(Btn_Diabolic); Btn_Diabolic.Click += Btn_9x9_Diabolic_Click; } break; } } Wind_9x9.Show(); }