Beispiel #1
0
        public static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;

            var algorithmsList = new List <IAlgorithmItem>
            {
                new SumOfMultiple.Processor(),
                new SequenceAnalysis.Processor()
            };

            IUserInterface userInterface = new ConsoleUserInterface();

            while (true)
            {
                var selectedAlgorithm = userInterface.GetAlgorithm(algorithmsList);

                if (selectedAlgorithm == null)
                {
                    break;
                }

                try
                {
                    var input = userInterface.GetInput(selectedAlgorithm);

                    var result = selectedAlgorithm.Process(input);

                    userInterface.DisplayOutput(result);
                }
                catch (Exception ex)
                {
                    ExceptionHandler(ex);
                }
            }

            PauseBeforeExit();
        }