Beispiel #1
0
        public void DefaultValuesWithComplexParams()
        {
            var d = new XamlDirective(new string [0], "Foo", new XamlType(typeof(object), sctx), null, AllowedMemberLocations.Any);

            Assert.AreEqual(AllowedMemberLocations.Any, 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.IsFalse(d.IsUnknown, "#4");              // different from another test
            Assert.IsTrue(d.IsReadPublic, "#5");
            Assert.IsTrue(d.IsWritePublic, "#6");
            Assert.AreEqual("Foo", d.Name, "#7");
            Assert.IsTrue(d.IsNameValid, "#8");
            Assert.AreEqual(null, d.PreferredXamlNamespace, "#9");              // different from another test (as we specified empty array above)
            Assert.IsNull(d.TargetType, "#10");
            Assert.IsNotNull(d.Type, "#11");
            Assert.AreEqual(typeof(object), d.Type.UnderlyingType, "#11-2");
            Assert.IsNull(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");
        }
        public XamlMember GetNoDotAttributeProperty(XamlType tagType, XamlPropertyName propName, string tagNamespace, string propUsageNamespace, bool tagIsRoot)
        {
            XamlMember xamlAttachableProperty = null;

            if ((propUsageNamespace == tagNamespace) || (((tagNamespace == null) && (propUsageNamespace != null)) && tagType.GetXamlNamespaces().Contains(propUsageNamespace)))
            {
                XamlType rootObjectType = tagIsRoot ? tagType : null;
                xamlAttachableProperty = this.GetXamlProperty(tagType, propName.Name, rootObjectType);
                if (xamlAttachableProperty == null)
                {
                    xamlAttachableProperty = this.GetXamlAttachableProperty(tagType, propName.Name);
                }
            }
            if ((xamlAttachableProperty == null) && (propUsageNamespace != null))
            {
                XamlDirective xamlDirective = this.SchemaContext.GetXamlDirective(propUsageNamespace, propName.Name);
                if (xamlDirective != null)
                {
                    if ((xamlDirective.AllowedLocation & AllowedMemberLocations.Attribute) == AllowedMemberLocations.None)
                    {
                        xamlDirective = new XamlDirective(propUsageNamespace, propName.Name);
                    }
                    xamlAttachableProperty = xamlDirective;
                }
            }
            if (xamlAttachableProperty != null)
            {
                return(xamlAttachableProperty);
            }
            if (tagNamespace == propUsageNamespace)
            {
                return(new XamlMember(propName.Name, tagType, false));
            }
            return(new XamlDirective(propUsageNamespace, propName.Name));
        }
Beispiel #3
0
 public void ConstructorComplexParamsNullNamespaces()
 {
     Assert.Throws(typeof(ArgumentNullException), () =>
     {
         var d = new XamlDirective(null, "Foo", new XamlType(typeof(object), sctx), null, AllowedMemberLocations.Any);
     });
 }
        private XamlNode Logic_StartInitProperty(XamlType ownerType)
        {
            XamlDirective initialization = XamlLanguage.Initialization;

            this._context.CurrentMember = initialization;
            return(new XamlNode(XamlNodeType.StartMember, initialization));
        }
Beispiel #5
0
        internal bool TryGetAliasedProperty(XamlDirective directive, out XamlMember member)
        {
            member = null;
            if (IsUnknown)
            {
                return(true);
            }
            bool result = false;

            if (directive == XamlLanguage.Key)
            {
                result = _dictionaryKeyProperty.IsSet;
                member = _dictionaryKeyProperty.Value;
            }
            else if (directive == XamlLanguage.Name)
            {
                result = _runtimeNameProperty.IsSet;
                member = _runtimeNameProperty.Value;
            }
            else if (directive == XamlLanguage.Uid)
            {
                result = _uidProperty.IsSet;
                member = _uidProperty.Value;
            }
            else if (directive == XamlLanguage.Lang)
            {
                result = _xmlLangProperty.IsSet;
                member = _xmlLangProperty.Value;
            }
            else if (_aliasedProperties != null)
            {
                result = _aliasedProperties.TryGetValue(directive, out member);
            }
            return(result);
        }
Beispiel #6
0
        public void DefaultValuesWithName()
        {
            var d = new XamlDirective("urn:foo", "Foo");

            Assert.AreEqual(AllowedMemberLocations.Any, 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.IsTrue(d.IsUnknown, "#4");
            Assert.IsTrue(d.IsReadPublic, "#5");
            Assert.IsTrue(d.IsWritePublic, "#6");
            Assert.AreEqual("Foo", d.Name, "#7");
            Assert.IsTrue(d.IsNameValid, "#8");
            Assert.AreEqual("urn:foo", d.PreferredXamlNamespace, "#9");
            Assert.IsNull(d.TargetType, "#10");
            Assert.IsNotNull(d.Type, "#11");
            Assert.AreEqual(typeof(object), d.Type.UnderlyingType, "#11-2");
            Assert.IsNull(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");
        }
 internal void TryAddAliasedProperty(XamlDirective directive, XamlMember member)
 {
     if (directive == XamlLanguage.Key)
     {
         this._dictionaryKeyProperty.Value = member;
     }
     else if (directive == XamlLanguage.Name)
     {
         this._runtimeNameProperty.Value = member;
     }
     else if (directive == XamlLanguage.Uid)
     {
         this._uidProperty.Value = member;
     }
     else if (directive == XamlLanguage.Lang)
     {
         this._xmlLangProperty.Value = member;
     }
     else
     {
         if (this._aliasedProperties == null)
         {
             ConcurrentDictionary <XamlDirective, XamlMember> dictionary = XamlSchemaContext.CreateDictionary <XamlDirective, XamlMember>();
             Interlocked.CompareExchange <ConcurrentDictionary <XamlDirective, XamlMember> >(ref this._aliasedProperties, dictionary, null);
         }
         this._aliasedProperties.TryAdd(directive, member);
     }
 }
Beispiel #8
0
 internal void TryAddAliasedProperty(XamlDirective directive, XamlMember member)
 {
     Debug.Assert(!IsUnknown);
     if (directive == XamlLanguage.Key)
     {
         _dictionaryKeyProperty.Value = member;
     }
     else if (directive == XamlLanguage.Name)
     {
         _runtimeNameProperty.Value = member;
     }
     else if (directive == XamlLanguage.Uid)
     {
         _uidProperty.Value = member;
     }
     else if (directive == XamlLanguage.Lang)
     {
         _xmlLangProperty.Value = member;
     }
     else
     {
         if (_aliasedProperties == null)
         {
             var dict = XamlSchemaContext.CreateDictionary <XamlDirective, XamlMember>();
             Interlocked.CompareExchange(ref _aliasedProperties, dict, null);
         }
         _aliasedProperties.TryAdd(directive, member);
     }
 }
Beispiel #9
0
        public void ConstructorNameNull()
        {
            // wow, it is allowed.
            var d = new XamlDirective(String.Empty, null);

            Assert.IsNull(d.Name, "#1");
        }
Beispiel #10
0
        public XamlMember GetNoDotAttributeProperty(XamlType tagType, XamlPropertyName propName,
                                                    string tagNamespace, string propUsageNamespace, bool tagIsRoot)
        {
            XamlMember property = null;

            // workaround: tagNamespace will always be null coming from MeScanner.
            // Second line of if just handles tagNamespace always being null from MEScanner
            // Correct fix is to fix MEScanner and remove second line
            if ((propUsageNamespace == tagNamespace) ||
                (tagNamespace == null && propUsageNamespace != null && tagType.GetXamlNamespaces().Contains(propUsageNamespace)))
            {
                XamlType rootTagType = tagIsRoot ? tagType : null;
                property = GetXamlProperty(tagType, propName.Name, rootTagType);

                // Sometimes Attached properties look like normal properties.
                // [Attribute case] The above lookup fails and fall into here.
                // <Grid> <Grid Row="0"/> </Grid>
                if (property == null)
                {
                    property = GetXamlAttachableProperty(tagType, propName.Name);
                }
            }
            // Not Simple, not Attachable, look for Directives.
            if (property == null && propUsageNamespace != null)
            {
                // A processing attribute like;  x:Key  x:Name
                XamlDirective directive = SchemaContext.GetXamlDirective(propUsageNamespace, propName.Name);
                if (directive != null)
                {
                    if (AllowedMemberLocations.None == (directive.AllowedLocation & AllowedMemberLocations.Attribute))
                    {
                        // Need a way to surface up this usage error now that
                        // we don't have UnknownProperty.Exception
                        directive = new XamlDirective(propUsageNamespace, propName.Name);
                    }
                    property = directive;
                }
            }
            if (property == null)
            {
                if (tagNamespace == propUsageNamespace)
                {
                    // Unknown simple property
                    property = new XamlMember(propName.Name, tagType, false);
                }
                else
                {
                    // Unknown directive
                    property = new XamlDirective(propUsageNamespace, propName.Name);
                }
            }
            return(property);
        }
Beispiel #11
0
 protected override XamlMember LookupAliasedProperty(XamlDirective directive)
 {
     if (directive == XamlLanguage.Name)
     {
         // mono doesn't support the name attribute yet (throws null exception)
         if (!EtoEnvironment.Platform.IsMono)
         {
             var nameAttribute = GetCustomAttribute <RuntimeNamePropertyAttribute>();
             if (nameAttribute != null && nameAttribute.Name != null)
             {
                 return(GetMember(nameAttribute.Name));
             }
         }
     }
     return(base.LookupAliasedProperty(directive));
 }
        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");
        }
Beispiel #13
0
        protected override XamlMember LookupAliasedProperty(XamlDirective directive)
        {
            if (directive == XamlLanguage.Name)
            {
                if (nameAliasedProperty != null)
                {
                    return(nameAliasedProperty);
                }

                var nameAttribute = GetCustomAttribute <RuntimeNamePropertyAttribute>();
                if (nameAttribute != null && nameAttribute.Name != null)
                {
                    nameAliasedProperty = GetMember(nameAttribute.Name);
                    return(nameAliasedProperty);
                }
            }
            return(base.LookupAliasedProperty(directive));
        }
 // Token: 0x06001583 RID: 5507 RVA: 0x00069BB4 File Offset: 0x00067DB4
 protected override XamlMember LookupAliasedProperty(XamlDirective directive)
 {
     if (directive == XamlLanguage.Name)
     {
         return(this.CallGetMember(this._runtimeNamePropertyName));
     }
     if (directive == XamlLanguage.Key && this._dictionaryKeyPropertyName != null)
     {
         return(this.LookupMember(this._dictionaryKeyPropertyName, true));
     }
     if (directive == XamlLanguage.Lang)
     {
         return(this.CallGetMember(this._xmlLangPropertyName));
     }
     if (directive == XamlLanguage.Uid)
     {
         return(this.CallGetMember(this._uidPropertyName));
     }
     return(null);
 }
        internal bool TryGetAliasedProperty(XamlDirective directive, out XamlMember member)
        {
            member = null;
            if (this.IsUnknown)
            {
                return(true);
            }
            bool isSet = false;

            if (directive == XamlLanguage.Key)
            {
                isSet  = this._dictionaryKeyProperty.IsSet;
                member = this._dictionaryKeyProperty.Value;
                return(isSet);
            }
            if (directive == XamlLanguage.Name)
            {
                isSet  = this._runtimeNameProperty.IsSet;
                member = this._runtimeNameProperty.Value;
                return(isSet);
            }
            if (directive == XamlLanguage.Uid)
            {
                isSet  = this._uidProperty.IsSet;
                member = this._uidProperty.Value;
                return(isSet);
            }
            if (directive == XamlLanguage.Lang)
            {
                isSet  = this._xmlLangProperty.IsSet;
                member = this._xmlLangProperty.Value;
                return(isSet);
            }
            if (this._aliasedProperties != null)
            {
                isSet = this._aliasedProperties.TryGetValue(directive, out member);
            }
            return(isSet);
        }
 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);
 }
 public DirectiveAssignment(XamlDirective directive, string value)
 {
     this.directive = directive;
     this.value = value;
 }
		public void ConstructorNameNull ()
		{
			// wow, it is allowed.
			var d = new XamlDirective (String.Empty, null);
			Assert.IsNull (d.Name, "#1");
		}
		public void DefaultValuesWithName ()
		{
			var d = new XamlDirective ("urn:foo", "Foo");
			Assert.AreEqual (AllowedMemberLocations.Any, 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.IsTrue (d.IsUnknown, "#4");
			Assert.IsTrue (d.IsReadPublic, "#5");
			Assert.IsTrue (d.IsWritePublic, "#6");
			Assert.AreEqual ("Foo", d.Name, "#7");
			Assert.IsTrue (d.IsNameValid, "#8");
			Assert.AreEqual ("urn:foo", d.PreferredXamlNamespace, "#9");
			Assert.IsNull (d.TargetType, "#10");
			Assert.IsNotNull (d.Type, "#11");
			Assert.AreEqual (typeof (object), d.Type.UnderlyingType, "#11-2");
			Assert.IsNull (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");
			// TODO: Assert.AreEqual (DesignerSerializationVisibility.Visible, d.SerializationVisibility, "#23");
		}
 public DirectiveAssignment(XamlDirective directive, string value)
 {
     this.directive = directive;
     this.value     = value;
 }
		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");
			// TODO: Assert.AreEqual (DesignerSerializationVisibility.Visible, d.SerializationVisibility, "#23");
		}
Beispiel #23
0
 public void ConstructorComplexParams()
 {
     var d = new XamlDirective(new string [] { "urn:foo" }, "Foo", new XamlType(typeof(object), sctx), null, AllowedMemberLocations.Any);
 }
		void TestXamlDirectiveCommon (XamlDirective d, string name, AllowedMemberLocations allowedLocation, Type type)
		{
			TestXamlDirectiveCommon (d, name, XamlLanguage.Xaml2006Namespace, allowedLocation, type);
		}
Beispiel #25
0
 public void ConstructorComplexParamsEmptyNamespaces()
 {
     var d = new XamlDirective(new string [0], "Foo", new XamlType(typeof(object), sctx), null, AllowedMemberLocations.Any);
 }
		void TestXamlDirectiveCommon (XamlDirective d, string name, string ns, AllowedMemberLocations allowedLocation, Type type)
		{
			TestXamlDirectiveCommon (d, name, ns, allowedLocation, type, false);
		}
        public override void WriteStartObject(XamlType type)
        {
            if (type.UnderlyingType == typeof(string))
            {
                isWritingElementStyleString = true;
            }
            // this is the top-level object
            if (this.currentDepth == 0)
            {
                if (!this.debugSymbolNamespaceAdded)
                {
                    string sadsNamespaceAlias = GenerateNamespaceAlias(NameSpaces.DebugSymbolPrefix);
                    this.WriteNamespace(new NamespaceDeclaration(NameSpaces.DebugSymbol, sadsNamespaceAlias));
                    this.debugSymbolNamespaceAdded = true;
                }

                // we need to write MC namespace if any namespaces need to be ignored
                if (this.namespacesToIgnore.Count > 0)
                {
                    string mcNamespaceAlias = GenerateNamespaceAlias(NameSpaces.McPrefix);
                    this.WriteNamespace(new NamespaceDeclaration(NameSpaces.Mc, mcNamespaceAlias));
                }


                if (this.localNamespacesWithAssemblyInfo != null)
                {
                    foreach (NamespaceDeclaration xamlNamespace in this.localNamespacesWithAssemblyInfo)
                    {
                        if ((this.emittedNamespacesInLocalAssembly == null) || (!this.emittedNamespacesInLocalAssembly.Contains(xamlNamespace.Namespace)))
                        {
                            base.WriteNamespace(xamlNamespace);
                        }
                    }
                }

                if ((type.UnderlyingType == typeof(Activity)) ||
                    (type.IsGeneric && type.UnderlyingType != null && type.UnderlyingType.GetGenericTypeDefinition() == typeof(Activity <>)) ||
                    (type.UnderlyingType == typeof(WorkflowService)))
                {   // Exist ActivityBuilder, DebugSymbolObject will be inserted at the depth == 1.
                    debugSymbolDepth = 1;
                }
                else
                {
                    debugSymbolDepth = 0;
                }
            }

            if (this.currentDepth == debugSymbolDepth)
            {
                if (type.UnderlyingType != null && type.UnderlyingType.IsSubclassOf(typeof(Activity)) && this.shouldWriteDebugSymbol)
                {
                    this.writeDebugSymbol = true;
                }
            }

            base.WriteStartObject(type);

            if (this.currentDepth == 0)
            {
                // we need to add Ignore attribute for all namespaces which we don't want to load assemblies for
                // this has to be done after WriteStartObject
                if (this.namespacesToIgnore.Count > 0)
                {
                    string nsString = null;
                    foreach (string ns in this.namespacesToIgnore)
                    {
                        if (nsString == null)
                        {
                            nsString = ns;
                        }
                        else
                        {
                            nsString += " " + ns;
                        }
                    }

                    XamlDirective ignorable = new XamlDirective(NameSpaces.Mc, "Ignorable");
                    base.WriteStartMember(ignorable);
                    base.WriteValue(nsString);
                    base.WriteEndMember();
                    this.namespacesToIgnore.Clear();
                }
            }

            ++this.currentDepth;
        }
 private bool IsConstructionDirective(XamlDirective xamlMember)
 {
     return Equals(xamlMember, CoreTypes.MarkupExtensionArguments);
 }
		public void DefaultValuesWithComplexParams ()
		{
			var d = new XamlDirective (new string [0], "Foo", new XamlType (typeof (object), sctx), null, AllowedMemberLocations.Any);
			Assert.AreEqual (AllowedMemberLocations.Any, 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.IsFalse (d.IsUnknown, "#4"); // different from another test
			Assert.IsTrue (d.IsReadPublic, "#5");
			Assert.IsTrue (d.IsWritePublic, "#6");
			Assert.AreEqual ("Foo", d.Name, "#7");
			Assert.IsTrue (d.IsNameValid, "#8");
			Assert.AreEqual (null, d.PreferredXamlNamespace, "#9"); // different from another test (as we specified empty array above)
			Assert.IsNull (d.TargetType, "#10");
			Assert.IsNotNull (d.Type, "#11");
			Assert.AreEqual (typeof (object), d.Type.UnderlyingType, "#11-2");
			Assert.IsNull (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");
			//TODO: Assert.AreEqual (DesignerSerializationVisibility.Visible, d.SerializationVisibility, "#23");
		}
 public ProtoXamlInstruction Directive(XamlDirective directive, string value)
 {
     return(Attribute(directive, value, "x"));
 }
Beispiel #31
0
 public DirectiveAdapter(XamlDirective xamlMember)
     : base(xamlMember.GetXamlNamespaces(), xamlMember.Name, xamlMember.Type, xamlMember.TypeConverter, xamlMember.AllowedLocation)
 {
 }