Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            SingletonWriter singleton = SingletonWriter.GetInstance();

            singleton.SaveLogs((int)NumericTxt.Value, (int)NumericDataGrid.Value, (int)NumericTextBox.Value);
            this.Close();
        }
Exemplo n.º 2
0
 private void Simulation_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (ShowOrigin)
     {
         origin.Show();
     }
     SingletonWriter.GetInstance().Write("Simulation Finished");
 }
Exemplo n.º 3
0
 public static SingletonWriter GetInstance( )
 {
     if (Instance == null)
     {
         Instance = new SingletonWriter();
     }
     return(Instance);
 }
Exemplo n.º 4
0
        private void breadcount_ValueChanged(object sender, EventArgs e)
        {
            if ((int)breadcount.Value > bredcount)
            {
                SingletonWriter.GetInstance().Write("Added 1 Bread Truck");
            }
            else
            {
                SingletonWriter.GetInstance().Write("Removed 1 Bread Truck");
            }

            bredcount = (int)breadcount.Value;
        }
Exemplo n.º 5
0
        private void sodacount_ValueChanged(object sender, EventArgs e)
        {
            if ((int)sodacount.Value > sodcount)
            {
                SingletonWriter.GetInstance().Write("Added 1 Soda Truck");
            }
            else
            {
                SingletonWriter.GetInstance().Write("Removed 1 Soda Truck");
            }

            sodcount = (int)sodacount.Value;
        }
Exemplo n.º 6
0
        private void vegetablecount_ValueChanged(object sender, EventArgs e)
        {
            if ((int)vegetablecount.Value > vegcount)
            {
                SingletonWriter.GetInstance().Write("Added 1 Vegetable Truck");
            }
            else
            {
                SingletonWriter.GetInstance().Write("Removed 1 Vegetable Truck");
            }

            vegcount = (int)vegetablecount.Value;
        }
Exemplo n.º 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            Store captured = new Store();

            captured.StoreOrder = new Order();
            captured.StoreId    = Convert.ToInt32(idBox.Text);
            captured.StoreName  = nameBox.Text;
            if (ValidateProducts())
            {
                if (Convert.ToInt32(nvegBox.Text) > 0)
                {
                    Product veg = new Vegetable(Convert.ToInt32(nvegBox.Text), Convert.ToDouble(pvegBox.Text));
                    captured.StoreOrder.AddItems(veg);
                }
                if (Convert.ToInt32(nsodaBox.Text) > 0)
                {
                    Product soda = new Soda(Convert.ToInt32(nsodaBox.Text), Convert.ToDouble(psodaBox.Text));
                    captured.StoreOrder.AddItems(soda);
                }
                if (Convert.ToInt32(nbreadBox.Text) > 0)
                {
                    Product bread = new Bread(Convert.ToInt32(nbreadBox.Text), Convert.ToDouble(pbreadBox.Text));
                    captured.StoreOrder.AddItems(bread);
                }
                //StoreAdministrator.StoreListTomorrow.Add(captured);
                //log start of order
                SingletonWriter.GetInstance().Write("Order created from store:" + captured.StoreName);

                foreach (Product p in captured.StoreOrder.ListOfProducts())
                {
                    SingletonWriter.GetInstance().Write("Added " + p.quantity + " products with ID " + p.idProduct);
                }

                //log end of order
                SingletonWriter.GetInstance().Write("Order finalized ");

                //log image creation
                //adapter to create image from json
                ClientAPI adapter = new ClientAPI();
                Image     QR      = adapter.Encode(captured);
                string    path    = current.LastOrderPath;
                QR.Save(path);
                QR.Dispose();
                SingletonWriter.GetInstance().Write("Image from order created successfully");
                this.Close();
            }
            else
            {
                label10.Visible = true;
            }
        }
Exemplo n.º 8
0
        private void ReadImages()
        {
            ClientAPI adapter    = new ClientAPI();
            string    folderPath = Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName, @"Images\");

            foreach (string path in Directory.EnumerateFiles(folderPath, "*.jpg"))
            {
                Image QR = Image.FromFile(path);

                Store converted = adapter.Decode(QR);
                QR.Dispose();

                if (converted != null)
                {
                    converted.LastOrderPath = path;
                    StoreAdministrator.StoreListTomorrow.Add(converted);
                }
            }
            SingletonWriter.GetInstance().Write("Simulation Started");
        }
Exemplo n.º 9
0
 private void FormLog_Load(object sender, EventArgs e)
 {
     NumericTxt.Value      = SingletonWriter.GetInstance().Txt;
     NumericTextBox.Value  = SingletonWriter.GetInstance().RichTextBox;
     NumericDataGrid.Value = SingletonWriter.GetInstance().DataGrid;
 }
Exemplo n.º 10
0
 private void button1_Click(object sender, EventArgs e)
 {
     SingletonWriter.GetInstance().SaveLogs(0, 1, 1);
     SingletonWriter.GetInstance().Write("PRUEBA");
 }