IObservable <ProgressState> OnPublishRepository(object arg) { var newRepository = GatherRepositoryInfo(); var account = SelectedAccount; return(repositoryPublishService.PublishRepository(newRepository, account, SelectedHost.ApiClient) .Select(_ => ProgressState.Success) .Catch <ProgressState, Exception>(ex => { if (!ex.IsCriticalException()) { log.Error(ex); var error = new PublishRepositoryUserError(ex.Message); notificationService.ShowError((error.ErrorMessage + Environment.NewLine + error.ErrorCauseOrResolution).TrimEnd()); } return Observable.Return(ProgressState.Fail); })); }
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() { var newRepository = GatherRepositoryInfo(); var account = SelectedAccount; var modelService = modelServiceFactory.CreateBlocking(SelectedConnection); return(repositoryPublishService.PublishRepository(newRepository, account, modelService.ApiClient) .Do(_ => usageTracker.IncrementCounter(x => x.NumberOfReposPublished).Forget()) .Select(_ => ProgressState.Success) .Catch <ProgressState, Exception>(ex => { if (!ex.IsCriticalException()) { log.Error(ex, "Error Publishing Repository"); var error = new PublishRepositoryUserError(ex.Message); notificationService.ShowError((error.ErrorMessage + Environment.NewLine + error.ErrorCauseOrResolution).TrimEnd()); } return Observable.Return(ProgressState.Fail); })); }