예제 #1
0
        public DialogFormPresenter(
            IDialogFormView dialogFormView,
            IService <Task> taskService,
            IService <Employee> employeeService,
            IService <AssignedTask> assignedTaskService,
            ISystemInformationService systemInformationService,
            IValidateAssignment validateAssignment,
            IMenuCommand[] commands)
        {
            this.dialogFormView = dialogFormView;

            this.taskDialogView = dialogFormView.TaskDialogView;
            this.taskDialogView.SetTitle(MenuOption.Tasks.GetAttribute <MenuOptionAttribute>().Name);

            this.employeeDialogView = dialogFormView.EmployeeDialogView;
            this.employeeDialogView.SetTitle(MenuOption.Employees.GetAttribute <MenuOptionAttribute>().Name);

            this.assignedTaskDialogView = dialogFormView.AssignedTaskDialogView;
            this.assignedTaskDialogView.SetTitle(MenuOption.AssignedTasks.GetAttribute <MenuOptionAttribute>().Name);

            this.taskDialogView.OnCancelButtonClick += OnCancelButtonClick;
            this.taskDialogView.OnSaveButtonClick   += TaskDialogView_OnSaveButtonClick;

            this.employeeDialogView.OnCancelButtonClick += OnCancelButtonClick;;
            this.employeeDialogView.OnSaveButtonClick   += EmployeeDialogView_OnSaveButtonClick;;

            this.assignedTaskDialogView.OnCancelButtonClick += OnCancelButtonClick;;
            this.assignedTaskDialogView.OnSaveButtonClick   += AssignedTaskDialogView_OnSaveButtonClick;;

            this.taskService         = taskService;
            this.employeeService     = employeeService;
            this.assignedTaskService = assignedTaskService;

            this.assignedTaskDialogView.LoadEmployees(employeeService.Get(e => !e.IsDeleted));
            this.assignedTaskDialogView.LoadTasks(taskService.Get(t => !t.IsDeleted));

            this.validateAssignment = validateAssignment;

            this.commands = commands;

            if (!systemInformationService.IsHighContrastColourScheme)
            {
                dialogFormView.BackColor = Color.White;
            }
        }
 public void TestSetup()
 {
     assignedTasks      = new List <AssignedTask>();
     validateAssignment = new ValidateAssignment();
 }