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

            if (radioButton1.Checked == true)
            {
                food = Flapjack.Chrupioncego;
            }
            else if (radioButton2.Checked == true)
            {
                food = Flapjack.Wilgotnego;
            }
            else if (radioButton3.Checked == true)
            {
                food = Flapjack.Rumianego;
            }
            else
            {
                food = Flapjack.Bananowego;
            }

            Lumberjack currentLumberjack = breakfastLine.Peek();

            currentLumberjack.TakeFlapjacks(food, (int)howMany.Value);
            RedrawList();
        }
Exemplo n.º 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (breakfastLine.Count == 0)
            {
                return;
            }
            Lumberjack nextLumberjack = breakfastLine.Dequeue();

            nextLumberjack.EatFlapjacks();
            nextInLine.Text = "";
            RedrawList();
        }
Exemplo n.º 3
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;
                nextInLine.Text   = "";
            }
            else
            {
                groupBox1.Enabled = true;
                Lumberjack currentLumberjack = breakfastLine.Peek();
                nextInLine.Text = currentLumberjack.Name + " ma " + currentLumberjack.FlapjackCount + " naleśniki";
            }
        }