Example #1
0
        //check selection and flapjack to lumbjack at the front of the queue
        //add food to stack
        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.Crispy;
            }
            else if (browned.Checked == true)
            {
                food = Flapjack.Browned;
            }
            else
            {
                food = Flapjack.Banana;
            }

            Lumberjack currentLumberjack = breakfastLine.Peek();

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

            RedrawList();
        }
Example #2
0
        //add the lumberjacks to the list box in order of queue
        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;
                nextLumberjack.Text = "";
            }
            else
            {
                //peek at who is at the front of the que and add to textbox
                groupBox1.Enabled = true;
                Lumberjack currentLumberJack = breakfastLine.Peek();
                textBox1.Text = currentLumberJack.Name + " has "
                                + currentLumberJack.FlapjackCount + " flapjacks";
            }
        }
Example #3
0
        //take the next in line lumber jack of the list and move everyone else up one
        private void nextLumberjack_Click(object sender, EventArgs e)
        {
            if (breakfastLine.Count == 0)
            {
                return;
            }
            Lumberjack nextLumberjack = breakfastLine.Dequeue();

            nextLumberjack.EatFlapjacks();
            line.Text = "";
            RedrawList();
        }
Example #4
0
        static void Main(string[] args)
        {
            ConfigHelper.ReadConfig();
            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Verbose()
                         .WriteTo.RollingFile(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Lumberjack",
                                                           "{Date}-lumberjack.log"))
                         .WriteTo.ColoredConsole()
                         .CreateLogger();

            Log.Verbose("Starting lumberjack");

            var app = new Lumberjack();

            app.Process();
        }
Example #5
0
 private void button1AddLumberjack_Click(object sender, EventArgs e)
 {
     currentLumberjack = new Lumberjack(textBox1LumberjackName.Text);
     breakfastLine.Enqueue(currentLumberjack);
     RedrawForm(lineDescription(breakfastLine));
 }