Beispiel #1
0
        public void Execute(InitSmokerCommand command)
        {
            var smoker = new Smoker(command.LimitPerDay, TimeSpan.FromHours(command.IntervalHour));

            Console.WriteLine($"smoker id: {smoker.AggregateID}");
            this.repository.Put(smoker);
        }
Beispiel #2
0
        public void Transaction(Smoker s)
        {
            Thread transaction = Thread.CurrentThread;

            Random random = new Random();
            int time = random.Next(1500, 3001);
            Console.WriteLine("Transakcja dostawcy " + name + " z palaczem " + s.name + " będzie trwała " + time / 1000.00f + " sekund");
            Thread.Sleep(time);
            Console.WriteLine("Koniec transakcji dostawcy " + name + " z palaczem " + s.name);
        }
Beispiel #3
0
        private static void CreateClient(int counter, List<Provider> providers)
        {
            Smoker smoker = new Smoker(counter, providers);
            if (smoker.tobacco)
                Console.WriteLine("Przybył palacz " + smoker.name + " i posiada tytoń");
            else if(smoker.papers)
                Console.WriteLine("Przybył palacz " + smoker.name + " i posiada bibułki");
            else
                Console.WriteLine("Przybył palacz " + smoker.name + " i posiada zapałki");

            smoker.CheckProviders();
        }
Beispiel #4
0
 private static void smoker(string who, Smoker sm)
 {
     while (true)
     {
         Funcs.Delay();
         Funcs.Output(who + " wants");
         sm.wants();
         Funcs.Output(who + " smokes");
         Funcs.Delay();
         Funcs.Output(who + " done");
         sm.done();
     }
 }
Beispiel #5
0
 public void SmokerLeaves(Smoker s)
 {
     Console.WriteLine("Palacz " + s.name + " wychodzi");
     s = null;
 }
Beispiel #6
0
        private void bttnResults_Click(object sender, EventArgs e)
        {
            if (rdoBttnDeepFryer.Checked)
            {
                // Gets all the info from the class
                DeepFryer newDeepFryer = new DeepFryer(cbxColor.SelectedItem.ToString(), txtBoxMaterial.Text, cbxBrand.SelectedItem.ToString(),
                                                       int.Parse(txtBoxMaxTemp.Text), cbxFuleType.SelectedItem.ToString(), int.Parse(txtBoxInventory.Text), int.Parse(txtBoxFirstInput.Text),
                                                       int.Parse(txtBoxSecondInput.Text));

                // Changes the text of the label
                lblResults.Text = string.Format("Brand and Material: {0}, {1}\nMax Cooking Temp: {2} degrees\nColor: {3}\nTotal Inventory: {4}", newDeepFryer.brand,
                                                newDeepFryer.material, newDeepFryer.maxTemp, newDeepFryer.color, newDeepFryer.CalInvenotry());

                // Makes one button and two labels visible again
                bttnClose.Visible     = true;
                lblEndResults.Visible = true;
                lblResults.Visible    = true;
                // Makes one button invisible
                bttnResults.Visible = false;
            }
            else if (rdoBttnGasGrill.Checked)
            {
                // Gets all the info from the class
                GasGrill newGasGrill = new GasGrill(cbxColor.SelectedItem.ToString(), txtBoxMaterial.Text, cbxBrand.SelectedItem.ToString(),
                                                    int.Parse(txtBoxMaxTemp.Text), cbxFuleType.SelectedItem.ToString(), int.Parse(txtBoxInventory.Text), int.Parse(txtBoxFirstInput.Text),
                                                    txtBoxSecondInput.Text);

                // Changes the text of the label
                lblResults.Text = string.Format("Brand and Material: {0}, {1}\nMax Cooking Temp: {2} degrees\nColor: {3}\nTotal Inventory: {4}", newGasGrill.brand,
                                                newGasGrill.material, newGasGrill.maxTemp, newGasGrill.color, newGasGrill.CalInvenotry());

                // Makes one button and two labels visible again
                bttnClose.Visible     = true;
                lblEndResults.Visible = true;
                lblResults.Visible    = true;
                // Makes one button invisible
                bttnResults.Visible = false;
            }
            else if (rdoBttnPatioStove.Checked)
            {
                // Gets all the info from the class
                PatioStove newPatioStove = new PatioStove(cbxColor.SelectedItem.ToString(), txtBoxMaterial.Text, cbxBrand.SelectedItem.ToString(),
                                                          int.Parse(txtBoxMaxTemp.Text), cbxFuleType.SelectedItem.ToString(), int.Parse(txtBoxInventory.Text), int.Parse(txtBoxFirstInput.Text),
                                                          txtBoxSecondInput.Text);

                // Changes the text of the label
                lblResults.Text = string.Format("Brand and Material: {0}, {1}\nMax Cooking Temp: {2} degrees\nColor: {3}\nTotal Inventory: {4}", newPatioStove.brand,
                                                newPatioStove.material, newPatioStove.maxTemp, newPatioStove.color, newPatioStove.CalInvenotry());

                // Makes one button and two labels visible again
                bttnClose.Visible     = true;
                lblEndResults.Visible = true;
                lblResults.Visible    = true;
                // Makes one button invisible
                bttnResults.Visible = false;
            }
            else
            {
                // Gets all the info from the class
                Smoker newSmoker = new Smoker(cbxColor.SelectedItem.ToString(), txtBoxMaterial.Text, cbxBrand.SelectedItem.ToString(),
                                              int.Parse(txtBoxMaxTemp.Text), cbxFuleType.SelectedItem.ToString(), int.Parse(txtBoxInventory.Text), txtBoxSecondInput.Text);

                // Changes the text of the label
                lblResults.Text = string.Format("Brand and Material: {0}, {1}\nMax Cooking Temp: {2} degrees\nColor: {3}\nTotal Inventory: {4}", newSmoker.brand,
                                                newSmoker.material, newSmoker.maxTemp, newSmoker.color, newSmoker.CalInvenotry());

                // Makes one button and two labels visible again
                bttnClose.Visible     = true;
                lblEndResults.Visible = true;
                lblResults.Visible    = true;
                // Makes one button invisible
                bttnResults.Visible = false;
                // Makes a label and a txtBox invisible
                lblSecondInput.Visible    = false;
                txtBoxSecondInput.Visible = false;
            }
        }