Esempio n. 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;
            }
        }
Esempio n. 2
0
 public LoadAssignedTasksCommand(
     IMainFormView mainFormView,
     IDialogFormView dialogFormView,
     IDialogView <AssignedTask> assignedTaskDialogView,
     IService <Task> taskService,
     IService <Employee> employeeService,
     IService <AssignedTask> assignedTaskService)
 {
     this.mainFormView           = mainFormView;
     this.dialogFormView         = dialogFormView;
     this.assignedTaskDialogView = assignedTaskDialogView;
     this.taskService            = taskService;
     this.employeeService        = employeeService;
     this.assignedTaskService    = assignedTaskService;
     Icon        = Properties.Resources.icons8_planner_48;
     ToolTip     = MenuOption.AssignedTasks.GetAttribute <MenuOptionAttribute>().Name;
     ShortcutKey = Keys.Alt | Keys.A;
     IsEnabled   = true;
 }
Esempio n. 3
0
        public AddCommand(
            IDialogFormView dialogFormView,
            IService <Task> taskService,
            IService <Employee> employeeService,
            IService <AssignedTask> assignedTaskService)
        {
            this.dialogFormView      = dialogFormView;
            this.taskService         = taskService;
            this.employeeService     = employeeService;
            this.assignedTaskService = assignedTaskService;

            Icon        = Properties.Resources.icons8_plus_math_48;
            ToolTip     = MenuOption.Add.GetAttribute <MenuOptionAttribute>().Name;
            ShortcutKey = Keys.Alt | Keys.N;
            IsEnabled   = false;
            Tag         = null;

            EventAggregator.Instance.Subscribe <TaskMessage>(e => IsEnabled         = true);
            EventAggregator.Instance.Subscribe <TaskMessage>(e => Tag               = e.Entity);
            EventAggregator.Instance.Subscribe <EmployeeMessage>(e => IsEnabled     = true);
            EventAggregator.Instance.Subscribe <EmployeeMessage>(e => Tag           = e.Entity);
            EventAggregator.Instance.Subscribe <AssignedTaskMessage>(e => IsEnabled = true);
            EventAggregator.Instance.Subscribe <AssignedTaskMessage>(e => Tag       = e.Entity);
        }