Skip to content

Instantly share code, notes, and snippets.

@tomwis
Created October 22, 2017 17:53
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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