Beispiel #1
0
        public MainWindow()
        {
            this.InitializeComponent();
            this.viewModel         = new ETTViewModel();
            this.settingsViewModel = new SettingsViewModel();

            // Connect to workflow
            var workflow = new Workflow(new TimeTrackerClientProfile());

            var connector = new WorkflowConnector(
                this.viewModel,
                this.settingsViewModel,
                workflow,
                ManualDependencyResolver.Get <IMapper>());

            this.TimerWidgetControl.Initialize(this.viewModel);
            this.Dashboard.Initialize(this.viewModel);
            this.Timesheet.Initialize(this.viewModel, connector);

            this.viewModel.UpdateSettingsViewModel(this.settingsViewModel);
            this.Settings.Initialize(this.settingsViewModel);
            this.MiniSettings.Initialize(this.settingsViewModel);
            this.TaskWidget.Initialize(this.viewModel);

            this.DataContext = this.viewModel;
        }
        public static IAction GetProjects(
            ProjectOverviewsRequestResource requestResource)
        {
            return(new ThunkAction <WorkflowState>((dispatch, getState) => {
                Task.Factory.StartNew(
                    async() => {
                    dispatch(new ProcessStartAction());

                    var projectsService = ManualDependencyResolver.Get <IProjectsService>();
                    var request = Mapper.Map <ProjectOverviewsRequest>(requestResource);
                    var overviews = await projectsService.GetOverviews(request);
                    var overviewsResource = Mapper.Map <ProjectOverviewsResource>(overviews);
                    dispatch(new ProjectsLoadedAction(overviewsResource));

                    dispatch(new ProcessEndAction());
                });
            }));
        }