private void LoadRepositories() { IReadOnlyList <Repository> known = null; IReadOnlyList <Project> remotes = null; Exception ex = null; Task.Run(async() => { try { remotes = await _web.GetProjectsAsync(); known = Registry.GetKnownRepositories(); } catch (Exception e) { ex = e; } }).ContinueWith(async tsk => { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); if (ex == null) { Repositories.Clear(); var activeRepository = _teamexplorer.GetActiveRepository(); var valid = new List <Repository>(); if (known != null) { foreach (var k in known) { var r = remotes.FirstOrDefault(o => o.Name == k.Name); if (r != null) { k.Icon = r.Icon; valid.Add(k); } } } if (activeRepository != null) { var matched = valid.FirstOrDefault(o => string.Equals(o.Path, activeRepository.Path, StringComparison.OrdinalIgnoreCase)); if (matched != null) { matched.IsActived = true; } } valid.Each(o => Repositories.Add(o)); } else if (!(ex is UnauthorizedAccessException)) { _teamexplorer.ShowMessage(ex.Message); } }, TaskScheduler.Default).Forget(); }
private void OnPublish() { CreateResult result = null; string error = null; IsBusy = true; Task.Run(async() => { try { result = await _web.CreateProjectAsync(RepositoryName, RepositoryDescription, IsPrivate); if (result.Project != null) { var activeRepository = _tes.GetActiveRepository(); var path = activeRepository == null ? _tes.GetSolutionPath() : activeRepository.Path; var user = await _storage.GetUserAsync(); var password = _storage.GetPassword(); _git.PushWithLicense(user.Username, user.Email, 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()).Forget(); }
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(); } }); }
public override void Execute() { var repo = _tes.GetActiveRepository(); OpenInBrowser($"graphs/{repo.Branch}"); }
public override void Execute() { var repo = _tes.GetActiveRepository(); OpenInBrowser(_tes.Project.StatisticsUrl); }