Exemple #1
0
        protected async override void RepoChanged(bool changed)
        {
            IsLoggedIn = true;
            IsVisible  = false;

            base.RepoChanged(changed);

            IsVisible = await IsAGitHubRepo();

            if (IsVisible)
            {
                RepoName = ActiveRepoName;
                RepoUrl  = ActiveRepoUri.ToString();
                Icon     = GetIcon(false, true, false);

                // We want to display a welcome message but only if Team Explorer isn't
                // already displaying the "Install 3rd Party Tools" message and the current repo is hosted on GitHub.
                if (!settings.HideTeamExplorerWelcomeMessage && !IsGitToolsMessageVisible())
                {
                    ShowWelcomeMessage();
                }

                Debug.Assert(SimpleApiClient != null,
                             "If we're in this block, simpleApiClient cannot be null. It was created by UpdateStatus");
                var repo = await SimpleApiClient.GetRepository();

                Icon       = GetIcon(repo.Private, true, repo.Fork);
                IsLoggedIn = await IsUserAuthenticated();
            }
            else
            {
                teamExplorerServices.HideNotification(welcomeMessageGuid);
            }
        }
Exemple #2
0
        void ShowWelcomeMessage()
        {
            var welcomeMessageGuid = new Guid(Guids.TeamExplorerWelcomeMessage);

            teamExplorerServices.ShowMessage(
                Resources.TeamExplorerWelcomeMessage,
                new RelayCommand(o =>
            {
                var str = o.ToString();

                switch (str)
                {
                case "show-training":
                    visualStudioBrowser.OpenUrl(new Uri(TrainingUrl));
                    usageTracker.IncrementWelcomeTrainingClicks().Forget();
                    break;

                case "show-docs":
                    visualStudioBrowser.OpenUrl(new Uri(GitHubUrls.Documentation));
                    usageTracker.IncrementWelcomeDocsClicks().Forget();
                    break;

                case "dont-show-again":
                    teamExplorerServices.HideNotification(welcomeMessageGuid);
                    settings.HideTeamExplorerWelcomeMessage = true;
                    settings.Save();
                    break;
                }
            }),
                false,
                welcomeMessageGuid);
        }