public void Dispose() { if (_parent != null) { _parent.RemoveSubscription(this); _parent = null; } }
public static void BreakTextWithBuffers() { var keySource = new KeyWatcher(); IObservable <IList <char> > wordWindows = keySource.Buffer( () => keySource.FirstAsync(char.IsWhiteSpace)); IObservable <string> words = from wordWindow in wordWindows select new string(wordWindow.ToArray()).Trim(); }
public static void BreakTextWithWindows() { var keySource = new KeyWatcher(); IObservable <IObservable <char> > wordWindows = keySource.Window( () => keySource.FirstAsync(char.IsWhiteSpace)); IObservable <string> words = from wordWindow in wordWindows from chars in wordWindow.ToArray() select new string(chars).Trim(); words.Subscribe(word => Console.WriteLine("Word: " + word)); }
public Subscription(KeyWatcher parent, IObserver <char> observer) { _parent = parent; Observer = observer; }