コード例 #1
0
        private void Btn_4x4_Hard_Click(object sender, RoutedEventArgs e)
        {
            Puzzles_Repository_4x4 Puzzles_4x4 = new Puzzles_Repository_4x4();

            new Button();
            Button Btn = (Button)sender;

            int index;

            for (index = 0; index < Puzzles_4x4.Puzzles_4x4_Hard.ListPuzzles.Count(); index++)
            {
                if (Btn.Content.ToString() == "Grid " + (index + 1).ToString())
                {
                    Play(2, 2, Puzzles_4x4.Puzzles_4x4_Hard.ListPuzzles[index]);
                }
            }
        }
コード例 #2
0
        private void Window_4x4(object sender, RoutedEventArgs e)
        {
            int index;
            int jndex;

            Puzzles_Repository_4x4 Puzzles_4x4 = new Puzzles_Repository_4x4();

            Window Wind_4x4 = new Window();

            Grid Grids_4x4 = new Grid();

            Wind_4x4.Content = Grids_4x4;

            for (index = 0; index < 3; index++)
            {
                RowDefinition Row = new RowDefinition();
                Grids_4x4.RowDefinitions.Add(Row);

                StackPanel StackP = new StackPanel();
                Grids_4x4.Children.Add(StackP);

                Grid.SetRow(StackP, index);

                WrapPanel WrapP = new WrapPanel();

                Label Lab = new Label
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    VerticalAlignment   = VerticalAlignment.Stretch,
                    FontSize            = 25
                };

                StackP.Children.Add(Lab);
                StackP.Children.Add(WrapP);

                switch (index)
                {
                case 0:
                    Lab.Content = "Easy";

                    for (jndex = 0; jndex < Puzzles_4x4.Puzzles_4x4_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_4x4_Easy_Click;
                    }

                    break;

                case 1:
                    Lab.Content = "Medium";

                    for (jndex = 0; jndex < Puzzles_4x4.Puzzles_4x4_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_4x4_Medium_Click;
                    }

                    break;

                case 2:
                    Lab.Content = "Hard";


                    for (jndex = 0; jndex < Puzzles_4x4.Puzzles_4x4_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_4x4_Hard_Click;
                    }

                    break;
                }
            }

            Wind_4x4.Show();
        }