예제 #1
0
 private IObservable<object> CreateObservableFromNodes(IEnumerable<InpcNode> subscriptions)
 {
     return subscriptions.Select(
         subscription => Observable.FromEventPattern<PropertyChangedEventHandler, PropertyChangedEventArgs>(
             ev => subscription.Parent.PropertyChanged += ev,
             handler => subscription.Parent.PropertyChanged -= handler)
             .Do(_ => this.mountPoint = new PropertyMountPoint(this.root, this.propertyPath))
             .Where(pattern => pattern.EventArgs.PropertyName == subscription.PropertyName))
             .Merge();
 }
예제 #2
0
        public ObservablePropertyBranch(object root, PropertyPath propertyPath)
        {
            Guard.ThrowIfNull(root, nameof(root));
            Guard.ThrowIfNull(propertyPath, nameof(propertyPath));

            this.root = root;
            this.propertyPath = propertyPath;
            this.mountPoint = new PropertyMountPoint(root, propertyPath);
            var subscriptions = this.GetInpcNodes();
            this.Changed = this.CreateObservableFromNodes(subscriptions);
        }
예제 #3
0
        public ObservablePropertyBranch(object instance, PropertyPath propertyPath)
        {
            Guard.ThrowIfNull(instance, nameof(instance));
            Guard.ThrowIfNull(propertyPath, nameof(propertyPath));

            _instance = instance;
            _propertyPath = propertyPath;
            _mountPoint = new PropertyMountPoint(instance, propertyPath);
            var properties = GetPropertiesThatRaiseNotifications();
            Values = CreateUnifiedObservableFromNodes(properties);
        }
예제 #4
0
        public ObservablePropertyBranch(object instance, PropertyPath propertyPath)
        {
            Guard.ThrowIfNull(instance, nameof(instance));
            Guard.ThrowIfNull(propertyPath, nameof(propertyPath));

            _instance     = instance;
            _propertyPath = propertyPath;
            _mountPoint   = new PropertyMountPoint(instance, propertyPath);
            var properties = GetPropertiesThatRaiseNotifications();

            Values = CreateUnifiedObservableFromNodes(properties);
        }