コード例 #1
0
 private void DisconnectListener()
 {
     this.indexer = null;
     if (this.collectionChangedListener != null)
     {
         this.collectionChangedListener.Disconnect();
         this.collectionChangedListener = null;
     }
     if (this.propertyListener != null)
     {
         this.propertyListener.Disconnect();
         this.propertyListener = null;
     }
 }
コード例 #2
0
 private bool ConnectToIndexerInSource()
 {
     if (this.source == null || this.source == DependencyProperty.UnsetValue)
     {
         return(false);
     }
     this.indexer = this.FindIndexerProperty(this.source);
     if (this.indexer == null)
     {
         return(false);
     }
     if (this.propertyListener == null)
     {
         this.propertyListener = IndexerListener.CreateListener(this, this.source, this.index, this.intIndexer, this.indexer, this.listenToChanges);
     }
     if (this.listenToChanges)
     {
         this.collectionChangedListener = WeakCollectionChangedListener.CreateIfNecessary(this.source, this);
     }
     return(true);
 }
コード例 #3
0
 private bool ConnectToPropertyInSource(bool isSourceCollectionViewCurrentItem)
 {
     if (this.source == null || this.source == DependencyProperty.UnsetValue)
     {
         return false;
     }
     if (this.propertyListener == null || this.propertyListener.SourceType != this.source.GetType())
     {
         this.propertyListener = null;
         if (this.property != null && this.source is DependencyObject)
         {
             this.propertyListener = new DependencyPropertyListener(this, this.source.GetType(), this.property, this.listenToChanges);
         }
         else if (this.source is DependencyObject)
         {
             DependencyObject dependencyObject = (DependencyObject)this.source;
             DependencyProperty dependencyProperty = PropertyAccessPathStep.GetRegisteredDependencyProperty(dependencyObject, this.propertyName);
             if (dependencyProperty != null)
             {
                 this.propertyListener = new DependencyPropertyListener(this, this.source.GetType(), dependencyProperty, this.listenToChanges);
             }
         }
         if (this.propertyListener == null && this.propertyName != null)
         {
             PropertyInfo property = this.source.GetType().GetProperty(this.propertyName);
             if (property != null)
             {
                 this.propertyListener = new CLRPropertyListener(this, this.source.GetType(), property, this.listenToChanges);
             }
         }
     }
     if (this.propertyListener == null)
     {
         if (!isSourceCollectionViewCurrentItem)
         {
             ICollectionView collectionViews = this.source as ICollectionView;
             if (collectionViews != null)
             {
                 this.source = collectionViews.CurrentItem;
                 this.collectionView = collectionViews;
                 this.collectionView.CurrentChanged += new EventHandler(this.CurrentItemChanged);
                 return this.ConnectToPropertyInSource(true);
             }
         }
         string str = this.propertyName;
         string str1 = this.source != null ? this.source.ToString() : "null";
         string str2 = this.source != null ? this.source.GetType().ToString() : "null";
         string str3 = this.source != null ? this.source.GetHashCode().ToString() : "0";
         CultureInfo currentCulture = CultureInfo.CurrentCulture;
     }
     else
     {
         this.propertyListener.Source = this.source;
         try
         {
             object value = this.propertyListener.Value;
         }
         catch (Exception e)
         {
             Debug.WriteLine(e.ToString());
             if (e is OutOfMemoryException || e is StackOverflowException || e is AccessViolationException || e is ThreadAbortException)
             {
                 throw;
             }
             string propertyName = this.propertyListener.PropertyName;
             string str5 = this.propertyListener.PropertyType.ToString();
             string str6 = this.source != null ? this.source.ToString() : "null";
             string str7 = this.source != null ? this.source.GetType().ToString() : "null";
             this.Disconnect();
             CultureInfo cultureInfo = CultureInfo.CurrentCulture;
         }
     }
     return this.propertyListener != null;
 }
コード例 #4
0
 public void RaisePropertyPathStepChanged(PropertyListener source)
 {
     this.Listener.RaisePropertyPathStepChanged(this);
 }
コード例 #5
0
ファイル: IndexerPathStep.cs プロジェクト: evnik/UIFramework
 private void DisconnectListener()
 {
     this.indexer = null;
     if (this.collectionChangedListener != null)
     {
         this.collectionChangedListener.Disconnect();
         this.collectionChangedListener = null;
     }
     if (this.propertyListener != null)
     {
         this.propertyListener.Disconnect();
         this.propertyListener = null;
     }
 }
コード例 #6
0
ファイル: IndexerPathStep.cs プロジェクト: evnik/UIFramework
 private bool ConnectToIndexerInSource()
 {
     if (this.source == null || this.source == DependencyProperty.UnsetValue)
     {
         return false;
     }
     this.indexer = this.FindIndexerProperty(this.source);
     if (this.indexer == null)
     {
         return false;
     }
     if (this.propertyListener == null)
     {
         this.propertyListener = IndexerListener.CreateListener(this, this.source, this.index, this.intIndexer, this.indexer, this.listenToChanges);
     }
     if (this.listenToChanges)
     {
         this.collectionChangedListener = WeakCollectionChangedListener.CreateIfNecessary(this.source, this);
     }
     return true;
 }
コード例 #7
0
        private bool ConnectToPropertyInSource(bool isSourceCollectionViewCurrentItem)
        {
            if (this.source == null || this.source == DependencyProperty.UnsetValue)
            {
                return(false);
            }

            var sourceType = this.source.GetType();

            if (this.propertyListener == null || this.propertyListener.SourceType != sourceType)
            {
                this.propertyListener = null;
                var dependencyObject = this.source as DependencyObject;
                if (dependencyObject != null)
                {
                    var dependencyProperty = this.property ?? DependencyProperty.GetRegisteredDependencyProperty(dependencyObject, this.propertyName);
                    if (dependencyProperty != null)
                    {
                        this.propertyListener = new DependencyPropertyListener(this, sourceType, dependencyProperty, this.listenToChanges);
                    }
                }

                if (this.propertyListener == null && this.propertyName != null)
                {
                    var property = sourceType.GetProperty(this.propertyName);
                    if (property != null)
                    {
                        this.propertyListener = new CLRPropertyListener(this, sourceType, property, this.listenToChanges);
                    }
                }
            }

            if (this.propertyListener == null)
            {
                if (!isSourceCollectionViewCurrentItem)
                {
                    var collectionViews = this.source as ICollectionView;
                    if (collectionViews != null)
                    {
                        this.source         = collectionViews.CurrentItem;
                        this.collectionView = collectionViews;
                        this.collectionView.CurrentChanged += this.CurrentItemChanged;
                        return(this.ConnectToPropertyInSource(true));
                    }
                }
            }
            else
            {
                this.propertyListener.Source = this.source;
                try
                {
                    object value = this.propertyListener.Value;
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e);
                    if (e is OutOfMemoryException || e is StackOverflowException || e is AccessViolationException || e is ThreadAbortException)
                    {
                        throw;
                    }

                    this.Disconnect();
                }
            }

            return(this.propertyListener != null);
        }
コード例 #8
0
 public void RaisePropertyPathStepChanged(PropertyListener source)
 {
     this.Listener.RaisePropertyPathStepChanged(this);
 }