예제 #1
0
        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");
            }
        }
예제 #3
0
 public IConnection Get() => serviceProvider.TryGetService <IConnection>();
 public object TryGetService(string typename) => theRealProvider.TryGetService(typename);
예제 #5
0
        public void ShowConnectPage()
        {
            var te = serviceProvider.TryGetService <ITeamExplorer>();

            te.NavigateToPage(new Guid(TeamExplorerPageIds.Connect), null);
        }
예제 #6
0
 public ConnectionRepositoryHostMap(IGitHubServiceProvider provider, IRepositoryHosts hosts)
     : this(provider.TryGetService <IConnection>(), hosts)
 {
 }
예제 #7
0
 protected AddConnectionCommand(IGitHubServiceProvider serviceProvider)
     : base(CommandSet, CommandId)
 {
     dialogService = new Lazy <IDialogService>(() => serviceProvider.TryGetService <IDialogService>());
 }