Пример #1
0
        private void AddProperties(SceneElement targetElement, ResourceEntryItem resource, System.Windows.Controls.ItemCollection menuItems)
        {
            Type filterType = (Type)null;
            bool flag       = true;

            if (PlatformTypes.Brush.IsAssignableFrom((ITypeId)resource.Resource.Type))
            {
                filterType = typeof(Brush);
            }
            else if (PlatformTypes.DrawingImage.IsAssignableFrom((ITypeId)resource.Resource.Type))
            {
                filterType = typeof(ImageSource);
            }
            else if (PlatformTypes.PlatformsCompatible(resource.Resource.ValueNode.Type.PlatformMetadata, targetElement.Type.PlatformMetadata))
            {
                IType   styleOrTemplateType;
                ITypeId typeAndTargetType = DocumentNodeUtilities.GetStyleOrTemplateTypeAndTargetType(resource.Resource.ValueNode, out styleOrTemplateType);
                if (typeAndTargetType != null)
                {
                    flag       = typeAndTargetType.IsAssignableFrom((ITypeId)targetElement.Type);
                    filterType = styleOrTemplateType.RuntimeType;
                }
            }
            else
            {
                flag = false;
            }
            if (!flag)
            {
                return;
            }
            int count = menuItems.Count;

            this.AddElementPropertiesWithTypeFilter(targetElement, resource, menuItems, filterType);
            if (menuItems.Count != count)
            {
                return;
            }
            this.AddElementPropertiesWithTypeFilter(targetElement, resource, menuItems, (Type)null);
        }