Beispiel #1
0
        static void Main()
        {
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            Application.ThreadException += ApplicationOnThreadException;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var container = new WindsorContainer();

            container.Install(FromAssembly.This());

            var validateAssignmentService = container.Resolve <IValidateAssignment>();
            var systemInformationService  = container.Resolve <ISystemInformationService>();
            var taskService         = container.Resolve <IService <Task> >();
            var employeeService     = container.Resolve <IService <Employee> >();
            var assignedTaskService = container.Resolve <IService <AssignedTask> >();

            var mainForm                  = new MainForm();
            var dialogForm                = new DialogForm();
            var employeesDataListView     = new DataListView();
            var tasksDataListView         = new DataListView();
            var assignedTasksDataListView = new DataListView();
            var taskDialogView            = new TaskDialogView();
            var employeeDialogView        = new EmployeeDialogView();
            var assignedTaskDialogView    = new AssignedTaskDialogView();

            var commands = new IMenuCommand[]
            {
                new LoadTasksCommand(mainForm, taskService),
                new LoadEmployeesCommand(mainForm, employeeService),
                new LoadAssignedTasksCommand(mainForm, dialogForm, assignedTaskDialogView,
                                             taskService, employeeService, assignedTaskService),
                new AddCommand(dialogForm, taskService, employeeService, assignedTaskService),
                new EditCommand(dialogForm, taskService, employeeService, assignedTaskService),
                new RemoveCommand(mainForm, taskService, employeeService, assignedTaskService),
            };

            var mainFormPresenter = new MainFormPresenter(
                mainForm,
                employeesDataListView,
                tasksDataListView,
                assignedTasksDataListView,
                systemInformationService,
                commands);

            var dialogFormPresenter = new DialogFormPresenter(
                dialogForm,
                taskService,
                employeeService,
                assignedTaskService,
                systemInformationService,
                validateAssignmentService,
                commands);

            Application.Run(mainForm);
        }
Beispiel #2
0
        public DialogForm()
        {
            InitializeComponent();

            taskDialogView = new TaskDialogView()
            {
                Dock = DockStyle.Fill
            };
            employeeDialogView = new EmployeeDialogView()
            {
                Dock = DockStyle.Fill
            };
            assignedTaskDialogView = new AssignedTaskDialogView()
            {
                Dock = DockStyle.Fill
            };
        }