Beispiel #1
0
        public void IntervalTest()
        {
            Observable.Timer(TimeSpan.FromMilliseconds(1)).Monitor("Start", 0).Subscribe();

            IObservable <long> xs = Observable.Interval(TimeSpan.FromSeconds(0.5))
                                    .Take(30);

            xs = xs.Monitor("Source", 1);

            IConnectableObservable <long> cs = xs.Publish();

            cs = cs.Monitor("Connectable", 2);
            cs.Subscribe();

            Thread.Sleep(2000);
            IDisposable connection = cs.Connect();

            Thread.Sleep(2000);
            connection.Dispose();

            Thread.Sleep(100);
            GC.KeepAlive(cs);
        }