Example #1
0
 public static void DeserializeProjectFile(string fileName, XmlNode parentXMLNode)
 {
     try
     {
         form.buildwindow.issuccessfull = true;
         XmlDocument doc            = new XmlDocument();
         XmlNode     currentXmlNode = null;
         if (parentXMLNode == null)
         {
             doc.Load(fileName);
             currentXmlNode = doc.FirstChild;
         }
         else
         {
             currentXmlNode = parentXMLNode;
         }
         foreach (XmlNode xmlNode in currentXmlNode.ChildNodes)
         {
             if (xmlNode.NodeType == XmlNodeType.Element)
             {
                 if (xmlNode.Name == FormDesignerConstants.FormPattern)
                 {
                     //TreeNode newNode = new TreeNode();
                     //newNode.Text = xmlNode.Name;
                     //treeView.Nodes.Add(newNode);
                     HandleChildNodes(xmlNode, FormDesignerConstants.FormPattern);
                 }
                 //if (xmlNode.Name == FormDesignerConstants.DataPattern)
                 //{
                 //    //TreeNode newNode = new TreeNode();
                 //    //newNode.Text = xmlNode.Name;
                 //    //treeView.Nodes.Add(newNode);
                 //    HandleChildNodes(newNode, xmlNode, FormDesignerConstants.DataPattern);
                 //}
                 //if (xmlNode.Name == FormDesignerConstants.WorkflowPattern)
                 //{
                 //    //TreeNode newNode = new TreeNode();
                 //    //newNode.Text = xmlNode.Name;
                 //    //treeView.Nodes.Add(newNode);
                 //    HandleChildNodes(newNode, xmlNode, FormDesignerConstants.WorkflowPattern);
                 //}
             }
         }
     }
     catch (FileNotFoundException)
     {
         form.buildwindow.issuccessfull = false;
         MessageBox.Show("Project Manifest.xml File not Found");
     }
     catch (Exception ex)
     {
         if (ex is BuildException)
         {
             BuildException bex = (BuildException)ex;
             form.buildwindow.issuccessfull = false;
             form.buildwindow.ControlTree   = bex.ControlPath;
         }
         else
         {
             //MessageBox.Show("Don't build Now.");
         }
         //MessageBox.Show("There is a buld error in Control "+ bex.ControlPath);
     }
     finally
     {
         if (form.buildwindow.issuccessfull)
         {
             form.MakePublish(true);
             //MessageBox.Show("Build Successfull");
             form.buildwindow.FormPatternName = "";
             form.buildwindow.ControlName     = "";
             form.buildwindow.ControlTree     = "";
         }
         // enabling redrawing of treeview after all nodes are added
         //treeView.EndUpdate();
     }
 }
Example #2
0
        public static void DeserializeFormpatternFile(string fileName, XmlNode parentXMLNode)
        {
            //try
            //{

                // disabling re-drawing of treeview till all nodes are added
                //treeView.BeginUpdate();
                XmlDocument doc = new XmlDocument();
                XmlNode currentXmlNode = null;
                if (parentXMLNode == null)
                {
                    doc.Load(fileName);
                    currentXmlNode = doc.FirstChild;
                }
                else
                {
                    currentXmlNode = parentXMLNode;
                    //ControlCollection.Add(currentXmlNode.Attributes["id"].Value, currentXmlNode.Attributes["id"].Value);
                }
                foreach (XmlNode xmlNode in currentXmlNode.ChildNodes)
                {
                    if (xmlNode.NodeType == XmlNodeType.Element)
                    {
                        if (xmlNode.Attributes["id"] != null)
                        {

                            if (ControlCollection.Contains(xmlNode.Attributes["id"].Value))
                            {
                                nodepath = "";
                                form.buildwindow.ControlName = xmlNode.Attributes["id"].Value;
                                BuildException ex = new BuildException("Id Repeated for the control", path(xmlNode));
                                throw ex;
                            }
                            ControlCollection.Add(xmlNode.Attributes["id"].Value, xmlNode.Attributes["id"].Value);
                        }
                        if (xmlNode.HasChildNodes)
                        {
                            DeserializeFormpatternFile(null, xmlNode);
                        }
                        //if (xmlNode.Name == FormDesignerConstants.FormPattern)
                        //{
                        //    //TreeNode newNode = new TreeNode();
                        //    //newNode.Text = xmlNode.Name;
                        //    //treeView.Nodes.Add(newNode);
                        //    HandleChildNodes(xmlNode, FormDesignerConstants.FormPattern);
                        //}
                        //if (xmlNode.Name == FormDesignerConstants.DataPattern)
                        //{
                        //    //TreeNode newNode = new TreeNode();
                        //    //newNode.Text = xmlNode.Name;
                        //    //treeView.Nodes.Add(newNode);
                        //    HandleChildNodes(newNode, xmlNode, FormDesignerConstants.DataPattern);
                        //}
                        //if (xmlNode.Name == FormDesignerConstants.WorkflowPattern)
                        //{
                        //    //TreeNode newNode = new TreeNode();
                        //    //newNode.Text = xmlNode.Name;
                        //    //treeView.Nodes.Add(newNode);
                        //    HandleChildNodes(newNode, xmlNode, FormDesignerConstants.WorkflowPattern);
                        //}
                    }
                }
            //}
            //catch (FileNotFoundException)
            //{
            //    MessageBox.Show("Project Manifest.xml File not Found");
            //}
            //finally
            //{
            //    // enabling redrawing of treeview after all nodes are added
            //    //treeView.EndUpdate();
            //}
        }
Example #3
0
        public static void DeserializeFormpatternFile(string fileName, XmlNode parentXMLNode)
        {
            //try
            //{

            // disabling re-drawing of treeview till all nodes are added
            //treeView.BeginUpdate();
            XmlDocument doc            = new XmlDocument();
            XmlNode     currentXmlNode = null;

            if (parentXMLNode == null)
            {
                doc.Load(fileName);
                currentXmlNode = doc.FirstChild;
            }
            else
            {
                currentXmlNode = parentXMLNode;
                //ControlCollection.Add(currentXmlNode.Attributes["id"].Value, currentXmlNode.Attributes["id"].Value);
            }
            foreach (XmlNode xmlNode in currentXmlNode.ChildNodes)
            {
                if (xmlNode.NodeType == XmlNodeType.Element)
                {
                    if (xmlNode.Attributes["id"] != null)
                    {
                        if (ControlCollection.Contains(xmlNode.Attributes["id"].Value))
                        {
                            nodepath = "";
                            form.buildwindow.ControlName = xmlNode.Attributes["id"].Value;
                            BuildException ex = new BuildException("Id Repeated for the control", path(xmlNode));
                            throw ex;
                        }
                        ControlCollection.Add(xmlNode.Attributes["id"].Value, xmlNode.Attributes["id"].Value);
                    }
                    if (xmlNode.HasChildNodes)
                    {
                        DeserializeFormpatternFile(null, xmlNode);
                    }
                    //if (xmlNode.Name == FormDesignerConstants.FormPattern)
                    //{
                    //    //TreeNode newNode = new TreeNode();
                    //    //newNode.Text = xmlNode.Name;
                    //    //treeView.Nodes.Add(newNode);
                    //    HandleChildNodes(xmlNode, FormDesignerConstants.FormPattern);
                    //}
                    //if (xmlNode.Name == FormDesignerConstants.DataPattern)
                    //{
                    //    //TreeNode newNode = new TreeNode();
                    //    //newNode.Text = xmlNode.Name;
                    //    //treeView.Nodes.Add(newNode);
                    //    HandleChildNodes(newNode, xmlNode, FormDesignerConstants.DataPattern);
                    //}
                    //if (xmlNode.Name == FormDesignerConstants.WorkflowPattern)
                    //{
                    //    //TreeNode newNode = new TreeNode();
                    //    //newNode.Text = xmlNode.Name;
                    //    //treeView.Nodes.Add(newNode);
                    //    HandleChildNodes(newNode, xmlNode, FormDesignerConstants.WorkflowPattern);
                    //}
                }
            }
            //}
            //catch (FileNotFoundException)
            //{
            //    MessageBox.Show("Project Manifest.xml File not Found");
            //}
            //finally
            //{
            //    // enabling redrawing of treeview after all nodes are added
            //    //treeView.EndUpdate();
            //}
        }