Sorry if the title is not very clear, I could not come up with anything better ...
I get user input in the form of IObservable<char> , and I would like to convert it to IObservable<char[]> , grouping characters every time the user stops typing for more than 1 second. So, for example, if the input looks like this:
h e l l o (pause) w o r l d (pause) ! (pause)
I would like the output observable to be:
['h', 'e', 'l', 'l', 'o'] ['w', 'o', 'r', 'l', 'd'] ['!']
I suspect the solution is pretty simple, but I cannot find the right approach ... I tried using Buffer , GroupByUntil , Throttle and several others to no avail.
Any idea would be welcome!
EDIT: I have something that almost works:
_input.Buffer(() => _input.Delay(TimeSpan.FromSeconds(1))) .ObserveOnDispatcher() .Subscribe(OnCompleteInput);
But I need a reset delay every time a new character is typed ...
Thomas levesque
source share