public bool IsValid(IGame game)
        {
            if (choice == null)
            {
                return(true);
            }

            return(choice.IsValid(game));
        }
        private void submitButton_Click(object sender, RoutedEventArgs e)
        {
            if (choice == null)
            {
                return;
            }

            if (!choice.IsValid(game))
            {
                MessageBox.Show("Please choose an answer and then try submitting again", "This choice is not valid");
                statusText.Text = "This choice is not valid";
                return;
            }

            isValid = true;
        }
Ejemplo n.º 3
0
        private static void OfferChoiceCallback(IEffect effect, IChoice choice)
        {
            try
            {
                if (choice == null)
                {
                    throw new ArgumentNullException("choice");
                }

                var isValid = false;

                while (!isValid)
                {
                    HandleChoice(choice);
                    isValid = choice.IsValid(game);
                }
            }
            catch (Exception ex)
            {
                WriteLine("Error in offer choice callback: {0}\r\n{1}", ex.Message, ex.StackTrace);
            }
        }