int IOleCommandTarget.Exec(ref Guid pguidCmdGroup, uint nCmdId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) { if (pguidCmdGroup != GuidList.guidTfsAccSwitchVS10CmdSet) { return(UnknownGroup); } var uri = new Uri(TeamExplorer.GetProjectContext().DomainUri); var teamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(uri); var displayName = teamProjectCollection.AuthorizedIdentity.DisplayName; switch (nCmdId) { case PkgCmdIDList.cmdidChangeAccount: { if (CredentialWrapper.AskForCredentials(displayName, uri)) { ((IVsShell4)GetService(typeof(SVsShell))).Restart(0); } break; } case PkgCmdIDList.cmdidShowAccount: { MessageBox.Show(CredentialWrapper.GetLoggedInMessage(displayName)); break; } default: return(UnknownGroup); } return(0); }
//Any operation on tfs should pass through the this call public bool IsVisualStudioIsConnectedToTfs() { if (!string.IsNullOrEmpty(_tfsServerContext.ActiveProjectContext.DomainUri)) { return(true); } TeamExplorer.NavigateToPage(new Guid(TeamExplorerPageIds.Connect), null); return(false); }
private void NavigateToUser(string userName) { TfsContext tfsContext = TfsContext; var teamFoundationIdentity = tfsContext.IdentityManager.GetIdentity(userName); if (teamFoundationIdentity != null && (UserContext == null || UserContext.Identity != teamFoundationIdentity)) { TeamExplorer.NavigateToPage(GuidList.userInfoPage.ToGuid(), UserContext = new UserInfoContext(teamFoundationIdentity)); } }
private void UpdateUser() { var userInfoPage = TeamExplorer.CurrentPage as UserInfoPage; if (userInfoPage != null) { TeamExplorer.NavigateToPage(TeamExplorerPageIds.Home.ToGuid(), null); } TeamExplorer.NavigateToPage(GuidList.userInfoPage.ToGuid(), new UserInfoContext(Identity)); }
public void OpenShelvesetWindow(string username) { if (string.IsNullOrEmpty(username)) { return; } TeamExplorer.ClosePage(TeamExplorer.NavigateToPage(new Guid(TeamExplorerPageIds.FindShelvesets), _userSearchForShelveset)); _userSearchForShelveset = username; TeamExplorer.NavigateToPage(new Guid(TeamExplorerPageIds.FindShelvesets), _userSearchForShelveset); }
public void OpenChangesetWindow(string changesetId, bool requiresVerification = false) { if (string.IsNullOrEmpty(changesetId)) { return; } if (changesetId == "0") { return; } int intChangesetID; int.TryParse(changesetId, out intChangesetID); if (!changesetId.Trim().Equals(intChangesetID.ToString())) { return; } if (!IsVisualStudioIsConnectedToTfs()) { return; } if (requiresVerification) { ITfsServer tfs = new TfsServer(GlobalSettings.TFSServerURL); _changesets = new TfsChangesets(tfs, ErrorHandler); var changeset = _changesets.Get(int.Parse(changesetId)); if (changeset == null) { return; } } var cId = int.Parse(changesetId); if (cId == 0) { return; } TeamExplorer.NavigateToPage(new Guid(TeamExplorerPageIds.ChangesetDetails), cId); }
public virtual void Initialize(object sender, IServiceProvider provider, object context) { CurrentIntitializeSender = sender; if (serviceProvider != null) { UnsubscribeContextChanges(); } serviceProvider = provider; if (provider != null) { SubscribeContextChanges(); } if (TeamExplorer != null) { pageChangedEventHandler = TeamExplorer?.OnChange(() => TeamExplorer.CurrentPage, OnPageChanged, true); } }
/// <summary> /// Handler which enumerates issues for a Sonar project /// </summary> /// <param name="project">SonarQube project to query</param> /// <returns>Awaitable task which enumerates associated errors</returns> private async Task OnItemSelectAsync(SonarQubeProject project) { _projectPathsManager.TryGetValue(project.Key, out string projectLocalPath); IEnumerable <ErrorListItem> errors; try { errors = await _errorListProvider.GetErrorsAsync(project.Key, projectLocalPath); } catch { TeamExplorer.ShowNotification($"Failed to download issues for \"{project.Name}\".", NotificationType.Error, NotificationFlags.None, null, SonarErrorsNotificationId); return; } TeamExplorer.HideNotification(SonarErrorsNotificationId); if (errors.Any()) { if (!Path.IsPathRooted(errors.First().FileName)) { TeamExplorer.ShowNotification("Unable to resolve local file path for issues. Make sure project local path is correctly configured.", NotificationType.Warning, NotificationFlags.None, null, FilePathResolutionNotificationId); } else { TeamExplorer.HideNotification(FilePathResolutionNotificationId); } } ErrorTable.CleanAllErrors(); ErrorTable.AddErrors(project.Name, errors); _projectIssuesInView = project.Key; }
/// <summary> /// Refreshes the Sonar projects /// </summary> /// <returns>Awaitable task which completes when all projects are loaded</returns> public async System.Threading.Tasks.Task RefreshAsync() { try { IsBusy = true; await ViewModel.RefreshAsync(); TeamExplorer.HideNotification(ProjectLoadNotificationId); } catch { // Await until we are in the main thread context to be able // to access the View's ViewModel without issues await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); TeamExplorer.ShowNotification("Failed to load projects.", NotificationType.Error, NotificationFlags.None, null, ProjectLoadNotificationId); } finally { IsBusy = false; } }
public static void OpenWorkItem(string workitem) { TeamExplorer.NavigateToPage(new Guid(TeamExplorerPageIds.WorkItems), workitem); }