Exemple #1
0
        private async Task CloneCreateRepoAsync()
        {
            var projects = await GetProjectsAsync();

            if (!projects.Any())
            {
                return;
            }

            var result = CsrCloneWindow.PromptUser(projects);

            if (result == null)
            {
                return;
            }

            var repoItem = result.RepoItem;

            Repositories.Add(repoItem);

            // Created a new repo and cloned locally
            if (result.JustCreatedRepo)
            {
                var msg = String.Format(Resources.CsrCreateRepoNotificationFormat, repoItem.Name, repoItem.LocalPath);
                _teamExplorer.ShowMessage(msg,
                                          command: new ProtectedAsyncCommand(
                                              async() =>
                {
                    SetRepoActive(repoItem);
                    await ShellUtils.Default.LaunchCreateSolutionDialogAsync(repoItem.LocalPath);
                    _teamExplorer.ShowHomeSection();
                }));
            }
            else
            {
                var msg = String.Format(Resources.CsrCloneRepoNotificationFormat, repoItem.Name, repoItem.LocalPath);
                _teamExplorer.ShowMessage(msg,
                                          command: new ProtectedCommand(() =>
                {
                    SetRepoActive(repoItem);
                    _teamExplorer.ShowHomeSection();
                }));
            }
        }
 public CsrReposViewModel(ITeamExplorerUtils teamExplorer)
 {
     _teamExplorer          = teamExplorer.ThrowIfNull(nameof(teamExplorer));
     ListDoubleClickCommand = new ProtectedCommand(() =>
     {
         SetRepoActive(SelectedRepository);
         // Note, the order is critical.
         // When switching to HomeSection, current "this" object is destroyed.
         _teamExplorer.ShowHomeSection();
     });
     CloneCreateRepoCommand = new ProtectedAsyncCommand(CloneCreateRepoAsync);
 }