コード例 #1
0
        public void receives_on_binding_before_subscribing()
        {
            Init();

            int testInt = 0;

            var eventStream = new Subject <int>();

            testObject.Bind(eventStream);

            testObject.Subscribe(i => testInt += 1);

            eventStream.OnNext(1);

            Assert.Equal(1, testInt);
        }
コード例 #2
0
        /// <summary>
        /// Bind event streams to the current list bindings.
        /// </summary>
        public void BindEventStreams()
        {
            propertyChangingEventStream.Bind(Observable
                                             .Merge(bindings.Select(b => b.PropertyChangingEventStream)));

            propertyChangedEventStream.Bind(Observable
                                            .Merge(bindings.Select(b => b.PropertyChangedEventStream)));

            collectionChangedEventStream.Bind(Observable
                                              .Merge(bindings.Select(b => b.CollectionChangedEventStream))
                                              .Merge(listCollectionChangedEvents));
        }
コード例 #3
0
        /// <summary>
        /// Connect the binding to an array.
        /// </summary>
        public void Connect(object obj)
        {
            Argument.NotNull(() => obj);

            Disconnect();

            array    = (Array)obj;
            bindings = bindingsFactory.CreateArrayBindings(array);

            propertyChangingEventStream.Bind(Observable
                                             .Merge(this.bindings
                                                    .Select(b => b.PropertyChangingEventStream)
                                                    ));

            propertyChangedEventStream.Bind(Observable
                                            .Merge(this.bindings
                                                   .Select(b => b.PropertyChangedEventStream)
                                                   ));

            collectionChangedEventStream.Bind(Observable
                                              .Merge(this.bindings
                                                     .Select(b => b.CollectionChangedEventStream)
                                                     ));
        }