public ProposalsListViewModel(
            [Import]IBackgroundExecutor executor,
            [Import]IEventAggregator eventAggregator,
            [Import]IDialogService dialogs,
            [Import]IAuthorizationService authorizator,
            [Import]IBacklogService backlogService,
            [Import]IProposalsService proposalsService)
        {
            this.executor = executor;
                this.dialogs = dialogs;
                this.aggregator = eventAggregator;

                this.authorizator = authorizator;
                this.proposalsService = proposalsService;
                this.backlogService = backlogService;

                this.aggregator.Subscribe<Project>(ScrumFactoryEvent.ViewProjectDetails, OnViewProjectDetails);

                this.aggregator.Subscribe(ScrumFactoryEvent.RoleHourCostsChanged, LoadProposals);
                this.aggregator.Subscribe<MemberProfile>(ScrumFactoryEvent.SignedMemberChanged, OnSignedMemberChanged);

                this.aggregator.Subscribe(ScrumFactoryEvent.ApplicationWhentBackground, () => { ShowValues = false; });

                OnLoadCommand = new DelegateCommand(CanSeeProposals, () => {
                    ShowValues = false;
                    if (NeedRefresh) LoadProposals();
                });
                AddProposalCommand = new DelegateCommand(CanSeeProposals, AddProposal);
                ShowDetailCommand = new DelegateCommand<Proposal>(CanSeeProposals, ShowDetail);
                ShowHourCostsCommand = new DelegateCommand(CanSeeProposals, ShowHourCosts);
        }
        public SizeListViewModel(
            [Import] IBacklogService backlogService,
            [Import] IBackgroundExecutor backgroundExecutor,
            [Import] IEventAggregator eventAggregator,
            [Import] IDialogService dialogs,
            [Import] IAuthorizationService authorizator)
        {
            this.backlogService = backlogService;
            this.executor = backgroundExecutor;
            this.aggregator = eventAggregator;
            this.authorizator = authorizator;
            this.dialogs = dialogs;

            AddNewSizeCommand = new DelegateCommand(CanEditItemSizes, AddNewSize);
            CloseWindowCommand = new DelegateCommand(CloseWindow);
            DeleteSizeCommand = new DelegateCommand<SizeViewModel>(CanEditItemSizes, DeleteSize);
            SetAsPlanningItemCommand = new DelegateCommand<SizeViewModel>(CanEditItemSizes, size => SetItemOccurrenceContraint(size, ItemOccurrenceContraints.PLANNING_OCC));
            SetAsDeliveryItemCommand = new DelegateCommand<SizeViewModel>(CanEditItemSizes, size => SetItemOccurrenceContraint(size, ItemOccurrenceContraints.DELIVERY_OCC));

            sizesViewSource = new System.Windows.Data.CollectionViewSource();
            sizesViewSource.Filter += new System.Windows.Data.FilterEventHandler(sizesViewSource_Filter);
            delayFilter = new DelayAction(1200, new DelayAction.ActionDelegate(() => { FilteredSizes.Refresh(); }));

            aggregator.Subscribe<MemberProfile>(ScrumFactoryEvent.SignedMemberChanged,
                m => {
                    RefreshCommands();
                    if (m == null) return;
                    if (Sizes!=null) return;
                    LoadItemSizes();
                });
        }
        public BurndownViewModel(
            [Import] IBacklogService backlogService,
            [Import] IProjectsService projectsService,
            [Import] IBackgroundExecutor backgroundExecutor,
            [Import] IEventAggregator eventAggregator,
            [Import] IAuthorizationService authorizator)
        {
            this.backlogService = backlogService;
            this.projectsService = projectsService;
            this.executor = backgroundExecutor;
            this.aggregator = eventAggregator;
            this.authorizator = authorizator;

            NeedRefresh = false;

            OnLoadCommand = new DelegateCommand(() => {if (NeedRefresh) LoadData();});
            SetBaselineCommand = new DelegateCommand(_CanChangeBaseline, SetBaseline);

            aggregator.Subscribe<Project>(ScrumFactoryEvent.ViewProjectDetails, p=> {
                Project = p;
                SetPlannings();
                AskForRefresh();
            });

            aggregator.Subscribe<Project>(ScrumFactoryEvent.BurndownShouldRefresh, AskForRefresh);
            aggregator.Subscribe<ICollection<Sprint>>(ScrumFactoryEvent.SprintsDateChanged, o => { AskForRefresh(); });
            aggregator.Subscribe<BacklogItem[]>(ScrumFactoryEvent.BacklogItemsChanged, b => { AskForRefresh(); });
        }
        public BacklogViewModel(
            [Import] IBacklogService backlogService,
            [Import] IBackgroundExecutor backgroundExecutor,
            [Import] IEventAggregator eventAggregator)
        {
            this.backlogService = backlogService;
            this.backgroundExecutor = backgroundExecutor;
            this.eventAggregator = eventAggregator;

            this.Items = new ObservableCollection<BacklogItem>();

            this.eventAggregator.Subscribe<Project>(
                "ViewProjectDetails",
                p =>
                {
                    this.projectId = p.Id;

                    this.backgroundExecutor.StartBackgroundTask<ICollection<BacklogItem>>(
                        () =>
                        {
                            return this.backlogService.GetBacklog(p.Id);
                        },
                        i =>
                        {
                            this.Items.Clear();

                            foreach (var item in i)
                            {
                                this.Items.Add(item);
                            }
                        });
                });

            this.SaveBacklogCommand = new DelegateCommand(() =>
            {
                this.backgroundExecutor.StartBackgroundTask(
                    () =>
                    {
                        this.backlogService.SaveBacklog(this.projectId, this.Items);
                    },
                    () => { });
            });

            this.DeleteBacklogItemCommand = new DelegateCommand<BacklogItem>(item =>
            {
                this.Items.Remove(item);
            });

            this.AddBacklogItemCommand = new DelegateCommand(() =>
            {
                this.Items.Add(
                    new BacklogItem
                    {
                        Description = this.NewItemDescription,
                        ProjectId = this.projectId
                    });
            });
        }
        public GroupListViewModel(
            [Import] IBackgroundExecutor executor,
            [Import] IEventAggregator aggregator,
            [Import] IBacklogService backlogService,
            [Import] IAuthorizationService authorizator)
        {
            this.executor = executor;
                this.aggregator = aggregator;
                this.backlogService = backlogService;
                this.authorizator = authorizator;

                aggregator.Subscribe<Project>(ScrumFactoryEvent.ViewProjectDetails, OnViewProjectDetails);

                AddGroupCommand = new DelegateCommand(CanEditGroups, AddGroup);
                UpdateGroupCommand = new DelegateCommand<BacklogItemGroup>(CanEditGroups, UpdateGroup);
        }
        public IterationPlanningViewModel(
            [Import] IBacklogService backlogService,
            [Import] IProjectsService projectsService,
            [Import] IBackgroundExecutor backgroundExecutor,
            [Import] IDialogService dialogService,
            [Import] IEventAggregator eventAggregator,
            [Import] IAuthorizationService authorizator)
        {
            this.projectsService = projectsService;
            this.backlogService = backlogService;
            this.executor = backgroundExecutor;
            this.dialogs = dialogService;
            this.aggregator = eventAggregator;
            this.authorizator = authorizator;

            SprintPlans = new ObservableCollection<SprintViewModel>();

            aggregator.Subscribe<string>(ScrumFactoryEvent.ConfigChanged, OnConfigChanged);

            aggregator.Subscribe<Project>(ScrumFactoryEvent.ViewProjectDetails, OnViewProjectDetails);
            aggregator.Subscribe<ICollection<Sprint>>(ScrumFactoryEvent.SprintsDateChanged, OnSprintsDateChanged);

            aggregator.Subscribe<BacklogItem[]>(ScrumFactoryEvent.BacklogItemsChanged, UpdateChangedItems);

            aggregator.Subscribe<string>(ScrumFactoryEvent.BacklogItemDeleted, OnBacklogItemDeleted);

            aggregator.Subscribe <ICollection<BacklogItemGroup>>(ScrumFactoryEvent.BacklogItemGroupsLoaded, OnBacklogItemsGroupLoaded);

            LoadDataCommand = new DelegateCommand(() => { if (NeedRefresh) LoadData(); });

            CreateNewSprintCommand = new DelegateCommand(CanEditSprints, CreateNewSprint);
            EqualizeSprintsCommand = new DelegateCommand(CanEditSprints, EqualizeSprints);
            RemoveSprintCommand = new DelegateCommand<SprintViewModel>(CanEditSprints, RemoveSprint);

            MoveItemToCommand = new DelegateCommand<Windows.Helpers.DragDrop.DropCommandParameter>(MoveItemTo);

            ShowDeliveryReportCommand = new DelegateCommand(ShowDeliveryReport);
            ShowSprintStackReportCommand = new DelegateCommand(ShowSprintStackReport);
            ShowFullDeliveryReportCommand = new DelegateCommand(ShowFullDeliveryReport);

            ShiftItemsCommand = new DelegateCommand<BacklogItem>(CanEditSprints, ShiftItemsAfter);

            ShowDetailCommand = new DelegateCommand<BacklogItemViewModel>(ShowDetail);
        }
        public HoursGraphViewModel(
            [Import] IBacklogService backlogService,
            [Import] IBackgroundExecutor backgroundExecutor,
            [Import] IEventAggregator eventAggregator)
        {
            this.backlogService = backlogService;
            this.executor = backgroundExecutor;
            this.aggregator = eventAggregator;

            NeedRefresh = false;

            OnLoadCommand = new DelegateCommand(() => {if (NeedRefresh) LoadData();});

            aggregator.Subscribe<Project>(ScrumFactoryEvent.ViewProjectDetails, AskForRefresh);

            aggregator.Subscribe<Project>(ScrumFactoryEvent.BurndownShouldRefresh, AskForRefresh);

            aggregator.Subscribe<BacklogItem[]>(ScrumFactoryEvent.BacklogItemsChanged, b => { AskForRefresh(); });

            EffectiveHours = new List<HourColumn>();
            PlannedHours = new List<HourColumn>();
        }
Example #8
0
 public BacklogController(IBacklogService backlogService)
 {
     _backlogService = backlogService;
 }
        public BacklogViewModel(
            [Import] IBacklogService backlogService,
            [Import] ITasksService tasksService,
            [Import] IBackgroundExecutor backgroundExecutor,
            [Import] IEventAggregator eventAggregator,
            [Import] IDialogService dialogService,
            [Import] IAuthorizationService authorizationService)
        {
            this.backlogService = backlogService;
            this.tasksService = tasksService;
            this.executor = backgroundExecutor;
            this.aggregator = eventAggregator;
            this.dialogs = dialogService;
            this.authorizator = authorizationService;

            aggregator.Subscribe<string>(ScrumFactoryEvent.ConfigChanged, OnConfigChanged);

            aggregator.Subscribe<Project>(ScrumFactoryEvent.ViewProjectDetails, OnViewProjectDetails, 10);

            aggregator.Subscribe <ICollection<Role>>(ScrumFactoryEvent.ProjectRolesChanged, SyncPlannedHours);

            aggregator.Subscribe<Sprint>(ScrumFactoryEvent.SprintAdded, s => { AskForRefresh(); });
            aggregator.Subscribe<ICollection<Sprint>>(ScrumFactoryEvent.SprintsDateChanged, s => { AskForRefresh(); });
            aggregator.Subscribe(ScrumFactoryEvent.SprintsShifted, AskForRefresh);

            aggregator.Subscribe(ScrumFactoryEvent.BacklogReplannedByTask, AskForRefresh);

            aggregator.Subscribe<BacklogItem[]>(ScrumFactoryEvent.BacklogItemsChanged, UpdateChangedItems);

            aggregator.Subscribe<BacklogItem>(ScrumFactoryEvent.ShowItemDetail, ShowDetailWindow);

            aggregator.Subscribe<BacklogItem>(ScrumFactoryEvent.BacklogItemSelectedChanged, OnItemsSelectedChanged);

            LoadDataCommand = new DelegateCommand(() => { if (NeedRefresh) LoadData(); });
            ShowDetailWindowCommand = new DelegateCommand<BacklogItemViewModel>(ShowDetailWindow);
            CreateNewBacklogItemCommand = new DelegateCommand(CreateNewBacklogItem);

            DeleteBacklogItemCommand = new DelegateCommand<BacklogItemViewModel>(CanRemoveBacklogItem, RemoveBacklogItem);

            EditItemSizesCommand = new DelegateCommand(CanEditItemSizes, EditItemSizes);
            PlanAllLateItemsCommand = new DelegateCommand(CanPlanAllLateItems, PlanAllLateItems);

            MoveItemToCommand = new DelegateCommand<Windows.Helpers.DragDrop.DropCommandParameter>(MoveItemTo);

            CopyItemsCommand = new DelegateCommand(CopyItemsToClipboard);
            PasteItemsCommand = new DelegateCommand(PasteItems);
            SelectAllItemsCommand = new DelegateCommand(SelectAllItems);

            FilterByMonthCommand = new DelegateCommand<DateTime>(FilterByMonth);

            backlogViewSource = new System.Windows.Data.CollectionViewSource();
            backlogViewSource.SortDescriptions.Add(new SortDescription("Item.SprintNumber", ListSortDirection.Ascending));
            backlogViewSource.SortDescriptions.Add(new SortDescription("Item.OccurrenceConstraint", ListSortDirection.Ascending));
            backlogViewSource.SortDescriptions.Add(new SortDescription("Item.BusinessPriority", ListSortDirection.Ascending));
            backlogViewSource.SortDescriptions.Add(new SortDescription("Item.BacklogItemNumber", ListSortDirection.Ascending));

            backlogViewSource.Filter += new System.Windows.Data.FilterEventHandler(backlogViewSource_Filter);
            delayFilter = new DelayAction(800, new DelayAction.ActionDelegate(() => { FilteredBacklog.Refresh(); }));

            // just to show group list at screens with 1024 or more pixels width
            OnPropertyChanged("ShowGroupList");
        }
        public TasksListViewModel(
            [Import] ITasksService tasksService,
            [Import] IBacklogService backlogService,
            [Import] IBackgroundExecutor backgroundExecutor,
            [Import] IEventAggregator eventAggregator,
            [Import] IDialogService dialogService,
            [Import] IAuthorizationService authorizationService)
        {
            this.tasksService = tasksService;
                this.backlogService = backlogService;
                this.executor = backgroundExecutor;
                this.aggregator = eventAggregator;
                this.dialogs = dialogService;
                this.authorizator = authorizationService;

            tasksViewSource = new System.Windows.Data.CollectionViewSource();

            tasksViewSource.SortDescriptions.Add(new SortDescription("Task.Priority", ListSortDirection.Descending));
            tasksViewSource.SortDescriptions.Add(new SortDescription("Task.TaskType", ListSortDirection.Descending));
            tasksViewSource.SortDescriptions.Add(new SortDescription("Task.TaskNumber", ListSortDirection.Descending));

            tasksViewSource.Filter += new System.Windows.Data.FilterEventHandler(tasksViewSource_Filter);
            delayFilter = new DelayAction(500, new DelayAction.ActionDelegate(Refresh));

            backlogViewSource = new System.Windows.Data.CollectionViewSource();
            backlogViewSource.SortDescriptions.Add(new SortDescription("SprintNumber", ListSortDirection.Ascending));
            backlogViewSource.SortDescriptions.Add(new SortDescription("OccurrenceConstraint", ListSortDirection.Ascending));
            backlogViewSource.SortDescriptions.Add(new SortDescription("BusinessPriority", ListSortDirection.Ascending));
            backlogViewSource.SortDescriptions.Add(new SortDescription("BacklogItemNumber", ListSortDirection.Ascending));

            clockUpdate = new DelayAction(1000, new DelayAction.ActionDelegate(UpdateClock), false);

            player = new System.Media.SoundPlayer();
            player.Stream = Properties.Resources.whistles;
            player.Load();

            ListMode = ListModes.POST_IT_MODE;

            NewTaskType = (short)TaskTypes.DEVELOPMENT_TASK;

            OnLoadCommand = new DelegateCommand(() => { if (NeedRefresh) LoadData(); });

            ShowDetailWindowCommand = new DelegateCommand<TaskViewModel>(ShowDetail);

            CreateTaskCommand = new DelegateCommand(CanCreateTask, CreateTask);
            CreateEmptyTaskCommand = new DelegateCommand(CanCreateEmptyTask, CreateTask);

            ChangeListModeCommand = new DelegateCommand(ChangeListMode);

            MoveTaskCommand = new DelegateCommand<Windows.Helpers.DragDrop.DropCommandParameter>(MoveTask);

            ChangeTaskItemCommand = new DelegateCommand<Windows.Helpers.DragDrop.DropCommandParameter>(ChangeTaskItem);

            ShowJoinDialogCommand = new DelegateCommand(CanJoinProject, ShowJoinDialog);

            StartStopClockCommand = new DelegateCommand(StartStopClock);

            SetNewTaskTypeCommand = new DelegateCommand<Int16>(t => { NewTaskType = t; });

            CopyTasksCommand = new DelegateCommand(CopyTasksToClipboard);
            PasteTasksCommand = new DelegateCommand(PasteTasks);
            SelectAllTasksCommand = new DelegateCommand(SelectAllTasks);

            CloseItemCommand = new DelegateCommand<BacklogItem>(CloseItem);

            AddNewTagCommand = new DelegateCommand(CanAddTags, AddNewTag);
            RemoveTagCommand = new DelegateCommand<TaskTag>(CanAddTags, RemoveTag);
            UpdateTagCommand = new DelegateCommand<TaskTag>(CanAddTags, UpdateTag);

            aggregator.Subscribe<Project>(ScrumFactoryEvent.ViewProjectDetails, p => {
                Project = p;
                StopClock();
                OnPropertyChanged("CurrentSprintLabel");
            });

            aggregator.Subscribe<ICollection<MemberProfile>>(ScrumFactoryEvent.ProjectMembersChanged, OnMembersChanged);

            aggregator.Subscribe<ICollection<Role>>(ScrumFactoryEvent.ProjectRolesChanged, OnRolesChanged);
            aggregator.Subscribe<Task>(ScrumFactoryEvent.TaskChanged, OnTaskChanged);

            aggregator.Subscribe(ScrumFactoryEvent.ApplicationWhentForeground, OnAppForeground);

            aggregator.Subscribe<BacklogItem>(ScrumFactoryEvent.ShowTasksForItem, ShowTasksForItem);

            aggregator.Subscribe<BacklogItem[]>(ScrumFactoryEvent.BacklogItemsChanged, UpdateChangedItems);
            aggregator.Subscribe(ScrumFactoryEvent.SprintsShifted, AskForRefresh);

            aggregator.Subscribe<Project>(ScrumFactoryEvent.ProjectStatusChanged, SetReplanItemWhenChanged);

            aggregator.Subscribe<Task>(ScrumFactoryEvent.TaskSelectedChanged, OnTaskSelectedChanged);
        }
        public BacklogItemViewModel(
            IBacklogService backlogService,
            IBackgroundExecutor backgroundExecutor,
            IEventAggregator eventAggregator,
            IAuthorizationService authorizator,
            Project project,
            BacklogItem item,
            ScrumFactory.Composition.Configuration sfConfig)
        {
            Init(backlogService, backgroundExecutor, eventAggregator, authorizator, project, item);

                SFConfig = sfConfig;

                ShowRepositoryLogCommand = new DelegateCommand(ShowRepositoryLog);
        }
        public void Init(
            IBacklogService backlogService,
            IBackgroundExecutor backgroundExecutor,
            IEventAggregator eventAggregator,
            IAuthorizationService authorizator,
            Project project,
            BacklogItem item)
        {
            this.backlogService = backlogService;
            this.executor = backgroundExecutor;
            this.aggregator = eventAggregator;
            this.authorizator = authorizator;

            if (item != null) {
                this.Item = item;
                this.Item.Project = project;
                if(Item.Project.Roles!=null)
                    this.Item.SyncPlannedHoursAndRoles();
            }

            ChangeGroupCommand = new DelegateCommand(CanEdit, ChangeGroup);
            ChangeStatusCommand = new DelegateCommand(CanEdit, ChangeStatus);

            MoveItemToNextSprintCommand = new DelegateCommand(CanMoveItemToNextSprint, MoveItemToNextSprint);
            MoveItemToPreviousSprintCommand = new DelegateCommand(CanMoveItemToPreviousSprint, MoveItemToPreviousSprint);

            MoveItemToCurrentSprintCommand = new DelegateCommand(CanMoveItemToCurrentSprint, MoveItemToCurrentSprint);
            MoveItemToLastSprintCommand = new DelegateCommand(CanMoveItemToNextSprint, MoveItemToLastSprint);

            MoveItemToProductBacklogCommand = new DelegateCommand(CanMoveItemToProductBacklog, () => { ChangeSprint(-1, false); });

            ShowTasksCommand = new DelegateCommand(ShowTasks);
        }
Example #13
0
 public CreateBacklogRequestHandler(IBacklogService backlogService)
 {
     _backlogService = backlogService;
 }
        public ProjectSummaryViewModel(
            [Import] IEventAggregator aggregator,
            [Import] IBackgroundExecutor executor,
            [Import] IProjectsService projectsService,
            [Import] IProposalsService proposalsService,
            [Import] ITasksService tasksService,
            [Import] IBacklogService backlogService,
            [Import] IDialogService dialogService,
            [Import] IAuthorizationService autorizatorService)
        {
            this.aggregator = aggregator;
                this.executor = executor;
                this.projectsService = projectsService;
                this.proposalsService = proposalsService;
                this.tasksService = tasksService;
                this.backlogService = backlogService;
                this.dialogService = dialogService;
                this.autorizator = autorizatorService;

                aggregator.Subscribe<Project>(ScrumFactoryEvent.ViewProjectDetails, OnViewProjectDetails, 100);
                aggregator.Subscribe<Project>(ScrumFactoryEvent.ProjectCreated, OnProjectCreation);
                aggregator.Subscribe<MemberProfile>(ScrumFactoryEvent.SignedMemberChanged, OnSignedMemberChanged);

                aggregator.Subscribe<string>(ScrumFactoryEvent.ShowCodeRepositoryLog, ShowProjectRepositoryLog);
                aggregator.Subscribe<string>(ScrumFactoryEvent.ShowCodeRepository, p => {
                    if (String.IsNullOrEmpty(p))
                        p = Project.CodeRepositoryPath;
                    OpenPath(p);
                });

                aggregator.Subscribe<string>(ScrumFactoryEvent.ShowDocRepository, p => {
                    if (String.IsNullOrEmpty(p))
                        p = Project.DocRepositoryPath;
                    OpenPath(p);
                });

                aggregator.Subscribe<ICollection<MemberProfile>>(ScrumFactoryEvent.ProjectMembersChanged, m => {
                    OnMembersLoaded(m);
                    ((DelegateCommand)SendMailCommand).NotifyCanExecuteChanged();
                });

                StartProjectCommand = new DelegateCommand(CanStartProject, StartProject);
                CloseProjectCommand = new DelegateCommand(CanCloseProject, CloseProject);
                EditProjectCommand = new DelegateCommand(CanEditProject, EditProject);

                ShowRepositoryCommand = new DelegateCommand<string>(OpenPath);

                ShowReportCommand = new DelegateCommand<string>(ShowReport);

                ShowProjectTeamCommand = new DelegateCommand(()=> { this.aggregator.Publish(ScrumFactoryEvent.ShowProjectTeam); });

                ChangeUserEngageCommand = new DelegateCommand<ProjectMembership>(ChangeUserEngage);

                RemoveUserEngageCommand = new DelegateCommand<ProjectMembership>(RemoveUserEngage);

                SendMailCommand = new DelegateCommand(CanSendMail, SendMail);

                JoinProjectCommand = new DelegateCommand(ShowJoinDialog);

                CreateCodeRepCommand = new DelegateCommand<ICodeRepositoryService>(CreateCodeRep);
        }