コード例 #1
0
        static XamlLanguage()
        {
            InitializingTypes = true;

            // types

            Array     = XT <ArrayExtension> ();
            Boolean   = XT <bool> ();
            Byte      = XT <byte> ();
            Char      = XT <char> ();
            Decimal   = XT <decimal> ();
            Double    = XT <double> ();
            Int16     = XT <short> ();
            Int32     = XT <int> ();
            Int64     = XT <long> ();
            Member    = XT <MemberDefinition> ();
            Null      = XT <NullExtension> ();
            Object    = XT <object> ();
            Property  = XT <PropertyDefinition> ();
            Reference = XT <Reference> ();
            Single    = XT <float> ();
            Static    = XT <StaticExtension> ();
            String    = XT <string> ();
            TimeSpan  = XT <TimeSpan> ();
            Type      = XT <TypeExtension> ();
            Uri       = XT <Uri> ();
            XData     = XT <XData> ();

            InitializingTypes = false;

            AllTypes = new ReadOnlyCollection <XamlType> (new XamlType [] { Array, Boolean, Byte, Char, Decimal, Double, Int16, Int32, Int64, Member, Null, Object, Property, Reference, Single, Static, String, TimeSpan, Type, Uri, XData });

            // directives

            // Looks like predefined XamlDirectives have no ValueSerializer.
            // To handle this situation, differentiate them from non-primitive XamlMembers.
            InitializingDirectives = true;

            var nss    = new string [] { XamlLanguage.Xaml2006Namespace };
            var nssXml = new string [] { XamlLanguage.Xml1998Namespace };

            Arguments            = new XamlDirective(nss, "Arguments", XT <List <object> > (), null, AllowedMemberLocations.Any);
            AsyncRecords         = new XamlDirective(nss, "AsyncRecords", XT <string> (), null, AllowedMemberLocations.Attribute);
            Base                 = new XamlDirective(nssXml, "base", XT <string> (), null, AllowedMemberLocations.Attribute);
            Class                = new XamlDirective(nss, "Class", XT <string> (), null, AllowedMemberLocations.Attribute);
            ClassAttributes      = new XamlDirective(nss, "ClassAttributes", XT <List <Attribute> > (), null, AllowedMemberLocations.MemberElement);
            ClassModifier        = new XamlDirective(nss, "ClassModifier", XT <string> (), null, AllowedMemberLocations.Attribute);
            Code                 = new XamlDirective(nss, "Code", XT <string> (), null, AllowedMemberLocations.Attribute);
            ConnectionId         = new XamlDirective(nss, "ConnectionId", XT <string> (), null, AllowedMemberLocations.Any);
            FactoryMethod        = new XamlDirective(nss, "FactoryMethod", XT <string> (), null, AllowedMemberLocations.Any);
            FieldModifier        = new XamlDirective(nss, "FieldModifier", XT <string> (), null, AllowedMemberLocations.Attribute);
            Initialization       = new XamlDirective(nss, "_Initialization", XT <object> (), null, AllowedMemberLocations.Any);
            Items                = new XamlDirective(nss, "_Items", XT <List <object> > (), null, AllowedMemberLocations.Any);
            Key                  = new XamlDirective(nss, "Key", XT <object> (), null, AllowedMemberLocations.Any);
            Lang                 = new XamlDirective(nssXml, "lang", XT <string> (), null, AllowedMemberLocations.Attribute);
            Members              = new XamlDirective(nss, "Members", XT <List <MemberDefinition> > (), null, AllowedMemberLocations.MemberElement);
            Name                 = new XamlDirective(nss, "Name", XT <string> (), null, AllowedMemberLocations.Attribute);
            PositionalParameters = new XamlDirective(nss, "_PositionalParameters", XT <List <object> > (), null, AllowedMemberLocations.Any);
            Space                = new XamlDirective(nssXml, "space", XT <string> (), null, AllowedMemberLocations.Attribute);
            Subclass             = new XamlDirective(nss, "Subclass", XT <string> (), null, AllowedMemberLocations.Attribute);
            SynchronousMode      = new XamlDirective(nss, "SynchronousMode", XT <string> (), null, AllowedMemberLocations.Attribute);
            Shared               = new XamlDirective(nss, "Shared", XT <string> (), null, AllowedMemberLocations.Attribute);
            TypeArguments        = new XamlDirective(nss, "TypeArguments", XT <string> (), null, AllowedMemberLocations.Attribute);
            Uid                  = new XamlDirective(nss, "Uid", XT <string> (), null, AllowedMemberLocations.Attribute);
            UnknownContent       = new XamlDirective(nss, "_UnknownContent", XT <object> (), null, AllowedMemberLocations.MemberElement)
            {
                InternalIsUnknown = true
            };

            AllDirectives = new ReadOnlyCollection <XamlDirective> (new XamlDirective [] { Arguments, AsyncRecords, Base, Class, ClassAttributes, ClassModifier, Code, ConnectionId, FactoryMethod, FieldModifier, Initialization, Items, Key, Lang, Members, Name, PositionalParameters, Space, Subclass, SynchronousMode, Shared, TypeArguments, Uid, UnknownContent });

            InitializingDirectives = false;

            SpecialNames = new SpecialTypeNameList();
        }
コード例 #2
0
ファイル: XamlXmlWriter.cs プロジェクト: Benrnz/Portable.Xaml
 static TypeExtensionMethods2()
 {
     SpecialNames = new SpecialTypeNameList();
 }