private object TryProvideValueWithDiagnosticEvent(IServiceProvider serviceProvider, bool allowDeferredReference, bool mustReturnDeferredResourceReference) { IProvideValueTarget provideValueTarget = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget; if (provideValueTarget == null || provideValueTarget.TargetObject == null || provideValueTarget.TargetProperty == null || ResourceDictionaryDiagnostics.ShouldIgnoreProperty(provideValueTarget.TargetProperty)) { // if there's no target, or target is ignorable, get the value the quick way. return(TryProvideValueImpl(serviceProvider, allowDeferredReference, mustReturnDeferredResourceReference)); } ResourceDictionaryDiagnostics.LookupResult result; object value; bool success = false; try { // request a result of the lookup result = ResourceDictionaryDiagnostics.RequestLookupResult(this); // do the lookup - the ResourceDictionary that resolves the reference will fill in the result value = TryProvideValueImpl(serviceProvider, allowDeferredReference, mustReturnDeferredResourceReference); // for the purposes of diagnostics, a deferred reference is a success - // we only need the dictionary that holds the value, not the value itself DeferredResourceReference deferredReference = value as DeferredResourceReference; if (deferredReference != null) { success = true; ResourceDictionary dict = deferredReference.Dictionary; if (dict != null) { // the result may not have been recorded yet ResourceDictionaryDiagnostics.RecordLookupResult(ResourceKey, dict); } } else { success = (value != DependencyProperty.UnsetValue); } } finally { // revert the request ResourceDictionaryDiagnostics.RevertRequest(this, success); } // raise the diagnostic event if (success) { ResourceDictionaryDiagnostics.OnStaticResourceResolved(provideValueTarget.TargetObject, provideValueTarget.TargetProperty, result); } return(value); }
// Token: 0x06000863 RID: 2147 RVA: 0x0001B3DC File Offset: 0x000195DC private object TryProvideValueWithDiagnosticEvent(IServiceProvider serviceProvider, bool allowDeferredReference, bool mustReturnDeferredResourceReference) { IProvideValueTarget provideValueTarget = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget; if (provideValueTarget == null || provideValueTarget.TargetObject == null || provideValueTarget.TargetProperty == null || ResourceDictionaryDiagnostics.ShouldIgnoreProperty(provideValueTarget.TargetProperty)) { return(this.TryProvideValueImpl(serviceProvider, allowDeferredReference, mustReturnDeferredResourceReference)); } bool flag = false; ResourceDictionaryDiagnostics.LookupResult result; object obj; try { result = ResourceDictionaryDiagnostics.RequestLookupResult(this); obj = this.TryProvideValueImpl(serviceProvider, allowDeferredReference, mustReturnDeferredResourceReference); DeferredResourceReference deferredResourceReference = obj as DeferredResourceReference; if (deferredResourceReference != null) { flag = true; ResourceDictionary dictionary = deferredResourceReference.Dictionary; if (dictionary != null) { ResourceDictionaryDiagnostics.RecordLookupResult(this.ResourceKey, dictionary); } } else { flag = (obj != DependencyProperty.UnsetValue); } } finally { ResourceDictionaryDiagnostics.RevertRequest(this, flag); } if (flag) { ResourceDictionaryDiagnostics.OnStaticResourceResolved(provideValueTarget.TargetObject, provideValueTarget.TargetProperty, result); } return(obj); }