Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Results = new ReactiveList<string>();
var canSearch = this.WhenAny(x => x.SearchTerm, x => !string.IsNullOrWhiteSpace(x.Value) && x.Value.Length >= 3);
SearchCmd = ReactiveCommand.CreateFromTask<string, IEnumerable<string>>(term => _movieService.GetMovies(term), canSearch);
SearchCmd.Subscribe(results =>
{
Results.Clear();
Results.AddRange(results);
});
this.WhenAnyValue(x => x.SearchTerm)
.Throttle(TimeSpan.FromMilliseconds(500))
.InvokeCommand(SearchCmd);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment