Example #1
0
    //**********************************************************************************
        private static void addXAMLreferences(cfgNode itemGroup)
        {
            cfgNode   n;
            attribute attr;
        //******************************************************************************
        // Add references to support XAML and WPF
        //******************************************************************************
            n          = new cfgNode("Reference");
            attr       = new attribute();
            attr.name  = "Include";
            attr.value = "WindowsBase";
            n.attributes.Add(attr);
            itemGroup.children.Add(n);

            n          = new cfgNode("Reference");
            attr       = new attribute();
            attr.name  = "Include";
            attr.value = "PresentationCore";
            n.attributes.Add(attr);
            itemGroup.children.Add(n);

            n          = new cfgNode("Reference");
            attr       = new attribute();
            attr.name  = "Include";
            attr.value = "PresentationFramework";
            n.attributes.Add(attr);
            itemGroup.children.Add(n);
        }
Example #2
0
        public int parse(XmlTextReader r)
        {
            bool parse_doc = !r.IsEmptyElement;

            if (r.HasAttributes)
            {
                for (int i = 0; i < r.AttributeCount; i++)
                {
                    r.MoveToAttribute(i);
                    attribute a = new attribute();
                    a.name  = r.Name;
                    a.value = r.Value;
                    attributes.Add(a);
                }
            }
            while (parse_doc)
            {
                parse_doc = r.Read();
                switch (r.NodeType)
                {
                case XmlNodeType.Element:
                    cfgNode n = new cfgNode(r.Name);
                    n.parse(r);
                    children.Add(n);
                    break;
                //
                //you can handle other cases here
                //

                case XmlNodeType.EndElement:
                    parse_doc = false;
                    break;

                case XmlNodeType.Text:
                    text = r.Value;
                    break;
                }
            }

            return(children.Count);
        }
Example #3
0
        //**********************************************************************************
        private XmlNode addNode(XmlDocument doc, cfgNode cn)
        {
            //******************************************************************************
            // Add an internal configuration node (cfgNode) to XML document
            //******************************************************************************
            XmlNode n = doc.CreateElement(cn.name);

            //******************************************************************************
            // Add text
            //******************************************************************************
            if (cn.text != String.Empty)
            {
                n.InnerText = cn.text;
            }
            //******************************************************************************
            // Add any attributes
            //******************************************************************************
            foreach (attribute a in cn.attributes)
            {
                XmlAttribute attr = doc.CreateAttribute(a.name);
                //**************************************************************************
                attr.Value = a.value;
                n.Attributes.Append(attr);
            }
            //******************************************************************************
            // Add children - recursive
            //******************************************************************************
            foreach (cfgNode child in cn.children)
            {
                XmlNode childNode = addNode(doc, child);
                //**************************************************************************
                n.AppendChild(childNode);
            }
            //******************************************************************************
            // Return node...
            //******************************************************************************
            return(n);
        }
Example #4
0
    //**********************************************************************************
        private static void addXAMLcode(cfgNode itemGroup, Project p)
        {
            int       i = 0;
            cfgNode   n;
            cfgNode   cn;
            attribute attr;
        //******************************************************************************
        // Add Application definition files
        //******************************************************************************
            n          = new cfgNode("ApplicationDefinition");
            attr       = new attribute();
            attr.name  = "Include";
            attr.value = "App.xaml";
            n.attributes.Add(attr);
            cn         = new cfgNode("Generator");
            cn.text    = "MSBuild:Compile";
            n.children.Add(cn);
            cn         = new cfgNode("SubType");
            cn.text    = "Designer";
            n.children.Add(cn);
            itemGroup.children.Insert(i++, n);

            n          = new cfgNode("Compile");
            attr       = new attribute();
            attr.name  = "Include";
            attr.value = "App.xaml.cs";
            n.attributes.Add(attr);
            cn         = new cfgNode("DependentUpon");
            cn.text    = "App.xaml";
            n.children.Add(cn);
            cn         = new cfgNode("SubType");
            cn.text    = "Code";
            n.children.Add(cn);
            itemGroup.children.Insert(i++, n);
        //******************************************************************************
        // Add converted form source files...
        //******************************************************************************
            foreach (cForm f in p.forms)
            {
            //**************************************************************************
            // XAML definition - replaces designer file
            //**************************************************************************
                n          = new cfgNode("Page");
                attr       = new attribute();
                attr.name  = "Include";
                attr.value = Project.formFile(f.definition_file, ".xaml");
                n.attributes.Add(attr);
                cn         = new cfgNode("Generator");
                cn.text    = "MSBuild:Compile";
                n.children.Add(cn);
                cn         = new cfgNode("SubType");
                cn.text    = "Designer";
                n.children.Add(cn);
                itemGroup.children.Insert(i++, n);
            //**************************************************************************
            // CS file - replaces form source file
            //**************************************************************************
                n          = new cfgNode("Compile");
                attr       = new attribute();
                attr.name  = "Include";
                attr.value = Project.formFile(f.definition_file, ".xaml.cs");
                n.attributes.Add(attr);
                cn         = new cfgNode("DependentUpon");
                cn.text    = Project.formFile(f.definition_file, ".xaml");
                n.children.Add(cn);
                cn         = new cfgNode("SubType");
                cn.text    = "Code";
                n.children.Add(cn);
                itemGroup.children.Insert(i++, n);
            }
        }