Beispiel #1
0
            private void UpdateAttachedProperties(Type reflectionType, AttachedPropertiesMetadata.AttachedPropertyMetadataBackgroundWorker.AttachedPropertyReferenceAssembly assemblyTuple)
            {
                Type runtimeType = assemblyTuple.RuntimeAssembly.GetType(reflectionType.FullName);

                if (runtimeType == (Type)null || !runtimeType.IsPublic && !this.IsTypeFromProjectAssembly(runtimeType))
                {
                    return;
                }
                IEnumerable <AttachedPropertyMetadata> attachedProperties = Enumerable.Select(Enumerable.Where(Enumerable.Select(Enumerable.Where <MethodInfo>((IEnumerable <MethodInfo>)reflectionType.GetMethods(BindingFlags.Static | BindingFlags.Public), (Func <MethodInfo, bool>)(methodInfo => this.IsAttachedPropertyGetterMethod(reflectionType, methodInfo))), methodInfo => new
                {
                    methodInfo    = methodInfo,
                    runtimeMethod = this.GetRuntimeMethodInfo(runtimeType, methodInfo)
                }), param0 => param0.runtimeMethod != (MethodInfo)null), param0 => new AttachedPropertyMetadata(param0.runtimeMethod, param0.methodInfo));

                this.ReplacePropertiesForType(reflectionType, attachedProperties);
            }
Beispiel #2
0
            private void InitializeTypeProcess_Complete(object sender, EventArgs e)
            {
                Dictionary <AttachedPropertiesMetadata.AttachedPropertyMetadataBackgroundWorker.AttachedPropertyReferenceAssembly, Type[]> dictionary = new Dictionary <AttachedPropertiesMetadata.AttachedPropertyMetadataBackgroundWorker.AttachedPropertyReferenceAssembly, Type[]>();

                lock (this.typeDictionaryLock)
                {
                    foreach (KeyValuePair <AttachedPropertiesMetadata.AttachedPropertyMetadataBackgroundWorker.AttachedPropertyReferenceAssembly, Type[]> item_0 in this.typeDictionary)
                    {
                        dictionary.Add(item_0.Key, item_0.Value);
                    }
                }
                lock (this.initializeListSyncLock)
                {
                    if (dictionary.Count != 0)
                    {
                        if (this.initializeListProcess == null)
                        {
                            this.initializeListProcess           = new AsyncQueueProcess((IAsyncMechanism) new BackgroundWorkerAsyncMechanism(BackgroundWorkMode.ThreadHog));
                            this.initializeListProcess.Complete += new EventHandler(this.OnInitializeListProcessComplete);
                        }
                        foreach (KeyValuePair <AttachedPropertiesMetadata.AttachedPropertyMetadataBackgroundWorker.AttachedPropertyReferenceAssembly, Type[]> item_1 in dictionary)
                        {
                            AttachedPropertiesMetadata.AttachedPropertyMetadataBackgroundWorker.AttachedPropertyReferenceAssembly assemblies = item_1.Key;
                            this.initializeListProcess.Add((AsyncProcess) new EnumeratingAsyncProcess <Type>((IAsyncMechanism)null, (IEnumerable <Type>)item_1.Value, (Action <Type>)(type =>
                            {
                                lock (this.properties)
                                {
                                    if (this.initializeListProcess == null || !this.initializeListProcess.IsAlive)
                                    {
                                        return;
                                    }
                                    this.UpdateAttachedProperties(type, assemblies);
                                }
                            })), true);
                        }
                    }
                    else
                    {
                        this.IsActive = false;
                    }
                }
            }