async Task CheckLogin() { // this is not a github repo, or it hasn't been published yet if (ActiveRepo == null || ActiveRepoUri == null) { return; } var isgithub = await IsAGitHubRepo(); if (!isgithub) { return; } vsServices.ClearNotifications(); var add = HostAddress.Create(ActiveRepoUri); bool loggedIn = await connectionManager.IsLoggedIn(hosts, add); if (!loggedIn) { var msg = string.Format(CultureInfo.CurrentUICulture, Resources.NotLoggedInMessage, add.Title, add.Title); vsServices.ShowMessage( msg, new RelayCommand(() => StartFlow(UIControllerFlow.Authentication)) ); } }
private IObservable <Unit> OnPublishRepository(object arg) { var newRepository = GatherRepositoryInfo(); var account = SelectedAccount; return(repositoryPublishService.PublishRepository(newRepository, account, SelectedHost.ApiClient) .SelectUnit() .Do(_ => vsServices.ShowMessage("Repository published successfully.")) .Catch <Unit, Exception>(ex => { if (!ex.IsCriticalException()) { log.Error(ex); var error = new PublishRepositoryUserError(ex.Message); vsServices.ShowError((error.ErrorMessage + Environment.NewLine + error.ErrorCauseOrResolution).TrimEnd()); } return Observable.Return(Unit.Default); })); }
IObservable <ProgressState> OnPublishRepository(object arg) { var newRepository = GatherRepositoryInfo(); var account = SelectedAccount; return(repositoryPublishService.PublishRepository(newRepository, account, SelectedHost.ApiClient) .Select(_ => { vsServices.ShowMessage("Repository published successfully."); return ProgressState.Success; }) .Catch <ProgressState, Exception>(ex => { if (!ex.IsCriticalException()) { log.Error(ex); var error = new PublishRepositoryUserError(ex.Message); vsServices.ShowError((error.ErrorMessage + Environment.NewLine + error.ErrorCauseOrResolution).TrimEnd()); } return Observable.Return(ProgressState.Fail); })); }