Ejemplo n.º 1
0
        private XamlFileDefinition Visit(XamlXmlReader reader)
        {
            WriteState(reader);

            var xamlFile = new XamlFileDefinition();

            do
            {
                switch (reader.NodeType)
                {
                case XamlNodeType.StartObject:
                    _depth++;
                    xamlFile.Objects.Add(VisitObject(reader, null));
                    break;

                case XamlNodeType.NamespaceDeclaration:
                    xamlFile.Namespaces.Add(reader.Namespace);
                    break;

                default:
                    throw new InvalidOperationException();
                }
            }while (reader.Read());

            return(xamlFile);
        }
Ejemplo n.º 2
0
 public XamlTypeResolver(XamlFileDefinition definition)
 {
     FileDefinition                = definition;
     _findType                     = SourceFindType;
     _findType                     = _findType.AsMemoized();
     _isAttachedProperty           = Funcs.Create <Type, string, bool>(SourceIsAttachedProperty).AsLockedMemoized();
     _findPropertyTypeByXamlMember = Funcs.Create <XamlMember, Type>(SourceFindPropertyType).AsLockedMemoized();
     _findPropertyTypeByName       = Funcs.Create <string, string, Type>(SourceFindPropertyType).AsLockedMemoized();
     _findContentProperty          = Funcs.Create <Type, PropertyInfo>(SourceFindContentProperty).AsLockedMemoized();
 }