예제 #1
0
        private void cboSquare_SelectedIndexChanged(object sender, EventArgs e)
        {
            var  cbo     = sender as ComboBox;
            int  square  = 0;
            int  val     = 0;
            bool success = false;

            try {
                square = (int)cbo.Tag;
                val    = (int)cbo.SelectedItem;
                if (_cactpot.ChoicesRemaining == 0 && _cactpot.IsUnchosenSquare(square))
                {
                    MessageBox.Show("No choices remaining!");
                    cbo.SelectedIndex = 0;
                    return;
                }
                success = true;
            } catch (Exception) { }
            // Display the values of choices
            if (success)
            {
                _cactpot.Choose(square, val);
                HighlightMaxChoice();
            }
            // Display line values if no choices left
            if (_cactpot.ChoicesRemaining == 0)
            {
                HighlightMaxLine();
            }
        }