Esempio n. 1
0
        private void btnNewGame_Click(object sender, EventArgs e)
        {
            var result = MessageBox.Show("Are you sure you would like to start a new game?",
                                         "New Game", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

            if (result == DialogResult.OK)
            {
                UIHelpers.CloseOpenWindows();

                UIHelpers.ClearControls(this.Controls);
                _pencilMarks = new Canidates();
                _setup       = new ControlLogic.SetupPuzzle(_difficultySelection);
                _setup.UpdateCanidates();

                puzzleReady          = false;
                _difficultySelection = cmboxDifficulty.SelectedIndex;
                _userAnswers         = new PuzzleNine(1);

                fillSetupPuzzle();

                puzzleReady = true;

                _userAnswers.ResetCoordinates();
                combineTruthSetupAndUsers();

                toolStrip.Text = "Good luck and have fun!";
            }
        }
Esempio n. 2
0
        private void loadGameToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (puzzleLoadFlag)
            {
                if (MessageBox.Show("This will overwrite any unsaved data.\n\nContinue?",
                                    "Reload Data.",
                                    MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    return;
                }
            }

            puzzleReady = false;

            UIHelpers.CloseOpenWindows();

            UIHelpers.ClearControls(this.Controls);
            _pencilMarks = new Canidates();

            try
            {
                _userAnswers   = _setup.LoadSavedPuzzle();
                puzzleLoadFlag = true;
                _pencilMarks.LoadPencilMarks();
                fillSetupPuzzle();

                _userAnswers.ResetCoordinates();
                fillUserAnswers();
                combineTruthSetupAndUsers();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Can't load a previously saved puzzle.\nThis may be because it is the first time loading."
                                + ex.Message + "\n\n" + ex.InnerException.Message);
                btnNewGame_Click(sender, e);
            }

            puzzleReady = true;

            toolStrip.Text = "Good luck and have fun!";
        }