Esempio n. 1
0
        static void Main(string[] args)
        {
            ILogistic  seaLogistic   = new SeaLogistic();
            ILogistic  truckLogistic = new RoadLogistic();
            ITransport boat          = seaLogistic.CreateTransport();
            ITransport truck         = truckLogistic.CreateTransport();

            Console.WriteLine(boat.Deliver());
            Console.WriteLine(truck.Deliver());
            Console.ReadKey();
        }
Esempio n. 2
0
 public void Deliver(ISendGrid message)
 {
     //_serviceManager.LogEvent("Sending an email...");
     try
     {
         _transport.Deliver(message);
         //_serviceManager.LogSucessful("Email sent.");
     }
     catch (Exception ex)
     {
         //_serviceManager.LogFail(ex, "Failed to send email.");
         throw;
     }
 }
Esempio n. 3
0
        public void PlanDelivery()
        {
            Console.WriteLine("Planning delivery... |-----");
            Thread.Sleep(800);
            Console.WriteLine("Planning delivery... ||||--");
            Thread.Sleep(500);
            Console.WriteLine("Planning delivery... |||||-");
            Thread.Sleep(1500);
            Console.WriteLine("Delivery planned successfully!");

            ITransport transport = CreateTransport();

            transport.Deliver();
        }
Esempio n. 4
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            if (i == limit)
            {
                labels[i - 1].Visible = false;
                timer.Stop();

                if (cbTruck.Checked && cbShip.Checked)
                {
                    pictureBox3.Visible = true;
                    pictureBox2.Visible = true;
                    ITransport truck = TransportFactory.RequestTransport("Truck");
                    textBox1.Text += truck.Deliver();
                    ITransport ship = TransportFactory.RequestTransport("Ship");
                    textBox1.Text += " And " + ship.Deliver();
                }
                else
                {
                    if (cbTruck.Checked)
                    {
                        pictureBox3.Visible = true;
                        ITransport truck = TransportFactory.RequestTransport("Truck");
                        textBox1.Text += truck.Deliver();
                    }
                    else
                    {
                        ITransport ship = TransportFactory.RequestTransport("Ship");
                        textBox1.Text      += ship.Deliver();
                        pictureBox2.Visible = true;
                    }
                }
                return;
            }

            if (i == 0)
            {
                labels[i].Visible = true;
            }
            else
            {
                labels[i - 1].Visible = false;
                labels[i].Visible     = true;
            }

            i++;
        }
 public void Deliver()
 {
     _transport.Deliver();
 }
Esempio n. 6
0
        public void Run()
        {
            ITransport tr = this.createTransport();

            tr.Deliver();
        }
Esempio n. 7
0
        public string PlanDelivery() //Way
        {
            ITransport product = CreateTransport();

            return($"Logistics: The same Creator's code has just worked with {product.Deliver()}");
        }