예제 #1
0
        /// <summary>
        /// Main function
        /// </summary>
        private static void Main()
        {
            var exit           = true;
            var consoleHandler = new ConsoleHandler(TranslateHandler.LoadJson("EN"));

            Console.WriteLine("Welcome to the AD software developer assignment");

            consoleHandler.Intro();

            while (exit)
            {
                consoleHandler.Menu();

                exit = consoleHandler.Options();
            }
        }
        /// <summary>
        /// Handle translate action
        /// </summary>
        /// <returns></returns>
        public ItemReturn Handle()
        {
            Console.WriteLine(_translate.ChooseTrans);
            Console.WriteLine(_translate.Line);
            Console.WriteLine(_translate.EnterInput);
            var region = Console.ReadLine();

            try
            {
                _translate = TranslateHandler.LoadJson(region);
                Console.Clear();
            }
            catch (FileNotFoundException)
            {
                Console.WriteLine(_translate.FileNotFoundError);
            }

            return(new ItemReturn
            {
                Exit = false,
                Translate = _translate
            });
        }