/// <summary>
        /// This method is called when the cached value of the resource has
        /// been invalidated.  E.g. after a new Resources property is set somewhere
        /// in the ancestory.
        /// </summary>
        private void InvalidateCacheValue()
        {
            object resource = _cachedResourceValue;

            // If the old value was a DeferredResourceReference, it should be
            // removed from its Dictionary's list to avoid a leak (bug 1624666).
            DeferredResourceReference deferredResourceReference = _cachedResourceValue as DeferredResourceReference;

            if (deferredResourceReference != null)
            {
                if (deferredResourceReference.IsInflated)
                {
                    // use the inflated value for the Freezable test below
                    resource = deferredResourceReference.Value;
                }
                else
                {
                    // stop listening for the Inflated event
                    if (ReadInternalState(InternalState.IsListeningForInflated))
                    {
                        deferredResourceReference.RemoveInflatedListener(this);
                        WriteInternalState(InternalState.IsListeningForInflated, false);
                    }
                }

                deferredResourceReference.RemoveFromDictionary();
            }

            StopListeningForFreezableChanges(resource);

            _cachedResourceValue = null;
            WriteInternalState(InternalState.HasCachedResourceValue, false);
        }
 // Token: 0x06000881 RID: 2177 RVA: 0x0001BC70 File Offset: 0x00019E70
 internal void OnDeferredResourceInflated(DeferredResourceReference deferredResourceReference)
 {
     if (this.ReadInternalState(ResourceReferenceExpression.InternalState.IsListeningForInflated))
     {
         deferredResourceReference.RemoveInflatedListener(this);
         this.WriteInternalState(ResourceReferenceExpression.InternalState.IsListeningForInflated, false);
     }
     this.ListenForFreezableChanges(deferredResourceReference.Value);
 }
        // when a deferred resource reference is inflated, the value may need extra
        // work
        internal void OnDeferredResourceInflated(DeferredResourceReference deferredResourceReference)
        {
            if (ReadInternalState(InternalState.IsListeningForInflated))
            {
                // once the value is inflated, stop listening for the event
                deferredResourceReference.RemoveInflatedListener(this);
                WriteInternalState(InternalState.IsListeningForInflated, false);
            }

            ListenForFreezableChanges(deferredResourceReference.Value);
        }
        // Token: 0x0600087A RID: 2170 RVA: 0x0001BA78 File Offset: 0x00019C78
        private void InvalidateCacheValue()
        {
            object resource = this._cachedResourceValue;
            DeferredResourceReference deferredResourceReference = this._cachedResourceValue as DeferredResourceReference;

            if (deferredResourceReference != null)
            {
                if (deferredResourceReference.IsInflated)
                {
                    resource = deferredResourceReference.Value;
                }
                else if (this.ReadInternalState(ResourceReferenceExpression.InternalState.IsListeningForInflated))
                {
                    deferredResourceReference.RemoveInflatedListener(this);
                    this.WriteInternalState(ResourceReferenceExpression.InternalState.IsListeningForInflated, false);
                }
                deferredResourceReference.RemoveFromDictionary();
            }
            this.StopListeningForFreezableChanges(resource);
            this._cachedResourceValue = null;
            this.WriteInternalState(ResourceReferenceExpression.InternalState.HasCachedResourceValue, false);
        }
        // when a deferred resource reference is inflated, the value may need extra
        // work
        internal void OnDeferredResourceInflated(DeferredResourceReference deferredResourceReference)
        {
            if (ReadInternalState(InternalState.IsListeningForInflated))
            {
                // once the value is inflated, stop listening for the event
                deferredResourceReference.RemoveInflatedListener(this);
                WriteInternalState(InternalState.IsListeningForInflated, false);
            }

            ListenForFreezableChanges(deferredResourceReference.Value);
        }