private void OnViewSelectionChanged(object sender, EventArgs e) { LoadWorkItems(); ViewSelectionViewModel.ShowViewOptions = false; var defaultProfile = Repository.Instance.ProfileProvider.GetDefaultProfile(); try { DetachFromProfileProvider(); if (ViewSelectionViewModel.IsMergeCandidatesSelected()) { var result = ViewSelectionViewModel.GetMergeSourceTargetBranches(); defaultProfile.WIQueryName = null; defaultProfile.WISourceBranch = result.SourceBranch.Name; defaultProfile.WITargetBranch = result.TargetBranch.Name; defaultProfile.WISourcePathFilter = result.PathFilter; } else if (ViewSelectionViewModel.IsQuerySelected()) { var query = ViewSelectionViewModel.GetSelectedQuery(); defaultProfile.WISourceBranch = null; defaultProfile.WITargetBranch = null; defaultProfile.WISourcePathFilter = null; defaultProfile.WIQueryName = query.QualifiedTitle; } } finally { AttachToProfileProvider(); } }
private void TfsItemCache_WorkItemHasBeenMerged(object sender, WorkItemHasBeenMergedEventArgs e) { if (ViewSelectionViewModel.IsMergeCandidatesSelected()) { var original = WorkItemList.OriginalElements.Where(changeset => changeset == e.WorkItem).FirstOrDefault(); if (original != null) { WorkItemList.OriginalElements.Remove(original); } var source = WorkItemList.Elements.Where(changeset => changeset.InnerItem == e.WorkItem).FirstOrDefault(); if (source != null) { WorkItemList.Elements.Remove(source); } } }
private void LoadWorkItems() { if (Repository.Instance.TfsConnectionInfo.Uri == null) { ResetWorkItems(); return; } if (ViewSelectionViewModel.IsMergeCandidatesSelected()) { var result = ViewSelectionViewModel.GetMergeSourceTargetBranches(); ResetWorkItems(); Repository.Instance.BackgroundTaskManager.Start( Constants.Tasks.LoadWorkItemsTaskKey, ItemsLoading, (task) => { LoadWorkItems(result.SourceBranch, result.TargetBranch, result.PathFilter, task); }); } else if (ViewSelectionViewModel.IsQuerySelected()) { var query = ViewSelectionViewModel.GetSelectedQuery(); ResetWorkItems(); Repository.Instance.BackgroundTaskManager.Start( Constants.Tasks.LoadWorkItemsTaskKey, ItemsLoading, (task) => { LoadWorkItems(query, task); }); } else { ItemsLoading.IsLoading = false; } }