예제 #1
0
        static void Main(string[] args)
        {
            var         addPresenter = new AddPresenter(new TaskRepository());
            UserCommand command;

            do
            {
                PrintOptions();
                command = InputToUserCommandConverter.Convert(Console.ReadLine());
                switch (command)
                {
                case UserCommand.AddTask:
                    addPresenter.Execute();
                    break;

                case UserCommand.Quit:
                    break;

                case UserCommand.Unknown:
                    PrintErrorMessage();
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            } while (command != UserCommand.Quit);
        }
예제 #2
0
        public static void AddItem()
        {
            var dialog          = new AddForm();
            var dialogPresenter = new AddPresenter(dialog, repository);

            var result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                programView.UpdateList(repository.GetAllTasks());
            }
        }