예제 #1
0
        private void addFlapjacksButton_Click(object sender, EventArgs e)
        {
            if (line.Count == 0)
            {
                return;
            }

            Classes.Flapjack food;

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

            Classes.Lumberjack currentLumberjack = line.Peek();
            currentLumberjack.TakeFlapjacks(food, (int)howMany.Value);
            RedrawList();
        }
예제 #2
0
        private void RedrawList()
        {
            Line.Items.Clear();

            int number = 1;

            foreach (Classes.Lumberjack lumberjack in line)
            {
                Line.Items.Add(number + ". " + lumberjack.Name);
                number++;
            }
            if (line.Count > 0)
            {
                Classes.Lumberjack currentClient = line.Peek();

                listLamberjacks.Text = currentClient.Name + " has " + currentClient.FlapjackCount +
                                       " flapjacks. \r\n";
            }
            else
            {
                listLamberjacks.Text = "";
            }
        }