Esempio n. 1
0
        public void TriggerTest()
        {
            var baseline        = new System.Reactive.Subjects.BehaviorSubject <int>(0);
            var outerCollection = new ObservableCollection <Observable>(Enumerable.Range(1, 10).Select(i => new Observable(2 * i + 1)));
            var innerCollection = new ObservableCollection <Notify>(Enumerable.Range(1, 5).Select(i => new Notify {
                Prop = i
            }));
            var zrool = new ZipReadOnlyObservableList <Observable, Notify, int>(outerCollection, innerCollection,
                                                                                (x, y) => x.Subject.CombineLatest(y.ObserveAll().Select(b => b.Prop), (a, b) => a + b).CombineLatest(baseline, (a, b) => a + b));
            var copy = zrool.ListSelect(x => x);

            outerCollection[8].Prop = 4;
            innerCollection[2].Prop = 0;
            outerCollection[3].Prop = 100;

            var expectedValues = new HashSet <int>(outerCollection.Zip(innerCollection, (x, y) => x.Prop + y.Prop + baseline.Value));

            Assert.IsTrue(expectedValues.SetEquals(zrool));
            Assert.IsTrue(expectedValues.SetEquals(copy));

            baseline.OnNext(2);

            expectedValues = new HashSet <int>(outerCollection.Zip(innerCollection, (x, y) => x.Prop + y.Prop + baseline.Value));
            Assert.IsTrue(expectedValues.SetEquals(zrool));
            Assert.IsTrue(expectedValues.SetEquals(copy));
        }
        public void TriggerTest()
        {
            var baseline        = new System.Reactive.Subjects.BehaviorSubject <int>(0);
            var outerCollection = new ObservableCollection <Observable>(Enumerable.Range(1, 10).Select(i => new Observable(2 * i + 1)));
            var innerCollection = new ObservableCollection <Notify>(Enumerable.Range(1, 10).Select(i => new Notify {
                Prop = i
            }));
            var ijrooc = new InnerJoinReadOnlyObservableCollection <Observable, Notify, int, int>(outerCollection, innerCollection,
                                                                                                  x => x.Subject, x => x.ObserveAll().Select(i => i.Prop), (x, y) => baseline.Select(v => v + x.Prop + y.Prop));
            var copy = ijrooc.ListSelect(x => x);

            outerCollection[8].Prop = 4;
            innerCollection[8].Prop = 0;

            var expectedValues = new HashSet <int>(
                from x in outerCollection join y in innerCollection on x.Prop equals y.Prop select x.Prop + y.Prop);

            Assert.IsTrue(expectedValues.SetEquals(ijrooc));
            Assert.IsTrue(expectedValues.SetEquals(copy));

            baseline.OnNext(2);

            expectedValues = new HashSet <int>(
                from x in outerCollection join y in innerCollection on x.Prop equals y.Prop select x.Prop + y.Prop + baseline.Value);
            Assert.IsTrue(expectedValues.SetEquals(ijrooc));
            Assert.IsTrue(expectedValues.SetEquals(copy));
        }
        public void foo()
        {
            var s = new System.Reactive.Subjects.BehaviorSubject <bool>(true);

            Observable
            .Return(3)
            .TakeUntil(s)
            .Subscribe(
                _ => System.Diagnostics.Debug.WriteLine("GOT VALUE"),
                () => System.Diagnostics.Debug.WriteLine("DONE"));
        }
        public void foo()
        {
            var s = new System.Reactive.Subjects.BehaviorSubject<bool>(true);

            Observable
                .Return(3)
                .TakeUntil(s)
                .Subscribe(
                    _ => System.Diagnostics.Debug.WriteLine("GOT VALUE"),
                    () => System.Diagnostics.Debug.WriteLine("DONE"));
        }
Esempio n. 5
0
 public Camera(System.Reactive.Subjects.BehaviorSubject <Settings.GraphicsSettings.ProjectionSetting> projection)
 {
     this.projection = projection;
 }