Exemplo n.º 1
0
        public XmlNode GetXml(XmlDocument xDoc, XmlNode parent = null)
        {
            XmlNode root = XmlAdder.Element(xDoc, "Component", parent);

            XmlAdder.Attribute(xDoc, "Width", RealControl.Width.ToString(), root);
            XmlAdder.Attribute(xDoc, "Height", RealControl.Height.ToString(), root);
            XmlAdder.Attribute(xDoc, "Name", RealControl.Name, root);

            if (_panel is FlowLayoutPanel)
            {
            }
            else if (_panel is Panel)
            {
                XmlAdder.Attribute(xDoc, "X", RealControl.Location.X.ToString(), root);
                XmlAdder.Attribute(xDoc, "Y", RealControl.Location.Y.ToString(), root);
            }

            if (_filePath.Length > 0)
            {
                XmlAdder.Attribute(xDoc, "Ref", _filePath, root);
            }
            else
            {
                (_realComponent as IXmlComponent).GetXml(xDoc, root);
            }
            return(root);
        }
Exemplo n.º 2
0
        public XmlNode GetXml(XmlDocument xDoc, XmlNode parent = null)
        {
            XmlNode root = XmlAdder.Element(xDoc, "Label", parent);

            XmlAdder.Attribute(xDoc, "Text", this.Text, parent);
            //XmlAdder.Attribute(xDoc, "Enabled", this.Enabled ? "true" : "false", parent);

            if (this.ForeColor.IsKnownColor)
            {
                XmlAdder.Attribute(xDoc, "TextColor", this.ForeColor.Name, parent);
            }
            else
            {
                XmlAdder.Attribute(xDoc, "TextColor", String.Format("#{0:X6}", this.ForeColor.ToArgb()), parent);
            }

            if (this.BackColor.IsKnownColor)
            {
                XmlAdder.Attribute(xDoc, "BackColor", this.ForeColor.Name, parent);
            }
            else
            {
                XmlAdder.Attribute(xDoc, "BackColor", String.Format("#{0:X6}", this.ForeColor.ToArgb()), parent);
            }

            return(root);
        }
Exemplo n.º 3
0
        public XmlNode GetXml(XmlDocument xDoc, XmlNode parent = null)
        {
            XmlNode root = XmlAdder.Element(xDoc, "Command", parent);

            XmlAdder.Attribute(xDoc, "Name", Name, root);
            XmlAdder.Attribute(xDoc, "Template", Template.FullPath, root);

            foreach (XmlCommandField field in Template.Command.Data.FieldList.Values)
            {
                if (field.FieldType == FieldTypes.Dynamic)
                {
                    XmlAdder.Attribute(xDoc, field.Name, field.Data, root);
                }
            }
            if (ResponseCondition != null)
            {
                ResponseCondition.GetXml(xDoc, parent);
            }


            foreach (XmlCommandFields fields in Template.Command.Data.FieldsList.Values)
            {
                XmlNode node = fields.GetXml(xDoc, root);//
            }
            return(root);
        }
Exemplo n.º 4
0
        public String GetHtml()
        {
            XmlDocument xDoc = new XmlDocument();
            XmlElement  html = XmlAdder.Element(xDoc, "Html");
            XmlElement  head = XmlAdder.Element(xDoc, "Head", html);
            XmlElement  meta = XmlAdder.Element(xDoc, "META", head);

            XmlAdder.Attribute(xDoc, "HTTP-EQUIV", "utf-8", meta);
            //<meta charset="utf-8" />

            meta = XmlAdder.Element(xDoc, "META", head);
            XmlAdder.Attribute(xDoc, "http-equiv", "Content-Type", meta);
            XmlAdder.Attribute(xDoc, "content", "text/html; charset=utf-8", meta);
            //http-equiv="Content-Type" content="text/html; charset=utf-8"

            XmlElement title = XmlAdder.Element(xDoc, "Title", head);

            title.InnerText = "";
            XmlElement body = XmlAdder.Element(xDoc, "Body", html);

            foreach (IHtmlReportElement ele in _elements)
            {
                ele.GetXml(xDoc, body);
            }
            return(xDoc.InnerXml);
            //return GetFormatedXml(xDoc.InnerXml);
        }
Exemplo n.º 5
0
 protected void GetXmlForThis(XmlDocument xDoc, XmlNode myNode)
 {
     if (BackColor != Color.Empty)
     {
         XmlAdder.Attribute(xDoc, "bgcolor", "#" + BackColor.R.ToString("X2") + BackColor.G.ToString("X2") + BackColor.B.ToString("X2"), myNode);
     }
     //XmlAdder.Attribute(xDoc, "valign", "middle", myNode);
 }
Exemplo n.º 6
0
        public static void ItemsToXml(List <CPacketItem> items, String xmlFile, CStructInfo info)
        {
            XmlDocument xDoc = new XmlDocument();

            //List<CPacketItem> items = cstr.Items;

            XmlElement xRoot = xDoc.CreateElement("Packet");

            xDoc.AppendChild(xRoot);
            #region addInfo
            XmlElement xInfos = XmlAdder.Element(xDoc, "Infos", xRoot);

            XmlElement xInfo;
            xInfo = XmlAdder.Element(xDoc, "Info", xInfos);
            XmlAdder.Attribute(xDoc, "Comment", info.Comment, xInfos);
            xInfo = XmlAdder.Element(xDoc, "Info", xInfos);
            XmlAdder.Attribute(xDoc, "LastModified", info.LastModified.ToString(), xInfos);
            #endregion

            XmlElement xItems = XmlAdder.Element(xDoc, "Items", xRoot);

            for (int i = 0; i < items.Count; i++)
            {
                XmlElement item = xDoc.CreateElement("Item");
                XmlAdder.Attribute(xDoc, "Name", items[i].Name, item);
                XmlAdder.Attribute(xDoc, "Type", items[i].TypeString, item);
                XmlAdder.Attribute(xDoc, "IsSwap", items[i].IsSwap.ToString(), item);
                int size = items[i].Length;

                if (items[i].Function.Exists)
                {
                    XmlElement func = XmlAdder.Element(xDoc, "Function", item);
                    XmlAdder.Attribute(xDoc, "Name", items[i].Function.Name, func);
                    for (int argc = 0; argc < items[i].Function.Args.Length; argc++)
                    {
                        XmlAdder.Element(xDoc, "Arg", items[i].Function.Args[argc].ToString(), func);
                    }
                }
                else if (items[i].InitValues.Length > 0)
                {
                    if (size == 0)
                    {
                        size = items[i].InitValues.Length;
                    }

                    for (int itemCount = 0; itemCount < size; itemCount++)
                    {
                        XmlAdder.Element(xDoc, "InitValue", items[i].InitValues[itemCount].ToString(), item);
                    }
                }

                XmlAdder.Attribute(xDoc, "Size", size.ToString(), item);
                xItems.AppendChild(item);
            }
            xDoc.Save(xmlFile);
        }
Exemplo n.º 7
0
        public XmlNode GetXml(XmlDocument xDoc, XmlNode parent = null)
        {
            XmlNode xImgList = XmlAdder.Element(xDoc, _tagName, parent);

            for (int i = 0; i < _pathList.Count; i++)
            {
                XmlNode xImg = XmlAdder.Element(xDoc, "Image", xImgList);
                XmlAdder.Attribute(xDoc, "URL", _pathList[i], xImg);
            }
            return(xImgList);
        }
Exemplo n.º 8
0
        public override XmlNode GetXml(XmlDocument xDoc, XmlNode parent = null)
        {
            XmlNode root = XmlAdder.Element(xDoc, _conditionType.ToString(), parent as XmlElement);

            for (int i = 0; i < _values.Count; i++)
            {
                XmlNode xValue = XmlAdder.Element(xDoc, "Value", _values[i].Value, root);
                XmlAdder.Attribute(xDoc, "Type", _values[i].TypeName, xValue);
                XmlAdder.Attribute(xDoc, "IsVariable", _values[i].IsVariable ? "true" : "false", xValue);
                root.AppendChild(xValue);
            }
            return(root);
        }
Exemplo n.º 9
0
        /// <summary>
        /// BitItems 태그에 값을 가진 BitItem Element를 추가한다.
        /// </summary>
        /// <param name="xDoc"></param>
        /// <param name="bitItemsNode"></param>
        /// <returns></returns>
        public XmlNode GetXml(XmlDocument xDoc, XmlNode bitItemsNode)
        {
            XmlNode root = XmlAdder.Element(xDoc, "BitItem", bitItemsNode);

            XmlAdder.Attribute(xDoc, "Name", BitName, root);
            XmlAdder.Attribute(xDoc, "StartOffset", StartOffset.ToString(), root);
            XmlAdder.Attribute(xDoc, "BitSize", BitSize.ToString(), root);
            XmlAdder.Attribute(xDoc, "PassCondition", PassCondition.Replace("<", "&lt;").Replace(">", "&gt;"), root);
            XmlAdder.Attribute(xDoc, "Description", Description, root);
            //XmlAdder.Attribute(xDoc, "Visible", Visible?"True":"False", root);
            XmlAdder.Attribute(xDoc, "ShowOnReport", ShowOnReport ? "True" : "False", root);
            return(root);
        }
Exemplo n.º 10
0
        internal XmlElement GetXml(XmlDocument xDoc, XmlNode table)
        {
            XmlElement tr;

            tr = XmlAdder.Element(xDoc, "TR", table);
            if (_ownerTable.TableName.Length > 0)
            {
                XmlAdder.Attribute(xDoc, "id", TableRowName, tr);
                XmlAdder.Attribute(xDoc, "onmouseover", "if ( typeof( window[ 'row_mouse_over' ] ) != 'undefined' ) row_mouse_over('" + TableRowName + "');", tr);
                XmlAdder.Attribute(xDoc, "onmouseout", "if ( typeof( window[ 'row_mouse_out' ] ) != 'undefined' ) row_mouse_out('" + TableRowName + "');", tr);
            }
            base.GetXmlForThis(xDoc, tr);

            if (Style != null && Style.Length > 0)
            {
                XmlAdder.Attribute(xDoc, "Style", Style, tr);
            }


            int col = 0;

            foreach (HtmlTableCell cell in _cells)
            {
                if (BackColor != Color.Empty)
                {
                    if (cell.BackColor == Color.Empty)
                    {
                        cell.BackColor = BackColor;
                    }
                }
                if (BorderWidths != null)
                {
                    if (col == 0)//first col
                    {
                        cell.BorderWidths = new Margins(BorderWidths.Left, 0, BorderWidths.Top, BorderWidths.Bottom);
                    }
                    else if (col == _cells.Count - 1)//last col
                    {
                        cell.BorderWidths = new Margins(0, BorderWidths.Right, BorderWidths.Top, BorderWidths.Bottom);
                    }
                    else
                    {
                        cell.BorderWidths = new Margins(0, 0, BorderWidths.Top, BorderWidths.Bottom);
                    }
                }
                cell.GetXml(xDoc, tr);
                col++;
            }
            return(tr);
        }
Exemplo n.º 11
0
        internal void GetXml(XmlDocument xDoc, XmlNode tr)
        {
            XmlElement td = XmlAdder.Element(xDoc, "TD", tr);

            if (_ownerRow.TableRowName.Length > 0)
            {
                XmlAdder.Attribute(xDoc, "id", TableCellName, td);
                XmlAdder.Attribute(xDoc, "onmouseover", "if ( typeof( window[ 'cell_mouse_over' ] ) != 'undefined' ) cell_mouse_over('" + TableCellName + "');", td);
                XmlAdder.Attribute(xDoc, "onmouseout", "if ( typeof( window[ 'cell_mouse_out' ] ) != 'undefined' ) cell_mouse_out('" + TableCellName + "');", td);
            }
            XmlAdder.Attribute(xDoc, "colSpan", Span.ToString(), td);
            if (Style.Length > 0)
            {
                XmlAdder.Attribute(xDoc, "Style", Style, td);
            }
            base.GetXmlForThis(xDoc, td);

            if (CellAlign == CellAligns.Center)
            {
                td = XmlAdder.Element(xDoc, "CENTER", td);
            }
            if (IsHeader)
            {
                td = XmlAdder.Element(xDoc, "B", td);          //header면 두꺼운 글자로..
            }
            if (Content == null)
            {
                td.InnerText = " ";
            }
            else
            {
                if (Content is String)
                {
                    if ((Content as String).Length == 0)
                    {
                        td.InnerXml = "<P> </P>";
                    }
                    else
                    {
                        td.InnerText = Content.ToString();
                    }
                }
                else if (Content == null)
                {
                    td.InnerXml = "<P> </P>";
                }
            }
        }
Exemplo n.º 12
0
        public XmlNode GetXml(XmlDocument xDoc, XmlNode parent = null)
        {
            String args = "";

            for (int i = 0; i < Args.Length; i++)
            {
                if (i != 0)
                {
                    args += " ";
                }
                args += Args[i];
            }

            XmlNode xAction = XmlAdder.Element(xDoc, "Action", args, parent);

            XmlAdder.Attribute(xDoc, "Name", Name, xAction);
            return(xAction);
        }
Exemplo n.º 13
0
        public XmlNode GetXml(XmlDocument xDoc, XmlNode parent = null)
        {
            XmlNode root = XmlAdder.Element(xDoc, TemplateName, parent);

            foreach (XmlCommandField field in FieldList.Values)
            {
                if (field.FieldType == FieldTypes.Dynamic || field.FieldType == FieldTypes.Variable)
                {
                    XmlAdder.Attribute(xDoc, field.Name, field.Data, root);
                }
            }

            foreach (XmlCommandFields fields in FieldsList.Values)
            {
                fields.GetXml(xDoc, root);
            }

            return(root);
        }
Exemplo n.º 14
0
        public XmlNode GetXml(XmlDocument xDoc, XmlNode parent = null)
        {
            XmlNode xLayout = XmlAdder.Element(xDoc, "Tab", parent);

            if (_layoutPanel is FlowLayoutPanel)
            {
                XmlNode flow = XmlAdder.Element(xDoc, "Flow", xLayout);

                for (int i = 0; i < _layoutPanel.Controls.Count; i++)
                {
                    XmlNode com     = XmlAdder.Element(xDoc, "Component", flow);
                    Control control = _layoutPanel.Controls[i];
                    XmlAdder.Attribute(xDoc, "Width", control.Width.ToString(), com);
                    XmlAdder.Attribute(xDoc, "Height", control.Height.ToString(), com);
                    IXmlComponent xRealCom = control as IXmlComponent;
                    if (xRealCom != null)
                    {
                        xRealCom.GetXml(xDoc, com);
                    }
                }
            }
            else //Panel
            {
                XmlNode panel = XmlAdder.Element(xDoc, "Panel", xLayout);
                for (int i = 0; i < _layoutPanel.Controls.Count; i++)
                {
                    XmlNode com     = XmlAdder.Element(xDoc, "Component", panel);
                    Control control = _layoutPanel.Controls[i];
                    XmlAdder.Attribute(xDoc, "Width", control.Width.ToString(), com);
                    XmlAdder.Attribute(xDoc, "Height", control.Height.ToString(), com);
                    XmlAdder.Attribute(xDoc, "X", control.Location.X.ToString(), com);
                    XmlAdder.Attribute(xDoc, "Y", control.Location.Y.ToString(), com);

                    IXmlComponent xRealCom = control as IXmlComponent;
                    if (xRealCom != null)
                    {
                        xRealCom.GetXml(xDoc, com);
                    }
                }
            }

            return(xLayout);
        }
Exemplo n.º 15
0
 public virtual void SetXmlTo(XmlDocument xDoc, XmlNode parentNode)
 {
     //Name은 바깥에서 이미 지정했음.
     foreach (String attr in Attributes.Keys)
     {
         XmlAdder.Attribute(xDoc, attr, Attributes[attr], parentNode);
     }
     if (Children.Count > 0)
     {
         foreach (HtmlNode node in Children)
         {
             XmlElement ele = XmlAdder.Element(xDoc, node.Name, parentNode);
             node.SetXmlTo(xDoc, ele);
         }
     }
     else
     {
         parentNode.InnerText = (_innerText != null) ? _innerText.Text : "";
     }
 }
Exemplo n.º 16
0
        public void SetXmlTo(XmlDocument xDoc)
        {
            XmlElement root = XmlAdder.Element(xDoc, "HTML");

            //Name은 바깥에서 이미 지정했음.
            foreach (String attr in Attributes.Keys)
            {
                XmlAdder.Attribute(xDoc, attr, Attributes[attr], root);
            }

            if (Children.Count > 0)
            {
                foreach (HtmlNode node in Children)
                {
                    XmlElement ele = XmlAdder.Element(xDoc, node.Name, root);
                    node.SetXmlTo(xDoc, ele);
                }
            }
            else
            {
                root.InnerText = _innerText.Text;
            }
        }
Exemplo n.º 17
0
        public XmlNode GetXml(XmlDocument xDoc, XmlNode parent = null)
        {
            XmlNode xImgList = XmlAdder.Element(xDoc, _tagName, parent);

            XmlNode xImg = XmlAdder.Element(xDoc, "Image", xImgList);

            XmlAdder.Attribute(xDoc, "URL", _pathList[(int)ImageKind.NormalImage], xImg);
            xImg = XmlAdder.Element(xDoc, "Image", xImgList);
            XmlAdder.Attribute(xDoc, "URL", _pathList[(int)ImageKind.CheckImage], xImg);
            xImg = XmlAdder.Element(xDoc, "Image", xImgList);
            XmlAdder.Attribute(xDoc, "URL", _pathList[(int)ImageKind.InterImage], xImg);
            xImg = XmlAdder.Element(xDoc, "Image", xImgList);
            XmlAdder.Attribute(xDoc, "URL", _pathList[(int)ImageKind.DisabledImage], xImg);

            /*
             * for (int i = 0; i < _pathList.Count; i++)
             * {
             *  XmlNode xImg = XmlAdder.Element(xDoc, "Image", xImgList);
             *  XmlAdder.Attribute(xDoc, "URL", _pathList[i], xImg);
             * }
             */
            return(xImgList);
        }
Exemplo n.º 18
0
        public void GetXml(XmlDocument xDoc, XmlNode parent)
        {
            XmlNode root = XmlAdder.Element(xDoc, "RespondCond", parent);
            String  cond = Field.Name;

            switch (CondSymbol)
            {
            case CondSymbols.EQ:
                cond += "==";
                break;

            case CondSymbols.GE:
                cond += ">=";
                break;

            case CondSymbols.GT:
                cond += ">";
                break;

            case CondSymbols.LE:
                cond += "<=";
                break;

            case CondSymbols.LT:
                cond += "<";
                break;

            case CondSymbols.NE:
                cond += "!=";
                break;

            default:
                break;
            }
            cond += Value;
            XmlAdder.Attribute(xDoc, "CondText", cond, root);
        }
Exemplo n.º 19
0
        public XmlNode GetXml(XmlDocument xDoc, XmlNode parent = null)
        {
            XmlNode root = XmlAdder.Element(xDoc, "ImageButton", parent);

            XmlAdder.Attribute(xDoc, "Enabled", this.Enabled ? "true" : "false", parent);
            XmlAdder.Attribute(xDoc, "Text", this.Text, parent);
            if (this.ForeColor.IsKnownColor)
            {
                XmlAdder.Attribute(xDoc, "TextColor", this.ForeColor.Name, parent);
            }
            else
            {
                XmlAdder.Attribute(xDoc, "TextColor", String.Format("#{0:X6}", this.ForeColor.ToArgb()), parent);
            }
            if (this.BackColor.IsKnownColor)
            {
                XmlAdder.Attribute(xDoc, "BackColor", this.ForeColor.Name, parent);
            }
            else
            {
                XmlAdder.Attribute(xDoc, "BackColor", String.Format("#{0:X6}", this.ForeColor.ToArgb()), parent);
            }
            if (this.BackColor.IsKnownColor)
            {
                XmlAdder.Attribute(xDoc, "ActivationColor", this.ForeColor.Name, parent);
            }
            else
            {
                XmlAdder.Attribute(xDoc, "ActivationColor", String.Format("#{0:X6}", this.ForeColor.ToArgb()), parent);
            }

            XmlAdder.Attribute(xDoc, "DisabeldImageIndex", this.U_ButtonDisabledType.ToString(), parent);

            _events.GetXml(xDoc, root);
            return(root);
        }
Exemplo n.º 20
0
        public XmlNode GetXml(XmlDocument xDoc, XmlNode parent = null)
        {
            XmlNode xTableNode = XmlAdder.Element(xDoc, "Table", parent);

            XmlNode xTableInfo     = XmlAdder.Element(xDoc, "TableInfo", xTableNode);
            XmlNode xBaseRowHeight = XmlAdder.Element(xDoc, "BaseRowHeight", this.BaseRowHeight.ToString(), xTableInfo);

            XmlNode xColumns = XmlAdder.Element(xDoc, "Columns", xTableNode);

            for (int colIndex = 0; colIndex < this.ColumnCount; colIndex++)
            {
                XmlNode xColumn = XmlAdder.Element(xDoc, "Column", xColumns);

                IEasyGridColumn col      = Columns(colIndex);
                ItemTypes       itemType = col.ItemType;

                switch (itemType)
                {
                case ItemTypes.Button:
                {
                    EasyGridButtonColumn c = col as EasyGridButtonColumn;
                    XmlNode xProperties    = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "BaseText", c.Text, xProperties);
                }
                break;

                case ItemTypes.CheckBox:
                {
                    EasyGridCheckBoxColumn c = col as EasyGridCheckBoxColumn;
                    XmlNode xProperties      = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "TriState", c.ThreeState ? "true" : "false", xProperties);
                }
                break;

                case ItemTypes.CheckBoxGroup:
                {
                    EasyGridCheckBoxGroupColumn c = col as EasyGridCheckBoxGroupColumn;
                    XmlNode xProperties           = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    if (c.Items.Count > 0)
                    {
                        XmlNode multiSelItems = XmlAdder.Element(xDoc, "MultiSelItems", xProperties);
                        for (int i = 0; i < c.Items.Count; i++)
                        {
                            XmlNode multiSelItem = XmlAdder.Element(xDoc, "MultiSelItem", c.Items[i].Text, multiSelItems);
                            XmlAdder.Attribute(xDoc, "Checked", c.Items[i].Checked ? "true" : "false", multiSelItem);
                        }
                    }
                }
                break;

                case ItemTypes.CloseButton:
                {
                    EasyGridCloseButtonColumn c = col as EasyGridCloseButtonColumn;
                    XmlNode xProperties         = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "BaseText", c.Text, xProperties);
                }
                break;

                case ItemTypes.ComboBox:
                {
                    EasyGridComboBoxColumn c = col as EasyGridComboBoxColumn;
                    XmlNode xProperties      = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    if (c.Items.Count > 0)
                    {
                        XmlNode singleSelItems = XmlAdder.Element(xDoc, "SingleSelItems", xProperties);
                        for (int i = 0; i < c.Items.Count; i++)
                        {
                            XmlAdder.Element(xDoc, "SingleSelItem", c.Items.ElementAt(i), singleSelItems);
                        }
                    }
                }
                break;

                case ItemTypes.FileOpenBox:
                {
                    EasyGridFileOpenBoxColumn c = col as EasyGridFileOpenBoxColumn;

                    XmlNode xProperties = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "Editable", c.IsEditable?"true":"false", xProperties);
                    XmlAdder.Attribute(xDoc, "TextAlignMode", c.ColumnTextAlignMode.ToString(), xProperties);
                }
                break;

                case ItemTypes.Image:
                {
                    EasyGridImageColumn c           = col as EasyGridImageColumn;
                    XmlNode             xProperties = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "TitleShowImage", c.SelectedIndex.ToString(), xProperties);
                    XmlImageList imgs = c.Images as XmlImageList;
                    if (imgs != null && imgs.Count > 0)
                    {
                        imgs.GetXml(xDoc, xProperties);
                    }
                }
                break;

                case ItemTypes.ImageButton:
                {
                    EasyGridImageButtonColumn c = col as EasyGridImageButtonColumn;
                    XmlNode xProperties         = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "TitleShowImage", c.SelectedIndex.ToString(), xProperties);
                    XmlAdder.Attribute(xDoc, "ShowTitleText", c.HeaderText.Length > 0 ? "true" : "false", xProperties);
                    XmlAdder.Attribute(xDoc, "UseColumnTextForButtonValue", c.UseColumnTextForButtonValue.ToString(), xProperties);
                    XmlImageList imgs = c.Images as XmlImageList;
                    if (imgs != null && imgs.Count > 0)
                    {
                        imgs.GetXml(xDoc, xProperties);
                    }
                }
                break;

                case ItemTypes.ImageCheckBox:
                {
                    EasyGridImageCheckBoxColumn c = col as EasyGridImageCheckBoxColumn;
                    XmlNode xProperties           = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "InitValue", c.SelectedIndex.ToString(), xProperties);

                    XmlCheckImageList imgs = c.Images as XmlCheckImageList;
                    if (imgs != null && imgs.Count > 0)
                    {
                        imgs.GetXml(xDoc, xProperties);
                    }
                    else
                    {
                        if (c.Images.Count > 1)
                        {
                            if (c.Images.ElementAt(1).Equals(FormAdders.Properties.Resources.check_red))
                            {
                                XmlAdder.Attribute(xDoc, "CheckColor", CheckBoxColors.Red.ToString(), xProperties);
                            }
                            else
                            {
                                XmlAdder.Attribute(xDoc, "CheckColor", CheckBoxColors.Blue.ToString(), xProperties);
                            }
                        }
                        else
                        {
                            XmlAdder.Attribute(xDoc, "CheckColor", CheckBoxColors.Red.ToString(), xProperties);
                        }
                    }
                }
                break;

                case ItemTypes.KeyValue:
                {
                    EasyGridKeyValueColumn c = col as EasyGridKeyValueColumn;
                    XmlNode xProperties      = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "TextAlignMode", c.ColumnTextAlignMode.ToString(), xProperties);
                }
                break;

                case ItemTypes.RadioButton:
                {
                    EasyGridRadioButtonColumn c = col as EasyGridRadioButtonColumn;
                    XmlNode xProperties         = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    if (c.Items.Count > 0)
                    {
                        XmlNode singleSelItems = XmlAdder.Element(xDoc, "SingleSelItems", xProperties);
                        for (int i = 0; i < c.Items.Count; i++)
                        {
                            XmlAdder.Element(xDoc, "SingleSelItem", c.Items[i].Text, singleSelItems);
                        }
                    }
                }
                break;

                case ItemTypes.TextBox:
                {
                    EasyGridTextBoxColumn c = col as EasyGridTextBoxColumn;
                    XmlNode xProperties     = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "TextAlignMode", c.ColumnTextAlignMode.ToString(), xProperties);
                    XmlAdder.Attribute(xDoc, "Editable", c.IsEditable ? "true" : "false", xProperties);
                    XmlAdder.Attribute(xDoc, "IsAutoSort", c.SortMode == DataGridViewColumnSortMode.Automatic ? "true" : "false", xProperties);
                }
                break;

                case ItemTypes.Various:
                {
                    EasyGridVariousColumn c = col as EasyGridVariousColumn;
                    XmlNode xProperties     = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                }
                break;
                }
            }

            Rows.GetXml(xDoc, xTableNode);

            return(xTableNode);
        }
Exemplo n.º 21
0
        public void GetXml(XmlDocument xDoc, XmlNode body)
        {
            XmlElement table = XmlAdder.Element(xDoc, "Table", body);

            if (_tableName.Length > 0)
            {
                XmlAdder.Attribute(xDoc, "id", _tableName, table);
            }
            if (Style != null && Style.Length > 0)
            {
                XmlAdder.Attribute(xDoc, "Style", Style + "border-collapse:collapse;border:none;", table);
            }
            XmlAdder.Attribute(xDoc, "border", "0", table);
            XmlAdder.Attribute(xDoc, "cellspacing", "0", table);
            XmlAdder.Attribute(xDoc, "cellpadding", "0", table);

            base.GetXmlForThis(xDoc, table);

            #region width의 기준이 되는 row를 그려준다.
            XmlElement widRow = XmlAdder.Element(xDoc, "TR", table);
            XmlAdder.Attribute(xDoc, "Height", "1", widRow);

            //for (int i = 0; i < Widths.Count; i++)
            int totalWid = 0;
            foreach (int wid in Widths)
            {
                XmlElement td = XmlAdder.Element(xDoc, "TD", widRow);
                td.InnerText = "";
                if (wid >= 0)
                {
                    XmlAdder.Attribute(xDoc, "Width", wid.ToString(), td);
                    totalWid += wid;
                }
            }
            #endregion
            if (Width >= 0 && Width > totalWid)
            {
                XmlAdder.Attribute(xDoc, "Width", Width.ToString(), table);
            }

            int rowCount = 0;
            foreach (HtmlTableRow row in Rows)
            {
                if (row.BorderWidths == null)
                {
                    row.BorderWidths = new System.Drawing.Printing.Margins(0, 0, 0, 0);
                }

                if (row.BorderColors == null)
                {
                    row.BorderColor = Color.Empty;
                }

                if (BorderWidths != null)
                {
                    if (rowCount == 0)//처음
                    {
                        row.BorderWidths.Top = BorderWidths.Top;
                        if (BorderColors != null)
                        {
                            row.BorderColors[2] = BorderColors[2];
                        }
                    }
                    else if (rowCount == Rows.Count - 1) //마지막
                    {
                        row.BorderWidths.Bottom = BorderWidths.Bottom;
                        if (BorderColors != null)
                        {
                            row.BorderColors[3] = BorderColors[3];
                        }
                    }

                    row.BorderWidths.Left = BorderWidths.Left;
                    if (BorderColors != null)
                    {
                        row.BorderColors[0] = BorderColors[0];
                    }
                    row.BorderWidths.Right = BorderWidths.Right;
                    if (BorderColors != null)
                    {
                        row.BorderColors[1] = BorderColors[1];
                    }
                }
                row.GetXml(xDoc, table);
                rowCount++;
            }
        }
Exemplo n.º 22
0
        public XmlNode GetXml(XmlDocument xDoc, XmlNode parent = null)
        {
            XmlNode xLayout = XmlAdder.Element(xDoc, "Layout", parent);

            XmlAdder.Attribute(xDoc, "Dock", this.Dock.ToString(), xLayout);
            switch (this.Dock)
            {
            case DockStyle.Fill:
                break;

            case DockStyle.Left:
            case DockStyle.Right:
                XmlAdder.Attribute(xDoc, "Width", this.Width.ToString(), xLayout);
                break;

            case DockStyle.Top:
            case DockStyle.Bottom:
                XmlAdder.Attribute(xDoc, "Height", this.Height.ToString(), xLayout);
                break;

            case DockStyle.None:
                XmlAdder.Attribute(xDoc, "Width", this.Width.ToString(), xLayout);
                XmlAdder.Attribute(xDoc, "Height", this.Height.ToString(), xLayout);
                XmlAdder.Attribute(xDoc, "X", this.Location.X.ToString(), xLayout);
                XmlAdder.Attribute(xDoc, "Y", this.Location.Y.ToString(), xLayout);
                break;
            }
            if (this.BackgroundImage != null)
            {
                XmlAdder.Attribute(xDoc, "Background-Image", _backgroundImage_Path, xLayout);
            }
            if (this.BackColor.Equals(Color.Transparent) == false)
            {
                XmlAdder.Attribute(xDoc, "Background-Color", this.BackColor.ToString(), xLayout);
            }

            if (_layoutPanel is FlowLayoutPanel)
            {
                XmlNode flow = XmlAdder.Element(xDoc, "Flow", xLayout);

                for (int i = 0; i < _layoutPanel.Controls.Count; i++)
                {
                    //XmlComponent xCom = new XmlComponent(_layoutPanel, _idList, _namespace);
                    XmlNode com     = XmlAdder.Element(xDoc, "Component", flow);
                    Control control = _layoutPanel.Controls[i];
                    XmlAdder.Attribute(xDoc, "Width", control.Width.ToString(), com);
                    XmlAdder.Attribute(xDoc, "Height", control.Height.ToString(), com);
                    XmlAdder.Attribute(xDoc, "Name", control.Name, com);
                    XmlAdder.Attribute(xDoc, "Name", control.Name, com);
                    IXmlComponent xRealCom = control as IXmlComponent;
                    if (xRealCom != null)
                    {
                        xRealCom.GetXml(xDoc, com);
                    }
                }
            }
            else //Panel
            {
                XmlNode panel = XmlAdder.Element(xDoc, "Panel", xLayout);
                for (int i = 0; i < _layoutPanel.Controls.Count; i++)
                {
                    XmlNode com     = XmlAdder.Element(xDoc, "Component", panel);
                    Control control = _layoutPanel.Controls[i];
                    XmlAdder.Attribute(xDoc, "Width", control.Width.ToString(), com);
                    XmlAdder.Attribute(xDoc, "Height", control.Height.ToString(), com);
                    XmlAdder.Attribute(xDoc, "X", control.Location.X.ToString(), com);
                    XmlAdder.Attribute(xDoc, "Y", control.Location.Y.ToString(), com);

                    IXmlComponent xRealCom = control as IXmlComponent;
                    if (xRealCom != null)
                    {
                        xRealCom.GetXml(xDoc, com);
                    }
                }
            }

            return(xLayout);
        }