Ejemplo n.º 1
0
        private void addFlapjacks_Click(object sender, EventArgs e)
        {
            if (breakfastLine.Count == 0)
            {
                return;
            }
            Flapjack food;

            if (crispy.Checked)
            {
                food = Flapjack.Crispy;
            }
            else if (soggy.Checked)
            {
                food = Flapjack.Soggy;
            }
            else if (browned.Checked)
            {
                food = Flapjack.Browned;
            }
            else
            {
                food = Flapjack.Banana;
            }

            Lumberjack currentLumberjack = breakfastLine.Peek();

            currentLumberjack.TakeFlapjacks(food, (int)howMany.Value);

            RedrawList();
        }
        private void addFlapjacks_Click(object sender, RoutedEventArgs e)
        {
            if (breakfastLine.Count == 0)
            {
                return;
            }
            Flapjack food      = Flapjack.None;
            string   selection = flapJackOrder.SelectionBoxItem.ToString();

            if (selection == "Crispy")
            {
                food = Flapjack.Crispy;
            }
            else if (selection == "Checked")
            {
                food = Flapjack.Soggy;
            }
            else if (selection == "Browned")
            {
                food = Flapjack.Browned;
            }
            else if (selection == "Banana")
            {
                food = Flapjack.Banana;
            }

            if (food != Flapjack.None)
            {
                Lumberjack currentLumberjack = breakfastLine.Peek();
                int        howManyNumber;
                if (int.TryParse(howMany.Text, out howManyNumber))
                {
                    currentLumberjack.TakeFlapjacks(food, howManyNumber);
                }

                RedrawList();
            }
        }