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 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; } }