async Task Initialize() { if (initialized) { return; } // The services needed by the usage tracker are loaded when they are first needed to // improve the startup time of the extension. await JoinableTaskContext.Factory.SwitchToMainThreadAsync(); client = gitHubServiceProvider.TryGetService <IMetricsService>(); connectionManager = new Lazy <IConnectionManager>(() => gitHubServiceProvider.GetService <IConnectionManager>()); vsservices = gitHubServiceProvider.GetService <IVSServices>(); if (vsTelemetry) { log.Verbose("Creating VisualStudioUsageTracker"); visualStudioUsageTracker = new VisualStudioUsageTracker(connectionManager); } initialized = true; }
/// <summary> /// Shows the current pull request. /// </summary> public override async Task Execute() { try { var pullRequestSessionManager = serviceProvider.ExportProvider.GetExportedValueOrDefault <IPullRequestSessionManager>(); await pullRequestSessionManager.EnsureInitialized(); var session = pullRequestSessionManager?.CurrentSession; if (session == null) { return; // No active PR session. } var pullRequest = session.PullRequest; var manager = serviceProvider.TryGetService <IGitHubToolWindowManager>(); var host = await manager.ShowGitHubPane(); await host.ShowPullRequest(session.RepositoryOwner, host.LocalRepository.Name, pullRequest.Number); } catch (Exception ex) { log.Error(ex, "Error showing current pull request"); } }
public IConnection Get() => serviceProvider.TryGetService <IConnection>();
public object TryGetService(string typename) => theRealProvider.TryGetService(typename);
public void ShowConnectPage() { var te = serviceProvider.TryGetService <ITeamExplorer>(); te.NavigateToPage(new Guid(TeamExplorerPageIds.Connect), null); }
public ConnectionRepositoryHostMap(IGitHubServiceProvider provider, IRepositoryHosts hosts) : this(provider.TryGetService <IConnection>(), hosts) { }
protected AddConnectionCommand(IGitHubServiceProvider serviceProvider) : base(CommandSet, CommandId) { dialogService = new Lazy <IDialogService>(() => serviceProvider.TryGetService <IDialogService>()); }