private void ShowDetail(TaskViewModel task) { DetailViewModel.ShowDetail(task.Task, Project, allTaskTags); }
private void CreateTask(Task task) { if (!IsSignedMemberAtProject) { dialogs.ShowAlertMessage(Properties.Resources.Can_not_create_task, Properties.Resources.Please_join_the_project_to_create_the_new_task, null); return; } if (SelectedBacklogItem == null) { dialogs.ShowAlertMessage(Properties.Resources.Can_not_create_task, Properties.Resources.Please_select_a_backlog_item_to_create_the_new_task, null); return; } dialogs.CloseAlertMessage(); task.ProjectUId = Project.ProjectUId; task.Project = Project; task.CreatedAt = DateTime.Now; // if im not a Scrum Master can only create tasks for myself if (!Project.HasPermission(authorizator.SignedMemberProfile.MemberUId, PermissionSets.SCRUM_MASTER)) task.TaskAssigneeUId = authorizator.SignedMemberProfile.MemberUId; TaskViewModel taskVM = new TaskViewModel(executor, tasksService, aggregator, dialogs, authorizator, task, taskSelector); taskVM.SetTaskRoleAccordingAssignee(); taskVM.BacklogItem = BacklogItems.SingleOrDefault(i => i.BacklogItemUId == task.BacklogItemUId); taskVM.ReplanItemWhenChanged = ReplanItemWhenChanged; executor.StartBackgroundTask<int>( () => { return tasksService.CreateTask(task); }, taskNumber => { Tasks.Add(taskVM); ((IEditableCollectionView)tasksViewSource.View).EditItem(taskVM); ((IEditableCollectionView)tasksViewSource.View).CommitEdit(); NewTaskName = null; taskVM.NotifyAdded(); if (String.IsNullOrEmpty(task.TaskName)) taskVM.PostItTaskNameTextBoxFocus = true; //else //taskVM.PostItPlannedHoursTextBoxFocus = true; SetShowAddTaskToolTip(); aggregator.Publish<Task>(ScrumFactoryEvent.TaskAdded, task); }); }
/// <summary> /// After the service returns all the tasks, create a observable collection of /// tasks view models and set it as source for the collection view source. /// </summary> /// <param name="tasks"></param> private void OnTasksLoaded(ICollection<Task> tasks) { ClearTasks(); if (tasks != null) { foreach (Task task in tasks) { task.Project = Project; TaskViewModel taskVM = new TaskViewModel(executor, tasksService, aggregator, dialogs, authorizator, task, taskSelector); taskVM.ReplanItemWhenChanged = ReplanItemWhenChanged; Tasks.Add(taskVM); } } // sets the filtered view source tasksViewSource.Source = Tasks; GroupAndSortTaskSourceView(); OnPropertyChanged("FilteredTasksPostIt"); OnPropertyChanged("FilteredTasksList"); SetShowAddTaskToolTip(); // notify other modules aggregator.Publish<ICollection<Task>>(ScrumFactoryEvent.TasksLoaded, tasks); // load data is over IsLoadingData = false; }
private string MemberNameForTask(TaskViewModel taskVM) { if (ProjectMembers == null) return string.Empty; AssigneeViewModel member = ProjectMembers.Where(m => m.MemberUId == taskVM.TaskAssigneeUId).SingleOrDefault(); if (member == null) return string.Empty; return member.FullName; }
/// <summary> /// Start or stop to track a given task. /// </summary> /// <param name="taskVM">The task VM.</param> private void TrackTask(TaskViewModel task) { if (task.IsTracking) StopTaskTrack(); else StartTrack(task.Task); }
private void ShowTaskDetail(TaskViewModel task) { dialogs.SetBackTopMenu(); aggregator.Publish<Task>(ScrumFactoryEvent.ShowTaskDetail, task.Task); //View.Close(); //detailViewModel.ShowDetail(task.Task); }
/// <summary> /// Loads the tasks. /// </summary> private void LoadTasks(bool goFullIfNoTasks = false) { if (authorizator.SignedMemberProfile == null) return; IsLoadingData = true; executor.StartBackgroundTask<ICollection<Task>>( () => { return tasksService.GetUserTasks(authorizator.SignedMemberProfile.MemberUId, true, true); }, ts => { List<TaskViewModel> tempList = new List<TaskViewModel>(); foreach (Task t in ts) { TaskViewModel vm = new TaskViewModel(executor, tasksService, aggregator, dialogs, authorizator, t, this); vm.FinishDialog = this.FinishDialog; tempList.Add(vm); } ClearTasks(); tasks = new ObservableCollection<TaskViewModel>(tempList.OrderByDescending(t => t.IsTracking).ThenByDescending(t => t.Task.Priority).ThenByDescending(t => t.Task.TaskType)); tasksViewSource.Source = tasks.Where(t => t.TaskAssigneeUId!=null); tasksViewSource.GroupDescriptions.Clear(); tasksViewSource.GroupDescriptions.Add(new PropertyGroupDescription("Task.TaskInfo.ProjectName")); notMineTasksViewSource.Source = tasks.Where(t => t.TaskAssigneeUId == null); notMineTasksViewSource.GroupDescriptions.Clear(); notMineTasksViewSource.GroupDescriptions.Add(new PropertyGroupDescription("Task.TaskInfo.ProjectName")); OnPropertyChanged("FilteredTasks"); OnPropertyChanged("NotMineFilteredTasks"); OnPropertyChanged("TrackingTaskInfo"); IsLoadingData = false; lastLoadTime = DateTime.Now; if (tasks.Count == 0 && goFullIfNoTasks) aggregator.Publish(ScrumFactoryEvent.ShowFullScreen); }); }