Exemplo n.º 1
0
 /// <summary>
 /// Entry point
 /// </summary>
 static void Main()
 {
     try
     {
         XmlVehiclesReader reader  = XmlVehiclesReader.GetInstance();
         Storage           storage = new Storage();
         Menu menu = Menu.GetInstance();
         menu.Invoke(storage, reader);
     }
     catch (System.Exception ex)
     {
         System.Console.WriteLine("Error: " + ex.Message);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Initiates interaction with user through text UI
        /// </summary>
        public void Invoke(Storage Storage, XmlVehiclesReader VehiclesReader)
        {
            CommandsHandler commandsHandler = new CommandsHandler(Storage);

            Console.WriteLine("Press any key to enter path of an XML File to read and Esc to stop.");

            while (Console.ReadKey(true).Key != ConsoleKey.Escape)
            {
                string xmlPath = Console.ReadLine();
                Storage.AddVehicles(VehiclesReader.ReadVehicles(xmlPath));
            }

            while (exitFlag != true)
            {
                Console.WriteLine("Enter a command: ");
                commandsHandler.HandleCommand(Console.ReadLine());
            }
        }