private void ConfigureAddCommand() { var canLoad = this.WhenAny(x => x.Adding, (a) => !a.Value); AddRepositoriesCommand = ReactiveCommand.CreateFromObservable(_cacheService.LoadNextRepositories, canLoad); AddRepositoriesCommand.IsExecuting.ToPropertyEx(this, x => x.Adding); AddRepositoriesCommand.ThrownExceptions.SelectMany(ex => ExceptionInteraction.Handle(ex)).Subscribe(); AddRepositoriesCommand.Subscribe(_repositoriesData.AddRange); }
private void ConfigureAddCommand() { var canAdd = this.WhenAny(x => x.Adding, x => x.Complete, (a, c) => !a.Value && !c.Value); AddCommand = ReactiveCommand.CreateFromTask(async() => { ItemTreshold = -1; return(await _cacheService.LoadNextPullRequests()); }, canAdd); AddCommand.IsExecuting.ToPropertyEx(this, x => x.Adding); AddCommand.ThrownExceptions.SelectMany(ex => ExceptionInteraction.Handle(ex)).Subscribe(); AddCommand.Where(x => x != null && x.Any()) .Do(async api => await AddPullRequest(api)) .Subscribe(); }
private void ConfigureAddCommand() { var canAdd = this.WhenAny(x => x.Search, search => string.IsNullOrEmpty(search.Value)); LoadNext = ReactiveCommand.CreateFromTask(async() => { ItemTreshold = -1; return(await _cacheService.LoadNextRepositories()); }, canAdd); LoadNext.IsExecuting.ToPropertyEx(this, x => x.Adding); LoadNext.ThrownExceptions.SelectMany(ex => ExceptionInteraction.Handle(ex)).Subscribe(); LoadNext.Where(x => x != null && x.Any()) .Do(async cache => await AddRepositories(cache)).Subscribe(); }
private void ConfigureAddCommand() { var canAdd = this.WhenAny(x => x.Adding, x => x.Complete, (a, c) => !a.Value && !c.Value); AddCommand = ReactiveCommand.CreateFromObservable(_cacheService.LoadNextPullRequests, canAdd); AddCommand.IsExecuting.ToPropertyEx(this, x => x.Adding); AddCommand.ThrownExceptions.SelectMany(ex => ExceptionInteraction.Handle(ex)).Subscribe(); AddCommand.Subscribe(x => { //Check if there are more pull request if (x.Any()) { _pullRequestData.AddRange(x); } //Check if response has result per page configured on IGitHubApi if (!x.Any() || x.Count() < 50) { Complete = true; } }); }