コード例 #1
0
        private string ContainElementDefine(ArgumentInitElement arg, List <string> childrenVars,
                                            string className, string classNameBase, string childrenContent)
        {
            string definitionElements = className + " _" + arg.VariableName + " = new " +
                                        className + "(\"" + arg.Id + "\");" + NEW_LINE;

            definitionElements += "public " + className + " " + arg.VariableName + NEW_LINE +
                                  "{" + NEW_LINE +
                                  "get { return _" + arg.VariableName + "; }" + NEW_LINE +
                                  "}" + NEW_LINE;
            definitionElements += "public class " + className + " : " + classNameBase + NEW_LINE;
            definitionElements += "{" + NEW_LINE;
            definitionElements += "public " + className + "(string id) : base(id)" + NEW_LINE +
                                  "{" + NEW_LINE;
            foreach (string childVar in childrenVars)
            {
                definitionElements += "this.Children.Add(" + childVar + ");" + NEW_LINE;
                definitionElements += childVar + ".Parent = this;" + NEW_LINE;
            }
            definitionElements += "}" + NEW_LINE;
            definitionElements += childrenContent;
            definitionElements += "}" + NEW_LINE;

            return(definitionElements);
        }
コード例 #2
0
        private string ItemElementDefine(ArgumentInitElement arg)
        {
            string childClassName    = arg.ClassName;
            string childVariableName = "_" + arg.VariableName;
            string elementDefine     = childClassName + " " + childVariableName + " = new " + childClassName + "(\""
                                       + arg.Id + "\");" + NEW_LINE;

            elementDefine += "public " + childClassName + " " + FormatAttributeName(arg.VariableName) + NEW_LINE;
            elementDefine += "{" + NEW_LINE;
            elementDefine += "get { return " + childVariableName + "; }" + NEW_LINE;
            elementDefine += "}" + NEW_LINE;
            return(elementDefine);
        }