Пример #1
0
        private static void saveXMLofControl(Control control, XmlNode controlXMLNode)
        {
            //Give Handle to XML Node to new Frame Element so it can write its own child
            string eibCOntrolInterfaceName = (typeof(IEIBControl)).Name;

            if (control.GetType().GetInterface(eibCOntrolInterfaceName) != null)
            {
                if (control.Name != null)
                {
                    Hashtable controlProperties = EIBXMLServices.updateSettings(control, ((IEIBControl)control).ControlName, control.Name.ToLower());
                    Hashtable eventProperties   = EIBXMLServices.updateEvents(control, control.Name.ToLower(), control.Name.ToLower());
                    XmlNode   xmlNode           = null;
                    if (!control.Name.Trim().Equals(""))
                    {
                        if (!(control is EIBTabPage))
                        {
                            if (controlXMLNode == null)
                            {
                                xmlNode = EIBXMLServices.writeElement(((IEIBControl)(control.Parent)).ParentXmlNode, EIBControlList.GetRenderingElement(control.GetType().Name), controlProperties, eventProperties);
                            }
                            else
                            {
                                xmlNode = EIBXMLServices.writeElement(controlXMLNode, EIBControlList.GetRenderingElement(control.GetType().Name), controlProperties, eventProperties);
                            }
                        }
                        if (control.GetType().Equals(typeof(EIBPanel)))
                        {
                            ((IEIBControl)control).ParentXmlNode = xmlNode;
                            saveXMLofChildren(control);
                        }
                        if (control.GetType().Equals(typeof(EIBTreeView)))
                        {
                            ((IEIBControl)control).ParentXmlNode = xmlNode;
                            saveXMLofTreeView(control, null);
                        }
                        if (control.GetType().Equals(typeof(EIBTabControl)))
                        {
                            ((IEIBControl)control).ParentXmlNode = xmlNode;
                            saveXMLofChildren(control);
                        }

                        if (control.GetType().Equals(typeof(EIBCombobox)))
                        {
                            ((IEIBControl)control).ParentXmlNode = xmlNode;
                            saveXMLofCombobox(control);
                        }
                        if (control.GetType().Equals(typeof(EIBMenuBar)))
                        {
                            ((IEIBControl)control).ParentXmlNode = xmlNode;
                            saveXMLofMenu(control);
                        }
                        if (control.GetType().Equals(typeof(EIBGrid)))
                        {
                            ((IEIBControl)control).ParentXmlNode = xmlNode;
                            saveXMLofTable((EIBGrid)control);
                        }
                    }
                }
            }
        }
Пример #2
0
 public static void saveXMLofChildren(Control panelControl)
 {
     //Scroll for all tabpages
     if (panelControl is EIBTabControl)
     {
         EIBTabControl eibTabCOntrol = (EIBTabControl)panelControl;
         foreach (EIBTabPage tabPage in eibTabCOntrol.TabPages)
         {
             ((IEIBControl)tabPage).ParentXmlNode = eibTabCOntrol.ParentXmlNode;
             Hashtable controlProperties = EIBXMLServices.updateSettings(tabPage, ((IEIBControl)tabPage).ControlName, tabPage.Name.ToLower());
             Hashtable eventProperties   = EIBXMLServices.updateEvents(tabPage, tabPage.Name.ToLower(), tabPage.Name.ToLower());
             XmlNode   xmlNode           = null;
             if (!tabPage.Name.Trim().Equals(""))
             {
                 xmlNode = EIBXMLServices.writeElement((((IEIBControl)tabPage).ParentXmlNode), EIBControlList.GetRenderingElement(tabPage.GetType().Name), controlProperties, eventProperties);
                 ((IEIBControl)tabPage).ParentXmlNode = xmlNode;
             }
             // Save each Tab page as normal page
             saveXMLofChildren(tabPage);
         }
     }
     foreach (Control control in panelControl.Controls)
     {
         saveXMLofControl(control, null);
     }
 }
Пример #3
0
        public static void saveXMLofTable(EIBGrid tableControl)
        {
            int     rowCount    = tableControl.RowCount;
            int     columnCount = tableControl.ColumnCount;
            XmlNode xmlNode     = null;

            for (int rowCounter = 0; rowCounter < rowCount; rowCounter++)
            {
                EIBRow row = new EIBRow();
                row.InitiateSettings(null);
                Hashtable controlProperties = new Hashtable();
                controlProperties.Add(XMLServicesConstants.XmlNodeHeightAtt, tableControl.RowStyles[rowCounter].Height.ToString());
                controlProperties.Add(XMLServicesConstants.XmlNodeSizeTypeAtt, tableControl.RowStyles[rowCounter].SizeType.ToString());
                xmlNode = EIBXMLServices.writeElement(((IEIBControl)tableControl).ParentXmlNode, row.ControlType, controlProperties, null);

                row.ParentXmlNode = xmlNode;
                for (int colCounter = 0; colCounter < columnCount; colCounter++)
                {
                    XmlNode   columnNode = null;
                    EIBColumn column     = new EIBColumn();
                    column.InitiateSettings(null);
                    Hashtable columnProperties = new Hashtable();
                    columnProperties.Add(XMLServicesConstants.XmlNodeWidthAtt, tableControl.ColumnStyles[colCounter].Width.ToString());
                    columnProperties.Add(XMLServicesConstants.XmlNodeSizeTypeAtt, tableControl.ColumnStyles[colCounter].SizeType.ToString());
                    columnNode           = EIBXMLServices.writeElement(((IEIBControl)row).ParentXmlNode, column.ControlType, columnProperties, null);
                    column.ParentXmlNode = columnNode;
                    Control control = tableControl.GetControlFromPosition(colCounter, rowCounter);
                    if (control != null)
                    {
                        saveXMLofControl(control, column.ParentXmlNode);
                    }
                }
            }
        }
Пример #4
0
        public static void saveXMLofCombobox(Control comboBox)
        {
            EIBCombobox currentComboBox = (EIBCombobox)comboBox;
            int         counter         = 0;

            foreach (string itemValue in currentComboBox.Items)
            {
                Hashtable controlProperties = new Hashtable();
                if (counter == currentComboBox.SelectedIndex)
                {
                    controlProperties.Add("selected", true.ToString().ToLower());
                }
                controlProperties.Add("text", itemValue);
                controlProperties.Add("value", counter.ToString());
                XmlNode xmlNode = EIBXMLServices.writeElement(currentComboBox.ParentXmlNode, "option", controlProperties, null);
                counter++;
            }
        }
Пример #5
0
        public static void saveXMLofMenu(Control menuControl)
        {
            EIBMenuBar menuBar = (EIBMenuBar)menuControl;

            foreach (EIBMenu menu in menuBar.CurrentToolStrip.Items)
            {
                Hashtable controlProperties = EIBXMLServices.updateMenuSettings(menu, menu.Name, menu.Name);
                Hashtable eventProperties   = EIBXMLServices.updateMenuEvents(menu, menu.Name.ToLower(), menu.Name.ToLower());

                XmlNode xmlNode = EIBXMLServices.writeElement(((IEIBControl)menuControl).ParentXmlNode, EIBControlList.GetRenderingElement(menu.GetType().Name), controlProperties, eventProperties);

                foreach (EIBMenuItem menuItem in menu.DropDownItems)
                {
                    Hashtable menuItemProperties  = EIBXMLServices.updateMenuSettings(menuItem, menuItem.Name, menuItem.Name);
                    Hashtable menuEventProperties = EIBXMLServices.updateMenuEvents(menuItem, menuItem.Name.ToLower(), menuItem.Name.ToLower());

                    EIBXMLServices.writeElement(xmlNode, EIBControlList.GetRenderingElement(menuItem.GetType().Name), menuItemProperties, menuEventProperties);
                }
            }
        }
Пример #6
0
 public static void saveXMLofTreeView(Control treeViewControl, TreeNode treeNode)
 {
     if (treeViewControl != null)
     {
         EIBTreeView treeView = (EIBTreeView)treeViewControl;
         foreach (EIBTreeNode treeNodeChild in treeView.Nodes)
         {
             Hashtable controlProperties = new Hashtable();
             controlProperties.Add("name", treeNodeChild.Name);
             controlProperties.Add("text", treeNodeChild.Text);
             if (treeNodeChild.Nodes.Count == 0)
             {
                 controlProperties.Add("isleaf", true.ToString().ToLower());
             }
             Hashtable evntProperties = updateTreeNodeEvents(treeNodeChild, treeNodeChild.Name, treeNodeChild.Name);
             XmlNode   xmlNode        = EIBXMLServices.writeElement(treeView.ParentXmlNode, EIBControlList.GetRenderingElement(treeNodeChild.GetType().Name), controlProperties, evntProperties);
             treeNodeChild.ParentXmlNode = xmlNode;
             saveXMLofTreeView(null, treeNodeChild);
         }
     }
     else if (treeNode != null)
     {
         EIBTreeNode treeNodeParent = (EIBTreeNode)treeNode;
         foreach (EIBTreeNode treeNodeChild in treeNodeParent.Nodes)
         {
             Hashtable controlProperties = new Hashtable();
             controlProperties.Add("name", treeNodeChild.Name);
             controlProperties.Add("text", treeNodeChild.Text);
             if (treeNodeChild.Nodes.Count == 0)
             {
                 controlProperties.Add("isleaf", true.ToString().ToLower());
             }
             Hashtable evntProperties = updateTreeNodeEvents(treeNodeChild, treeNodeChild.Name, treeNodeChild.Name);
             XmlNode   xmlNode        = EIBXMLServices.writeElement(treeNodeParent.ParentXmlNode, EIBControlList.GetRenderingElement(treeNodeChild.GetType().Name), controlProperties, evntProperties);
             treeNodeChild.ParentXmlNode = xmlNode;
             saveXMLofTreeView(null, treeNodeChild);
         }
     }
 }