Ejemplo n.º 1
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);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public static object CreateControl(string ctrlName, string partialName)
        {
            try
            {
                Control ctrl = null;
                //ToolStripMenuItem menu;
                //ToolStripButton menuItem;
                switch (ctrlName)
                {
                case "EIBButton":
                    ctrl = new EIBButton();
                    break;

                case "EIBApplet":
                    ctrl = new EIBApplet();
                    break;

                case "EIBLattice":
                    ctrl = new EIBLattice();
                    break;

                case "EIBSchedular":
                    ctrl = new EIBSchedular();
                    break;

                case "EIBDatePicker":
                    ctrl = new EIBDatePicker();
                    break;

                case "EIBTime":
                    ctrl = new EIBTime();
                    break;

                case "EIBCheckbox":
                    ctrl = new EIBCheckbox();
                    break;

                case "EIBCombobox":
                    ctrl = new EIBCombobox();
                    break;

                case "EIBLabel":
                    ctrl = new EIBLabel();
                    break;

                case "EIBLine":
                    ctrl = new EIBLine();
                    break;

                case "EIBPanel":
                    ctrl = new EIBPanel();
                    DragDropHandler.RegisterControl(ctrl, true, true);
                    break;

                case "EIBJasper":
                    ctrl = new EIBJasper();
                    break;

                case "EIBRadioGroup":
                    ctrl = new EIBRadioGroup();
                    DragDropHandler.RegisterControl(ctrl, true, true);
                    break;

                case "EIBPicture":
                    ctrl = new EIBPicture();
                    break;

                case "EIBRadioButton":
                    ctrl = new EIBRadioButton();
                    break;

                case "EIBTabControl":
                    ctrl = new EIBTabControl();
                    DragDropHandler.RegisterControl(ctrl, true, true);
                    break;

                case "EIBTabPage":
                    ctrl = new EIBTabPage();
                    DragDropHandler.RegisterControl(ctrl, true, true);
                    break;

                case "EIBSearch":
                    ctrl = new EIBSearch();
                    break;

                case "EIBListbox":
                    ctrl = new EIBListbox();
                    break;

                case "EIBGrid":
                    ctrl = new EIBGrid();
                    DragDropHandler.RegisterControl(ctrl, true, true);
                    break;

                case "EIBTable":
                    ctrl = new EIBTable();
                    break;

                case "EIBRelation":
                    ctrl = new EIBRelation();
                    break;

                case "EIBTextBox":
                    ctrl = new EIBTextBox();
                    break;

                case "EIBTreeView":
                    ctrl = new EIBTreeView();
                    break;

                case "EIBMenuBar":
                    ctrl = new EIBMenuBar(false);
                    DragDropHandler.RegisterControl(ctrl, true, true);
                    break;

                case "EIBNode":
                    ctrl = new EIBNode();
                    break;

                case "EIBNodeRelation":
                    ctrl = new EIBNodeRelation();
                    break;

                case "EIBColumn":
                    ctrl = new EIBColumn();
                    DragDropHandler.RegisterControl(ctrl, true, true);
                    break;

                case "EIBScrollableRow":
                    ctrl = new EIBScrollableRow();
                    DragDropHandler.RegisterControl(ctrl, true, true);
                    break;

                case "EIBBrowse":
                    ctrl = new EIBBrowse();
                    break;

                case "EIBVMenuBar":
                    ctrl = new EIBVMenuBar(false);
                    DragDropHandler.RegisterControl(ctrl, true, true);
                    break;

                case "EIBMenu":
                    return(new EIBMenu());

                case "EIBMenuItem":
                    return(new EIBMenuItem());

                /*
                 *                  case "EIBTreeNode":
                 *                      ctrl = new EIBTreeNode();
                 *                      break;
                 */
                default:
                    Assembly controlAsm  = Assembly.LoadWithPartialName(partialName);
                    Type     controlType = controlAsm.GetType(partialName + "." + ctrlName);
                    ctrl = (Control)Activator.CreateInstance(controlType);
                    break;
                }

                return(ctrl);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine("create control failed:" + ex.Message);
                return(new Control());
            }
        }