Пример #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();
        }
Пример #2
0
 private void addLumberjack_Click(object sender, EventArgs e)
 {
     if (name.Text != "")
     {
         Lumberjack newGuy = new Lumberjack(name.Text);
         breakfastLine.Enqueue(newGuy);
         RedrawList();
     }
 }
Пример #3
0
 private void nextLumberjack_Click(object sender, EventArgs e)
 {
     if (breakfastLine.Count > 0)
     {
         Lumberjack current = breakfastLine.Peek();
         if (current.FlapjackCount > 0)
         {
             current.EatFlapjacks();
             breakfastLine.Dequeue();
             RedrawList();
         }
         else
         {
             MessageBox.Show(current.Name + "did not eat anything");
         }
     }
 }
Пример #4
0
 public void RedrawList()
 {
     line.Items.Clear();
     if (breakfastLine.Count > 0)
     {
         foreach (Lumberjack item in breakfastLine)
         {
             line.Items.Add(item.Name);
         }
         Lumberjack current = breakfastLine.Peek();
         nameFlapjack.Text = current.Name + "'s eating " + current.FlapjackCount + " flapjacks";
     }
     else
     {
         nameFlapjack.Text = "";
     }
 }