示例#1
0
        public ToDoListPresenter(IToDoList view, IToDoListRepository repository)
        {
            this.view       = view;
            this.repository = repository;

            view.Add    += AddItem;
            view.Remove += DeleteItem;

            view.UpdateList(repository.GetAllTasks());
        }
示例#2
0
        public static void AddTask()
        {
            var dialog          = new AddForm();
            var dialogPresenter = new AddTaskPresenter(dialog, repository);
            var result          = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                view.UpdateList(repository.GetAllTasks());
            }
        }
示例#3
0
 public void DeleteItem(string Id)
 {
     repository.RemoveTask(Id);
     view.UpdateList(repository.GetAllTasks());
 }
示例#4
0
 public void RemoveItem(string id)
 {
     repository.RemoveTask(id);
     view.UpdateList(repository.GetAllTasks());
 }