public void Refresh()
 {
     if (!string.IsNullOrEmpty(_tes.GetSolutionPath()))
     {
         var url = _git?.GetRemote(_tes.GetSolutionPath());
         ShowGetStarted = string.IsNullOrEmpty(url) || !url.ToLower().StartsWith("https://gitee.com");
     }
     else
     {
         ShowGetStarted = false;
     }
 }
        private void OnOpenRepository(Repository repo)
        {
            if (repo == null)
            {
                return;
            }

            var solution = _teamexplorer.GetSolutionPath();

            if (solution == null || !string.Equals(repo.Path, solution.TrimEnd('\\'), StringComparison.OrdinalIgnoreCase))
            {
                _messenger.Send("OnOpenSolution", repo.Path);
            }
        }
        private void OnPublish()
        {
            CreateProjectResult result = null;
            string error = null;

            IsBusy = true;

            Task.Run(() =>
            {
                try
                {
                    result = _web.CreateProject(RepositoryName, RepositoryDescription, IsPrivate);
                    if (result.Project != null)
                    {
                        var activeRepository = _tes.GetActiveRepository();

                        var path = activeRepository == null ? _tes.GetSolutionPath() : activeRepository.Path;

                        var user     = _storage.GetUser();
                        var password = _storage.GetPassword(user.Host);

                        _git.PushWithLicense(user.Name, user.Email, user.Username, password, result.Project.Url, path, SelectedLicense);
                    }
                }
                catch (Exception ex)
                {
                    error = ex.Message;
                    _tes.ShowError(ex.Message);
                }
            }).ContinueWith(task =>
            {
                IsBusy = false;
                if (error != null)
                {
                    _tes.ShowError(error);
                }
                else if (result.Message != null)
                {
                    _tes.ShowError(result.Message);
                }
                else
                {
                    IsStarted      = false;
                    ShowGetStarted = true;
                    OnPublished();
                }
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }
        private void OnPublish()
        {
            CreateProjectResult result = null;
            string error = null;

            IsBusy = true;
            ThreadHelper.JoinableTaskFactory.RunAsync(async() =>
            {
                try
                {
                    result = _web.CreateProject(RepositoryName, RepositoryDescription, SelectedVisibilityLevels);
                    if (result.Project != null)
                    {
                        var activeRepository = _tes.GetActiveRepository();

                        var path = activeRepository == null ? _tes.GetSolutionPath() : activeRepository.Path;

                        var user     = _storage.GetUser();
                        var password = _storage.GetPassword(user.Host);

                        _git.PushWithLicense(user.Name, user.Email, user.Username, password, result.Project.Url, path, SelectedLicense);
                    }
                }
                catch (Exception ex)
                {
                    error = ex.Message;
                    _tes.ShowError(ex.Message);
                }
                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
                IsBusy = false;
                if (error != null)
                {
                    _tes.ShowError(error);
                }
                else if (result.Message != null)
                {
                    _tes.ShowError(result.Message);
                }
                else
                {
                    IsStarted      = false;
                    ShowGetStarted = true;
                    OnPublished();
                }
            });
        }