void ProfileProvider_DefaultProfileChanged(object sender, DefaultProfileChangedEventArgs e) { var defaultProfile = Repository.Instance.ProfileProvider.GetDefaultProfile(); if (defaultProfile == null) { Repository.Instance.BackgroundTaskManager.DelayedPost(() => { ProfileProvider_DefaultProfileChanged(sender, e); return(false); }); return; } if (defaultProfile.WIQueryName != null) { if (ViewSelectionViewModel.RootQuery == null) { Repository.Instance.BackgroundTaskManager.DelayedPost( () => { ProfileProvider_DefaultProfileChanged(sender, e); return(true); }); } else { ViewSelectionViewModel.ViewType = ViewSelection.ViewSelectionViewModel.ViewTypeEnum.WorkItemQuery; ViewSelectionViewModel.SelectedQuery = ViewSelectionViewModel.RootQuery.All.Where(query => query.QualifiedTitle == defaultProfile.WIQueryName).FirstOrDefault() as ITfsQuery; } return; } if (defaultProfile.WISourceBranch != null) { if (ViewSelectionViewModel.AvailableSourceBranches == null) { Repository.Instance.BackgroundTaskManager.DelayedPost( () => { ProfileProvider_DefaultProfileChanged(sender, e); return(true); }); } else { ViewSelectionViewModel.ViewType = ViewSelection.ViewSelectionViewModel.ViewTypeEnum.MergeCandidates; ViewSelectionViewModel.SourceBranch = ViewSelectionViewModel.AvailableSourceBranches.Where(branch => branch.Name == defaultProfile.WISourceBranch).FirstOrDefault(); if (ViewSelectionViewModel.TargetBranches != null) { ViewSelectionViewModel.TargetBranch = ViewSelectionViewModel.TargetBranches.Where(branch => branch.Name == defaultProfile.WITargetBranch).FirstOrDefault(); } ViewSelectionViewModel.PathFilter = defaultProfile.WISourcePathFilter; } return; } }
void ProfileProvider_DefaultProfileChanged(object sender, DefaultProfileChangedEventArgs e) { SimpleLogger.Log(SimpleLogLevel.Info, "ProfileProvider_DefaultProfileChanged"); var defaultProfile = Repository.Instance.ProfileProvider.GetDefaultProfile(); if (defaultProfile == null) { if (Repository.Instance.TfsBridgeProvider.ActiveTeamProject != null) { Repository.Instance.BackgroundTaskManager.DelayedPost(() => { ProfileProvider_DefaultProfileChanged(sender, e); return(false); }); } return; } bool didSomething = false; if (defaultProfile.CSQueryName != null) { didSomething = true; if (ViewSelectionViewModel.RootQuery == null) { Repository.Instance.BackgroundTaskManager.DelayedPost( () => { ProfileProvider_DefaultProfileChanged(sender, e); return(true); }); } else { ViewSelectionViewModel.ViewType = ViewSelection.ViewSelectionViewModel.ViewTypeEnum.WorkItemQuery; ViewSelectionViewModel.SelectedQuery = ViewSelectionViewModel.RootQuery.All.Where(query => query.QualifiedTitle == defaultProfile.CSQueryName).FirstOrDefault() as ITfsQuery; if (ViewSelectionViewModel.SelectedQuery == null) { defaultProfile.CSQueryName = null; didSomething = false; } } } if (defaultProfile.CSSourceBranch != null) { didSomething = true; if (ViewSelectionViewModel.AvailableSourceBranches == null) { Repository.Instance.BackgroundTaskManager.DelayedPost( () => { ProfileProvider_DefaultProfileChanged(sender, e); return(true); }); } else { ViewSelectionViewModel.ViewType = ViewSelection.ViewSelectionViewModel.ViewTypeEnum.MergeCandidates; var sourceBranch = Repository.Instance.TfsBridgeProvider.GetBranchByNameOrNull(defaultProfile.CSSourceBranch); if (sourceBranch == null) { ViewSelectionViewModel.SourceBranch = ViewSelectionViewModel.AvailableSourceBranches.Where(branch => branch.Name == defaultProfile.CSSourceBranch).FirstOrDefault(); if (ViewSelectionViewModel.TargetBranches != null) { ViewSelectionViewModel.TargetBranch = ViewSelectionViewModel.TargetBranches.Where(branch => branch.Name == defaultProfile.CSTargetBranch).FirstOrDefault(); } } else { ViewSelectionViewModel.SourceBranch = sourceBranch; ViewSelectionViewModel.TargetBranch = defaultProfile.CSTargetBranch != null?Repository.Instance.TfsBridgeProvider.GetBranchByNameOrNull(defaultProfile.CSTargetBranch) : null; } ViewSelectionViewModel.PathFilter = defaultProfile.CSSourcePathFilter; if (ViewSelectionViewModel.SourceBranch == null) { defaultProfile.CSSourceBranch = null; defaultProfile.CSTargetBranch = null; didSomething = false; } if (ViewSelectionViewModel.TargetBranch == null) { defaultProfile.CSTargetBranch = null; didSomething = false; } } } IncludeCommentFilter = defaultProfile.ChangesetIncludeCommentFilter; IncludeCommentFilterActive = IncludeCommentFilter != null; ExcludeCommentFilter = defaultProfile.ChangesetExcludeCommentFilter; ExcludeCommentFilterActive = ExcludeCommentFilter != null; DateFromFilter = defaultProfile.DateFromFilter; DateFromFilterActive = DateFromFilter != null; DateToFilter = defaultProfile.DateToFilter; DateToFilterActive = DateToFilter != null; if (!didSomething) { ItemsLoading.IsLoading = false; } }