static void Main(string[] args)
        {
            Creator   creator   = new Creator();
            Logistics logistics = creator.LogisticsFactory(LogistcisEnum.Railway);

            logistics.Transport();
        }
示例#2
0
        static void Main(string[] args)
        {
            var key = new ConsoleKeyInfo();

            while (!(key.Key == ConsoleKey.D4 || key.Key == ConsoleKey.NumPad4))
            {
                Logistics logistics = null;

                key = ShowMenu();
                switch (key.Key)
                {
                case ConsoleKey.D1:
                case ConsoleKey.NumPad1:
                    logistics = new RoadLogistic();
                    break;

                case ConsoleKey.D2:
                case ConsoleKey.NumPad2:
                    logistics = new SeaLogistic();
                    break;

                case ConsoleKey.D3:
                case ConsoleKey.NumPad3:
                    break;
                }

                if (logistics != null)
                {
                    Console.WriteLine();
                    var transport = logistics.CreateTransport();
                    Console.WriteLine(transport.Deliver());
                    Wait();
                }
            }
        }