Esempio n. 1
0
        private static IvyGrid parseXMLGrid(XmlNode e)
        {
            IvyGrid      grid = new IvyGrid(1, 1);
            string       value;
            IvyComponent compChild;


            foreach (XmlAttribute attr in e.Attributes)
            {
                /* Component Attributes */

                if (getComponentAttributes(grid, attr))
                {
                    continue;
                }

                /* Grid Attributes */

                if (attr.Name.Equals("rows"))
                {
                    value = attr.Value;

                    try
                    {
                        grid.setRows(int.Parse(value));
                    }
                    catch (Exception ex)
                    {
                        throw new InvalidAttributeTypeException();
                    }
                }
                else if (attr.Name.Equals("cols"))
                {
                    value = attr.Value;

                    try
                    {
                        grid.setCols(int.Parse(value));
                    }
                    catch (Exception ex)
                    {
                        throw new InvalidAttributeTypeException();
                    }
                }
            }

            if (e.HasChildNodes)
            {
                foreach (XmlNode child in e.ChildNodes)
                {
                    compChild = parseXMLComponent(child);
                    grid.setComponentAt(compChild, compChild.getRow(), compChild.getCol());
                }
            }

            return(grid);
        }
Esempio n. 2
0
        private static IvyGrid parseXMLGrid(XmlNode e)
        {
            IvyGrid grid = new IvyGrid(1, 1);
            string value;
            IvyComponent compChild;

            foreach (XmlAttribute attr in e.Attributes)
            {
                /* Component Attributes */

                if (getComponentAttributes(grid, attr))
                {
                    continue;
                }

                /* Grid Attributes */

                if (attr.Name.Equals("rows"))
                {
                    value = attr.Value;

                    try
                    {
                        grid.setRows(int.Parse(value));
                    }
                    catch (Exception ex)
                    {
                        throw new InvalidAttributeTypeException();
                    }
                }
                else if (attr.Name.Equals("cols"))
                {
                    value = attr.Value;

                    try
                    {
                        grid.setCols(int.Parse(value));
                    }
                    catch (Exception ex)
                    {
                        throw new InvalidAttributeTypeException();
                    }
                }
            }

            if (e.HasChildNodes)
            {
                foreach (XmlNode child in e.ChildNodes)
                {
                    compChild = parseXMLComponent(child);
                    grid.setComponentAt(compChild, compChild.getRow(), compChild.getCol());
                }
            }

            return grid;
        }