コード例 #1
0
ファイル: PropertyAccessTree.cs プロジェクト: git-thinh/clinq
        public SubscriptionTree CreateSubscriptionTree(INotifyPropertyChanged parameter)
        {
            List <SubscriptionNode> subscribers = new List <SubscriptionNode>(this.Children.Count);

            for (int i = 0; i < this.Children.Count; i++)
            {
                PropertyAccessTreeNode child = this.Children[i];
                if (child.Children.Count > 0)
                {
                    var subscriptionNode = child.CreateSubscription(parameter);
                    subscribers.Add(subscriptionNode);
                }
            }
            var subscriptionTree = new SubscriptionTree(parameter, subscribers);

            return(subscriptionTree);
        }
コード例 #2
0
        private void SubscribeToItem(T item)
        {
            bool wasFirstTimeAddedToCollection = this.ReferenceCountTracker.Add(item);

            if (!wasFirstTimeAddedToCollection || !this.IsMonitoringChildProperties)
            {
                return;
            }

            if (_propertyChangedSubscription != null)
            {
                _propertyChangedSubscription.SubscribeToChanges((INotifyPropertyChanged)item, this);
            }
            else
            {
                SubscriptionTree subscriptionTree = this.PropertyAccessTree.CreateSubscriptionTree((INotifyPropertyChanged)item);
                subscriptionTree.PropertyChanged += OnAnyPropertyChangeInSubscriptionTree;
                this.Subscriptions.Add(item, subscriptionTree);
            }
        }
コード例 #3
0
        internal void SubscribeToChanges(T subject)
        {
            if (EntireTreeSupportINotifyPropertyChanging)
            {
                if (_PropertyAccessTree == null)
                {
                    _PropertyAccessTree = PropertyAccessTree.CreateCallbackSubscription <PropertyNotifier <T> >(OnItemChanging, OnItemChanged);
                }
                _PropertyAccessTree.SubscribeToChanges(subject, this);
            }
            else
            {
                if (_Subscriptions == null)
                {
                    _Subscriptions = new Dictionary <T, SubscriptionTree>();
                }

                SubscriptionTree tree = PropertyAccessTree.CreateSubscriptionTree(subject);
                tree.PropertyChanged += OnAnyPropertyChangeInSubscriptionTree;
                _Subscriptions.Add(subject, tree);
            }
        }
コード例 #4
0
 private void OnAnyPropertyChangeInSubscriptionTree(SubscriptionTree sender)
 {
     OnItemChanged(this, sender.Parameter, null);
 }
コード例 #5
0
 void OnAnyPropertyChangeInSubscriptionTree(SubscriptionTree sender)
 {
     OnAnyPropertyChange(this, sender.Parameter);
 }