Ejemplo n.º 1
0
    void OnChanged(object sender, EventArgs e)
    {
        CheckBox clickedButton = sender as CheckBox;

        if (clickedButton == null) // just to be on the safe side
        {
            return;
        }

        //Cancel closes the window
        if (cancel.Checked)
        {
            Close();
        }
        //OK sends the information
        else if (ok.Checked)
        {
            //Sending information to the next form,
            //that saves and gives away it.
            MatrixType        matrix        = MatrixType.RANDOM;
            NeighbourhoodType neighbourhood = NeighbourhoodType.CONWAY;

            if (pointRb.Checked)
            {
                matrix = MatrixType.ONE_POINT;
            }
            else if (randomRb.Checked)
            {
                matrix = MatrixType.RANDOM;
            }
            if (ulamRb.Checked)
            {
                neighbourhood = NeighbourhoodType.ULAM;
            }
            else if (conwayRb.Checked)
            {
                neighbourhood = NeighbourhoodType.CONWAY;
            }
            else if (knightRb.Checked)
            {
                neighbourhood = NeighbourhoodType.KNIGHT;
            }
            else if (greatConwayRb.Checked)
            {
                neighbourhood = NeighbourhoodType.GREAT_CONWAY;
            }
            else if (obliqueRb.Checked)
            {
                neighbourhood = NeighbourhoodType.OBLIQUE;
            }

            if (mesh == MeshType.SQUARE)
            {
                cancel.BackColor = Color.Red;
            }
            cancel.Show();
            cancel.Visible = true;
            //Constructs the window for RuleSettings
            RuleSettings rules = new RuleSettings(matrix, neighbourhood, mesh);
            rules.ShowDialog();
            this.Visible = false;
            this.Hide();
            this.Dispose();
        }
    }
Ejemplo n.º 2
0
    void OnChanged(object sender, EventArgs e)
    {
        CheckBox clickedButton = sender as CheckBox;

        //CheckBox clickedButton = (CheckBox)sender;
        if (clickedButton == null) // just to be on the safe side
        {
            return;
        }

        //Cancel closes the window
        if (cancel.Checked)
        {
            Close();
        }
        //OK sends the information
        else if (ok.Checked)
        {
            //Sending information to the next form,
            //that saves and gives away it.
            MatrixType        matrix        = MatrixType.RANDOM;
            NeighbourhoodType neighbourhood = NeighbourhoodType.CONWAY;
            MeshType          mesh          = MeshType.SQUARE;

            if (pointRb.Checked)
            {
                matrix = MatrixType.ONE_POINT;
            }
            else if (randomRb.Checked)
            {
                matrix = MatrixType.RANDOM;
            }
            if (ulamRb.Checked)
            {
                neighbourhood = NeighbourhoodType.ULAM;
            }
            else if (conwayRb.Checked)
            {
                neighbourhood = NeighbourhoodType.CONWAY;
            }
            else if (knightRb.Checked)
            {
                neighbourhood = NeighbourhoodType.KNIGHT;
            }
            if (squareRb.Checked)
            {
                mesh = MeshType.SQUARE;
            }
            else if (triangleRb.Checked)
            {
                mesh = MeshType.TRIANGLE;
            }
            else if (hexagonRb.Checked)
            {
                mesh = MeshType.HEXAGON;
            }

            RuleSettings rules = new RuleSettings(matrix, neighbourhood, mesh);
            rules.ShowDialog();
            this.Visible = false;
            this.Hide();
            this.Dispose();
        }


        // Ha az előbbiek felsorolási típusok lesznek, akkor itt konstruáljuk meg
        // az él-hal szabály párbeszédablakát
    }