示例#1
0
        private static XamlDirective GetXmlDirective(string name)
        {
            XamlDirective result = new XamlDirective(s_xmlNamespaces, name, String,
                                                     BuiltInValueConverter.String, AllowedMemberLocations.Attribute);

            return(result);
        }
示例#2
0
 public static bool operator ==(XamlMember xamlMember1, XamlMember xamlMember2)
 {
     if (ReferenceEquals(xamlMember1, xamlMember2))
     {
         return(true);
     }
     if (xamlMember1 is null || xamlMember2 is null)
     {
         return(false);
     }
     if (xamlMember1._memberType != xamlMember2._memberType || xamlMember1.Name != xamlMember2.Name)
     {
         return(false);
     }
     if (xamlMember1.IsDirective)
     {
         Debug.Assert(xamlMember2.IsDirective);
         // DeclaringType is null for directives, so we need to compare namespaces.
         // Known and unknown directives are equal if the names and namespaces match
         return(XamlDirective.NamespacesAreEqual((XamlDirective)xamlMember1, (XamlDirective)xamlMember2));
     }
     else
     {
         // Known and unknown members are not equal, even if they otherwise match
         return(xamlMember1.DeclaringType == xamlMember2.DeclaringType &&
                xamlMember1.IsUnknown == xamlMember2.IsUnknown);
     }
 }
示例#3
0
        private static XamlDirective GetXamlDirective(string name, XamlType xamlType,
                                                      XamlValueConverter <TypeConverter> typeConverter, AllowedMemberLocations allowedLocation)
        {
            XamlDirective result = new XamlDirective(s_xamlNamespaces, name, xamlType,
                                                     typeConverter, allowedLocation);

            return(result);
        }
示例#4
0
 private static ReadOnlyCollection <XamlDirective> GetAllDirectives()
 {
     XamlDirective[] result = new XamlDirective[]
     { Arguments, AsyncRecords, Class, Code, ClassModifier, ConnectionId, FactoryMethod, FieldModifier,
       Key, Initialization, Items, Members, ClassAttributes, Name, PositionalParameters, Shared, Subclass,
       SynchronousMode, TypeArguments, Uid, UnknownContent, Base, Lang, Space };
     return(new ReadOnlyCollection <XamlDirective>(result));
 }
示例#5
0
        // We use the private field _xamlNamespaces to avoid expensive lookups or mutable
        // return values from overriden implementations of GetXamlNamespaces. But this will produce
        // hard-to-understand behavior if the namespaces returned from GetXamlNamespaces are different
        // from the ones passed in the ctor. Ideally we would provide overridable equality here.
        internal static bool NamespacesAreEqual(XamlDirective directive1, XamlDirective directive2)
        {
            IList <string> ns1 = directive1._xamlNamespaces;
            IList <string> ns2 = directive2._xamlNamespaces;

            if (ns1.Count != ns2.Count)
            {
                return(false);
            }
            for (int i = 0; i < ns1.Count; i++)
            {
                if (ns1[i] != ns2[i])
                {
                    return(false);
                }
            }
            return(true);
        }
示例#6
0
        private static XamlDirective GetXamlDirective(string name, AllowedMemberLocations allowedLocation, MemberReflector reflector)
        {
            XamlDirective result = new XamlDirective(s_xamlNamespaces, name, allowedLocation, reflector);

            return(result);
        }