Пример #1
0
 public void Dispose()
 {
     if (_parent != null)
     {
         _parent.RemoveSubscription(this);
         _parent = null;
     }
 }
Пример #2
0
        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();
        }
Пример #3
0
        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));
        }
Пример #4
0
 public Subscription(KeyWatcher parent, IObserver <char> observer)
 {
     _parent  = parent;
     Observer = observer;
 }