/// <summary> /// Determines whether this instance is connected. /// </summary> /// <returns></returns> public bool IsConnected() { var dteService = Package.GetGlobalService(typeof(EnvDTE.DTE)) as EnvDTE.DTE; if (dteService == null) { Debug.WriteLine("[PlanWorkItemController] DTE Service is null."); return false; } var teamExplorer = (ITeamExplorer)(Package.GetGlobalService(typeof(ITeamExplorer))); teamFoundationServerExt = (dteService.GetObject("Microsoft.VisualStudio.TeamFoundation.TeamFoundationServerExt") as TeamFoundationServerExt); TfsClient tfsClient = new TfsClient(teamFoundationServerExt); return tfsClient.IsTeamProjectConnnected(); }
/// <summary> /// Called when [plan work item]. /// </summary> /// <param name="workItemIds">The work item ids.</param> public void OnPlanWorkItem(int[] workItemIds, bool areWorkItemsSelected = true) { var dteService = Package.GetGlobalService(typeof(EnvDTE.DTE)) as EnvDTE.DTE; if (dteService == null) { Debug.WriteLine("[PlanWorkItemController] DTE Service is null."); return; } var teamExplorer = (ITeamExplorer)(Package.GetGlobalService(typeof(ITeamExplorer))); teamFoundationServerExt = (dteService.GetObject("Microsoft.VisualStudio.TeamFoundation.TeamFoundationServerExt") as TeamFoundationServerExt); TfsClient tfsClient = new TfsClient(teamFoundationServerExt); teamExplorer.NavigateToPage(new Guid(PlanWorkItemPage.PageId), new PlanWorkItemPageModel() { WorkItemIds = workItemIds, UsersAvailableForAssign = tfsClient.GetUsers(), ConfigurationFilePath = TFSScrumExtensionsPackage.ConfigurationFilePath, AvailableWorkItemTypes = tfsClient.GetWorkItemsTypes(), AvailableWorkItemLinkTypes = tfsClient.GetWorkItemLinkTypes(), TfsClient = tfsClient, AreWorkItemsSelected = areWorkItemsSelected }); }