예제 #1
0
        private void addFlapjacks_Click(object sender, EventArgs e)
        {
            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();
        }
예제 #2
0
        private void RedrawList()
        {
            int number = 1;

            line.Items.Clear();
            foreach (Lumberjack lumberjack in breakfastLine)
            {
                line.Items.Add(number + ". " + lumberjack.Name);
                number++;
            }
            if (breakfastLine.Count == 0)
            {
                groupBox1.Enabled      = false;
                nextLine.Text          = "";
                nextLumberjack.Enabled = false;
            }
            else
            {
                groupBox1.Enabled = true;
                Lumberjack currentLumberjack = breakfastLine.Peek();
                nextLine.Text = currentLumberjack.Name + " has " +
                                currentLumberjack.FlapjackCount + " flapjacks";
                nextLumberjack.Enabled = true;
            }
        }
예제 #3
0
        private void nextLumberjack_Click(object sender, EventArgs e)
        {
            Lumberjack NextLumberjack = breakfastLine.Dequeue();

            NextLumberjack.EatFlapjacks();
            nextLine.Text = "";
            RedrawList();
        }