Пример #1
0
        private void buttonAddFlapjacks_Click(object sender, EventArgs e)
        {
            if (LumberJackStack.Count == 0)
            {
                return;
            }
            Flapjack food;

            if (radioButtonCrispy.Checked)
            {
                food = Flapjack.Crispy;
            }
            else if (radioButtonSoggy.Checked)
            {
                food = Flapjack.Soggy;
            }
            else if (radioButtonBrowned.Checked)
            {
                food = Flapjack.Browned;
            }
            else
            {
                food = Flapjack.Banana;
            }

            Lumberjack currentLumberjack = LumberJackStack.Peek();

            currentLumberjack.TakeFlapjacks(food, (int)howMany.Value);
            textBoxNextInline.Text = currentLumberjack.Name + " has "
                                     + currentLumberjack.FlapjackCount + " flapjacks";
        }
Пример #2
0
        private void buttonLumberjack_Click(object sender, EventArgs e)
        {
            if (LumberJackStack.Count == 0)
            {
                Console.WriteLine("No lumberjack left!");
                return;
            }
            Lumberjack nextLumberjack = LumberJackStack.Dequeue();

            nextLumberjack.EatFlapjacks();
            textBoxNextInline.Text = "";
            UpdateView();
        }
Пример #3
0
        private void UpdateView()
        {
            line.Items.Clear();
            UInt16 i = 1;

            foreach (Lumberjack lumberjack in LumberJackStack)
            {
                line.Items.Add(i.ToString() + "." + lumberjack.Name + "\r\n");
                i++;
            }

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