public XamlDirective(IEnumerable <string> xamlNamespaces, string name, XamlType xamlType, XamlValueConverter <TypeConverter> typeConverter, AllowedMemberLocations allowedLocation) : base(name, new MemberReflector(xamlType, typeConverter))
 {
     if (xamlType == null)
     {
         throw new ArgumentNullException("xamlType");
     }
     this._xamlNamespaces  = GetReadOnly(xamlNamespaces);
     this._allowedLocation = allowedLocation;
 }
 public XamlDirective(IEnumerable<string> xamlNamespaces, string name, XamlType xamlType, XamlValueConverter<TypeConverter> typeConverter, AllowedMemberLocations allowedLocation) : base(name, new MemberReflector(xamlType, typeConverter))
 {
     if (xamlType == null)
     {
         throw new ArgumentNullException("xamlType");
     }
     this._xamlNamespaces = GetReadOnly(xamlNamespaces);
     this._allowedLocation = allowedLocation;
 }
Exemple #3
0
		public XamlDirective (IEnumerable<string> xamlNamespaces, string name, XamlType xamlType, XamlValueConverter<TypeConverter> typeConverter, AllowedMemberLocations allowedLocation)
			: base (true, xamlNamespaces != null ? xamlNamespaces.FirstOrDefault () : null, name)
		{
			if (xamlNamespaces == null)
				throw new ArgumentNullException ("xamlNamespaces");
			if (xamlType == null)
				throw new ArgumentNullException ("xamlType");

			type = xamlType;
			xaml_namespaces = new List<string> (xamlNamespaces);
			AllowedLocation = allowedLocation;
			type_converter = typeConverter;
			
			invoker = new DirectiveMemberInvoker (this);
		}
        XamlDirective(IEnumerable <string> xamlNamespaces, string name, XamlType xamlType, XamlValueConverter <TypeConverter> typeConverter, AllowedMemberLocations allowedLocation)
            : base(true, xamlNamespaces != null ? xamlNamespaces.FirstOrDefault() : null, name)
        {
            if (xamlNamespaces == null)
            {
                throw new ArgumentNullException("xamlNamespaces");
            }
            if (ReferenceEquals(xamlType, null))
            {
                throw new ArgumentNullException("xamlType");
            }

            type            = xamlType;
            xaml_namespaces = new List <string>(xamlNamespaces);
            AllowedLocation = allowedLocation;
            type_converter  = typeConverter;
        }
        void TestXamlDirectiveCommon(XamlDirective d, string name, string ns, AllowedMemberLocations allowedLocation, Type type, bool isUnknown)
        {
            Assert.AreEqual(allowedLocation, d.AllowedLocation, "#1");
            Assert.IsNull(d.DeclaringType, "#2");
            Assert.IsNotNull(d.Invoker, "#3");
            Assert.IsNull(d.Invoker.UnderlyingGetter, "#3-2");
            Assert.IsNull(d.Invoker.UnderlyingSetter, "#3-3");
            Assert.AreEqual(isUnknown, d.IsUnknown, "#4");
            Assert.IsTrue(d.IsReadPublic, "#5");
            Assert.IsTrue(d.IsWritePublic, "#6");
            Assert.AreEqual(name, d.Name, "#7");
            Assert.IsTrue(d.IsNameValid, "#8");
            Assert.AreEqual(ns, d.PreferredXamlNamespace, "#9");
            Assert.IsNull(d.TargetType, "#10");
            Assert.IsNotNull(d.Type, "#11");
            Assert.AreEqual(type, d.Type.UnderlyingType, "#11-2");

#if HAS_TYPE_CONVERTER
            // .NET returns StringConverter, but it should not premise that key must be string (it is object)
            if (name == "Key")
            {
                //Assert.IsNull (d.TypeConverter, "#12")
            }
            else if (type.GetTypeInfo().IsGenericType || name == "_Initialization" || name == "_UnknownContent")
            {
                Assert.IsNull(d.TypeConverter, "#12");
            }
            else
            {
                Assert.IsNotNull(d.TypeConverter, "#12");
            }
#endif
            Assert.IsNull(d.ValueSerializer, "#13");
            Assert.IsNull(d.DeferringLoader, "#14");
            Assert.IsNull(d.UnderlyingMember, "#15");
            Assert.IsFalse(d.IsReadOnly, "#16");
            Assert.IsFalse(d.IsWriteOnly, "#17");
            Assert.IsFalse(d.IsAttachable, "#18");
            Assert.IsFalse(d.IsEvent, "#19");
            Assert.IsTrue(d.IsDirective, "#20");
            Assert.IsNotNull(d.DependsOn, "#21");
            Assert.AreEqual(0, d.DependsOn.Count, "#21-2");
            Assert.IsFalse(d.IsAmbient, "#22");
            // TODO: Assert.AreEqual (DesignerSerializationVisibility.Visible, d.SerializationVisibility, "#23");
        }
Exemple #6
0
		void TestXamlDirectiveCommon (XamlDirective d, string name, AllowedMemberLocations allowedLocation, Type type)
		{
			TestXamlDirectiveCommon (d, name, XamlLanguage.Xaml2006Namespace, allowedLocation, type);
		}
 void TestXamlDirectiveCommon(XamlDirective d, string name, string ns, AllowedMemberLocations allowedLocation, Type type)
 {
     TestXamlDirectiveCommon(d, name, ns, allowedLocation, type, false);
 }
 void TestXamlDirectiveCommon(XamlDirective d, string name, AllowedMemberLocations allowedLocation, Type type)
 {
     TestXamlDirectiveCommon(d, name, XamlLanguage.Xaml2006Namespace, allowedLocation, type);
 }
 internal XamlDirective(IEnumerable<string> xamlNamespaces, string name, AllowedMemberLocations allowedLocation, MemberReflector reflector) : base(name, reflector)
 {
     this._xamlNamespaces = GetReadOnly(xamlNamespaces);
     this._allowedLocation = allowedLocation;
 }
		static XamlDirective FindStandardDirective (string name, AllowedMemberLocations loc)
		{
			return XamlLanguage.AllDirectives.FirstOrDefault (dd => (dd.AllowedLocation & loc) != 0 && dd.Name == name);
		}
 private static XamlDirective GetXamlDirective(string name, AllowedMemberLocations allowedLocation, MemberReflector reflector)
 {
     return(new XamlDirective(s_xamlNamespaces, name, allowedLocation, reflector));
 }
Exemple #12
0
 private static XamlDirective GetXamlDirective (string name, XamlType xamlType, XamlValueConverter<TypeConverter> typeConverter, AllowedMemberLocations allowedLocation)
 {
     return new XamlDirective(s_xamlNamespaces, name, xamlType, typeConverter, allowedLocation);
 }
Exemple #13
0
 private static XamlDirective GetXamlDirective (string name, AllowedMemberLocations allowedLocation /*, MemberReflector reflector*/)
 {
     return new XamlDirective(s_xamlNamespaces, name, /*allowedLocation, reflector*/null, null, allowedLocation);
 }
 public XamlDirective(string xamlNamespace, string name)
     : base(name, null)
 {
     _xamlNamespaces  = GetReadOnly(xamlNamespace);
     _allowedLocation = AllowedMemberLocations.Any;
 }
 internal XamlDirective(IEnumerable <string> xamlNamespaces, string name, AllowedMemberLocations allowedLocation, MemberReflector reflector)
     : base(name, reflector)
 {
     _xamlNamespaces  = GetReadOnly(xamlNamespaces);
     _allowedLocation = allowedLocation;
 }
Exemple #16
0
		void TestXamlDirectiveCommon (XamlDirective d, string name, string ns, AllowedMemberLocations allowedLocation, Type type)
		{
			TestXamlDirectiveCommon (d, name, ns, allowedLocation, type, false);
		}
Exemple #17
0
		void TestXamlDirectiveCommon (XamlDirective d, string name, string ns, AllowedMemberLocations allowedLocation, Type type, bool isUnknown)
		{
			Assert.AreEqual (allowedLocation, d.AllowedLocation, "#1");
			Assert.IsNull (d.DeclaringType, "#2");
			Assert.IsNotNull (d.Invoker, "#3");
			Assert.IsNull (d.Invoker.UnderlyingGetter, "#3-2");
			Assert.IsNull (d.Invoker.UnderlyingSetter, "#3-3");
			Assert.AreEqual (isUnknown, d.IsUnknown, "#4");
			Assert.IsTrue (d.IsReadPublic, "#5");
			Assert.IsTrue (d.IsWritePublic, "#6");
			Assert.AreEqual (name, d.Name, "#7");
			Assert.IsTrue (d.IsNameValid, "#8");
			Assert.AreEqual (ns, d.PreferredXamlNamespace, "#9");
			Assert.IsNull (d.TargetType, "#10");
			Assert.IsNotNull (d.Type, "#11");
			Assert.AreEqual (type, d.Type.UnderlyingType, "#11-2");

			// .NET returns StringConverter, but it should not premise that key must be string (it is object)
			if (name == "Key")
				;//Assert.IsNull (d.TypeConverter, "#12")
			else if (type.IsGenericType || name == "_Initialization" || name == "_UnknownContent")
				Assert.IsNull (d.TypeConverter, "#12");
			else
				Assert.IsNotNull (d.TypeConverter, "#12");
			Assert.IsNull (d.ValueSerializer, "#13");
			Assert.IsNull (d.DeferringLoader, "#14");
			Assert.IsNull (d.UnderlyingMember, "#15");
			Assert.IsFalse (d.IsReadOnly, "#16");
			Assert.IsFalse (d.IsWriteOnly, "#17");
			Assert.IsFalse (d.IsAttachable, "#18");
			Assert.IsFalse (d.IsEvent, "#19");
			Assert.IsTrue (d.IsDirective, "#20");
			Assert.IsNotNull (d.DependsOn, "#21");
			Assert.AreEqual (0, d.DependsOn.Count, "#21-2");
			Assert.IsFalse (d.IsAmbient, "#22");
			Assert.AreEqual (DesignerSerializationVisibility.Visible, d.SerializationVisibility, "#23");
		}
 private static XamlDirective GetXamlDirective(string name, XamlType xamlType, XamlValueConverter <TypeConverter> typeConverter, AllowedMemberLocations allowedLocation)
 {
     return(new XamlDirective(s_xamlNamespaces, name, xamlType, typeConverter, allowedLocation));
 }
Exemple #19
0
 static XamlDirective FindStandardDirective(string name, AllowedMemberLocations loc)
 {
     return(XamlLanguage.AllDirectives.FirstOrDefault(dd => (dd.AllowedLocation & loc) != 0 && dd.Name == name));
 }
 public XamlDirective(string xamlNamespace, string name) : base(name, null)
 {
     this._xamlNamespaces = GetReadOnly(xamlNamespace);
     this._allowedLocation = AllowedMemberLocations.Any;
 }