Example #1
0
        private void ResizeDone(object sender, EventArgs e)
        {
            if (sender == okButton)
            {
                int rows;
                int.TryParse(rowBox.Text, out rows);

                int cols;
                int.TryParse(colBox.Text, out cols);

                int time;
                int.TryParse(timeBox.Text, out time);

                if (rows > 1 && cols > 1 && rows < 9 && cols < 9 && time > 0)
                {
                    puzzleForm.Rows      = rows;
                    puzzleForm.Cols      = cols;
                    puzzleForm.TimeLimit = time;

                    puzzleForm.SetBackgroundImage();
                    Hide();
                }
                else
                {
                    MessageBox.Show("Rows and columns must be between 2 and 8. Time must be greater than 0.", "Invalid Entry");
                }
            }
            else
            {
                rowBox.Text  = puzzleForm.Rows.ToString();
                colBox.Text  = puzzleForm.Cols.ToString();
                timeBox.Text = puzzleForm.TimeLimit.ToString();
                Hide();
            }
        }