private object FindResourceInEnviroment(IServiceProvider serviceProvider,
                                                bool allowDeferredReference,
                                                bool mustReturnDeferredResourceReference)
        {
            ResourceDictionary dictionaryWithKey = FindTheResourceDictionary(serviceProvider, /* isDeferredContentSearch */ false);

            if (dictionaryWithKey != null)
            {
                object value = dictionaryWithKey.Lookup(ResourceKey, allowDeferredReference, mustReturnDeferredResourceReference, canCacheAsThemeResource: false);
                return(value);
            }

            // Look at app or themes
            object val = FindResourceInAppOrSystem(serviceProvider, allowDeferredReference, mustReturnDeferredResourceReference);

            if (val == null)
            {
                val = DependencyProperty.UnsetValue;
            }

            if (mustReturnDeferredResourceReference)
            {
                if (!(val is DeferredResourceReference))
                {
                    val = new DeferredResourceReferenceHolder(ResourceKey, val);
                }
            }
            return(val);
        }
        // Token: 0x06000866 RID: 2150 RVA: 0x0001B70C File Offset: 0x0001990C
        internal object FindResourceInDeferredContent(IServiceProvider serviceProvider, bool allowDeferredReference, bool mustReturnDeferredResourceReference)
        {
            ResourceDictionary resourceDictionary = this.FindTheResourceDictionary(serviceProvider, true);
            object             obj = DependencyProperty.UnsetValue;

            if (resourceDictionary != null)
            {
                obj = resourceDictionary.Lookup(this.ResourceKey, allowDeferredReference, mustReturnDeferredResourceReference, false);
            }
            if (mustReturnDeferredResourceReference && obj == DependencyProperty.UnsetValue)
            {
                obj = new DeferredResourceReferenceHolder(this.ResourceKey, obj);
            }
            return(obj);
        }
        internal object FindResourceInDeferredContent(IServiceProvider serviceProvider, bool allowDeferredReference, bool mustReturnDeferredResourceReference)
        {
            ResourceDictionary dictionaryWithKey = FindTheResourceDictionary(serviceProvider, /* isDeferredContentSearch */ true);
            object             value             = DependencyProperty.UnsetValue;

            if (dictionaryWithKey != null)
            {
                value = dictionaryWithKey.Lookup(ResourceKey, allowDeferredReference, mustReturnDeferredResourceReference, canCacheAsThemeResource: false);
            }
            if (mustReturnDeferredResourceReference && value == DependencyProperty.UnsetValue)
            {
                value = new DeferredResourceReferenceHolder(ResourceKey, value);
            }
            return(value);
        }
        // Token: 0x06000868 RID: 2152 RVA: 0x0001B78C File Offset: 0x0001998C
        private object FindResourceInEnviroment(IServiceProvider serviceProvider, bool allowDeferredReference, bool mustReturnDeferredResourceReference)
        {
            ResourceDictionary resourceDictionary = this.FindTheResourceDictionary(serviceProvider, false);

            if (resourceDictionary != null)
            {
                return(resourceDictionary.Lookup(this.ResourceKey, allowDeferredReference, mustReturnDeferredResourceReference, false));
            }
            object obj = this.FindResourceInAppOrSystem(serviceProvider, allowDeferredReference, mustReturnDeferredResourceReference);

            if (obj == null)
            {
                obj = DependencyProperty.UnsetValue;
            }
            if (mustReturnDeferredResourceReference && !(obj is DeferredResourceReference))
            {
                obj = new DeferredResourceReferenceHolder(this.ResourceKey, obj);
            }
            return(obj);
        }