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

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

            Lumberjack currentLumberjack = breakfastLine.Peek();

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

            RedrawList();
        }
Esempio n. 2
0
        private void nextLumberjack_Click(object sender, EventArgs e)
        {
            if (breakfastLine.Count == 0)
            {
                return;
            }
            Lumberjack nextLumberjack = breakfastLine.Dequeue();

            nextLumberjack.EatFlapjacks();
            nextInLine.Text = "";
            RedrawList();
        }
Esempio n. 3
0
        private void RedrawList()
        {
            int lineOrder = 1;

            line.Items.Clear();

            foreach (Lumberjack lumberjack in breakfastLine)
            {
                line.Items.Add($"{lineOrder}. {lumberjack.Name}");
                lineOrder++;
            }

            if (breakfastLine.Count == 0)
            {
                groupBox1.Enabled = false;
                nextInLine.Text   = "";
            }
            else
            {
                groupBox1.Enabled = true;
                Lumberjack currentLumberjack = breakfastLine.Peek();
                nextInLine.Text = $"{currentLumberjack.Name} has {currentLumberjack.FlapjackCount} flapjacks";
            }
        }