Exemplo n.º 1
0
		public static void AddHyperLinkControl(TypeDeclaration classObject, TargetField field, string fullTypeName)
		{
			StringBuilder sb = new StringBuilder();
			sb.AppendFormat("[{0}(\"{1}\",\"{2}\")] ", typeof(UIClientPropertyAttribute).FullName, field.SourceFieldName, fullTypeName);
			sb.AppendFormat("public Link {0}", field.SourceFieldName);
			sb.AppendFormat("{{ get {{ return this.TryGetLink(\"ctrl00_{0}\"); }} }}", field.SourceFieldName);
			using(StringReader reader = new StringReader(sb.ToString()))
			{
				CSharpParser parser = new CSharpParser();
				var memberList = parser.ParseTypeMembers(reader);
				foreach(var member in memberList)
				{
					var property = (PropertyDeclaration)member;
					var role = new ICSharpCode.NRefactory.Role<ICSharpCode.NRefactory.CSharp.AttributedNode>("Member");
					property.Remove();
					classObject.AddChild(property, TypeDeclaration.MemberRole);
				}
			}
		}
Exemplo n.º 2
0
        public static void AddHyperLinkControl(TypeDeclaration classObject, TargetField field, string fullTypeName)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("[{0}(\"{1}\",\"{2}\")] ", typeof(UIClientPropertyAttribute).FullName, field.SourceFieldName, fullTypeName);
            sb.AppendFormat("public Link {0}", field.SourceFieldName);
            sb.AppendFormat("{{ get {{ return this.TryGetLink(\"ctrl00_{0}\"); }} }}", field.SourceFieldName);
            using (StringReader reader = new StringReader(sb.ToString()))
            {
                CSharpParser parser     = new CSharpParser();
                var          memberList = parser.ParseTypeMembers(reader);
                foreach (var member in memberList)
                {
                    var property = (PropertyDeclaration)member;
                    var role     = new ICSharpCode.NRefactory.Role <ICSharpCode.NRefactory.CSharp.AttributedNode>("Member");
                    property.Remove();
                    classObject.AddChild(property, TypeDeclaration.MemberRole);
                }
            }
        }