public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this);

            XmlNodeList children;

            children = XmlGetter.Children(rootNode, "Item");
            if (children != null)
            {
                foreach (XmlNode child in children)
                {
                    String name = XmlGetter.Attribute(child, "Name");
                    if (name.Length > 0)
                    {
                        _items.Add(name, child.InnerText.Trim());
                    }
                    //if (child != null) _items = child.InnerText;
                }
            }

            /*
             * child = XmlGetter.Child(rootNode, "ColumnName");
             * if (child != null) _columnName = child.InnerText;
             *
             * child = XmlGetter.Child(rootNode, "RowName");
             * if (child != null) _rowName = child.InnerText;
             *
             * child = XmlGetter.Child(rootNode, "Enabled");
             * if (child != null) _enabled = child.InnerText;
             */
        }
Example #2
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, bool refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultControlAttributes(rootNode, xDoc, this, refLoad);

            if (rootNode.ChildNodes.Count == 0)
            {
                throw new Exception("올바른 Tab 태그가 아닙니다. <Panel> 이나 <Flow> 중 하나를 자식으로 가져야 합니다.");
            }

            string ns = XmlGetter.Attribute(rootNode, "NameSpace");

            if (ns.Length > 0)
            {
                if (_namespace != null && _namespace.Length > 0)
                {
                    _namespace += GlobalVars.Seperator + ns;
                }
                else
                {
                    _namespace = ns;
                }
            }
            this.Dock = DockStyle.Fill;

            _layoutPanel = XmlControlHandler.LoadLayoutChildren(rootNode.FirstChild, this, _idList, _namespace, this);
        }
        void XmlScenarioTable_E_ContextMenuClicked(object sender, EasyGridMenuClickArgs e)
        {
            _menuClickedArgs = e;
            _currentCell     = Cell(e.RowIndex, e.ColIndex) as IEasyGridCell;

            XmlControlHandler.RunEvent(this, "OnMenuClicked");
        }
Example #4
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultControlAttributes(rootNode, xDoc, this);

            foreach (XmlNode child in rootNode.ChildNodes)
            {
                if (child.Name.Equals("BufferSize"))
                {
                    if (int.TryParse(child.InnerText, out _bufferSize) == false)
                    {
                        _bufferSize = _initBufferSize;
                    }
                }
                else if (child.Name.Equals("SaveFile"))
                {
                    String path = XmlGetter.Attribute(child, "Path");
                    if (path.Contains(":") == false)//절대경로가 아닐 경우..
                    {
                        path = XmlLayoutCollection.NowLoadingPath + "\\" + path;
                    }
                    String fileFormat = XmlGetter.Attribute(child, "SavingFormat");
                    String ext        = XmlGetter.Attribute(child, "Extension");
                    SetSaveFile(path, fileFormat, ext);
                }
            }
        }
Example #5
0
 public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
 {
     if (rootNode == null)
     {
         return;
     }
     XmlControlHandler.GetDefaultControlAttributes(rootNode, xDoc, this);
 }
 void XmlScenarioTable_E_CellClicked(object sender, CellClickEventArgs e)
 {
     _currentCell = Cell(e.RowIndex, e.ColIndex) as IEasyGridCell;
     if (_currentCell != null)
     {
         XmlControlHandler.RunEvent(this, "OnCellClicked");
     }
 }
 void XmlScenarioTable_E_CheckBoxChanged(object sender, CellCheckedEventArgs e)
 {
     _currentCell        = Cell(e.EndRowIndex, e.ColumnIndex) as IEasyGridCell;
     _checkboxChangedArg = e;
     if (_currentCell != null)
     {
         XmlControlHandler.RunEvent(this, "OnCheckBoxChanged");
     }
 }
 void XmlScenarioTable_E_TextChanged(object sender, CellTextChangedEventArgs e)
 {
     _currentCell     = Cell(e.RowIndex, e.ColIndex) as IEasyGridCell;
     _textChangedArgs = e;
     if (_currentCell != null)
     {
         XmlControlHandler.RunEvent(this, "OnTextChanged");
     }
 }
Example #9
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultControlAttributes(rootNode, xDoc, this);

            if (rootNode.ChildNodes.Count == 0)
            {
                throw new Exception("올바른 Layout 태그가 아닙니다. <Panel> 이나 <Flow> 중 하나를 자식으로 가져야 합니다.");
            }
            if (_namespace.Length == 0)
            {
                _namespace = XmlGetter.Attribute(rootNode, "NameSpace");
            }
            else
            {
                String Namespace = XmlGetter.Attribute(rootNode, "NameSpace");
                if (Namespace.Length > 0)
                {
                    _namespace = _namespace + GlobalVars.Seperator + Namespace;
                }
                else
                {
                }        //do nothing. parent's namesapce will be used for control's namespace.
            }


            _layoutPanel = XmlControlHandler.LoadLayoutChildren(rootNode.ChildNodes[0], this, _idList, _namespace, this);

            try
            {
                string backPath = XmlGetter.Attribute(rootNode, "Background-Image");
                if (XmlLayoutCollection.NowLoadingPath.Length > 0)
                {
                    backPath = XmlLayoutCollection.NowLoadingPath + XmlLayoutCollection.PathSeperator + backPath;
                }
                if (backPath.Length > 0)
                {
                    _layoutPanel.BackgroundImage = Image.FromFile(backPath);
                }
                string imageLayout = XmlGetter.Attribute(rootNode, "Background-ImageLayout");
                if (imageLayout.Length > 0)
                {
                    _layoutPanel.BackgroundImageLayout = (ImageLayout)GlobalVars.ImageLayouts.ToList().IndexOf(imageLayout);
                }
                _backgroundImage_Path = backPath; //이미지 지정에 성공하면 배정함.
            }
            catch { }
            String backColor = XmlGetter.Attribute(rootNode, "Background-Color");

            if (backColor.Length > 0)
            {
                _layoutPanel.BackColor = XmlHandlers.ValueParser.StringToColor(backColor);
            }
        }
Example #10
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, bool refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultControlAttributes(rootNode, xDoc, this);

            this.TextAlign = GlobalVars.ContentAlignment(XmlGetter.Attribute(rootNode, "TextAlign"));
        }
Example #11
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultControlAttributes(rootNode, xDoc, this);

            XmlNode xImages = XmlGetter.Child(rootNode, "ImageList");

            if (xImages != null)
            {
                this.LedImages.Clear();
                XmlNode xImage;
                String  url;
                Image   img;
                xImage = XmlGetter.Child(xImages, "OffImage");
                if (xImages == null)
                {
                    throw new Exception("Led/ImageList/OffImage 태그는 필수입니다.");
                }
                url = XmlGetter.Attribute(xImages, "URL");
                img = Image.FromFile(url);
                this.LedImages.Add(img);

                xImage = XmlGetter.Child(xImages, "OnImage");
                if (xImages == null)
                {
                    throw new Exception("Led/ImageList/OnImage 태그는 필수입니다.");
                }
                url = XmlGetter.Attribute(xImages, "URL");
                img = Image.FromFile(url);
                this.LedImages.Add(img);

                xImage = XmlGetter.Child(xImages, "MidStateImage");
                if (xImages == null)
                {
                    throw new Exception("Led/ImageList/MidStateImage 태그는 필수입니다.");
                }
                url = XmlGetter.Attribute(xImages, "URL");
                img = Image.FromFile(url);
                this.LedImages.Add(img);
            }
            else
            {
                this.setImage(
                    FormAdders.Properties.Resources.led_on,
                    FormAdders.Properties.Resources.led_off,
                    FormAdders.Properties.Resources.led_mid);
            }
        }
Example #12
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this);

            _tagName = rootNode.Name;
            for (int i = 0; i < rootNode.ChildNodes.Count; i++)
            {
                XmlNode xImg = rootNode.ChildNodes[i];
                string  url  = XmlGetter.Attribute(xImg, "URL");

                AddImage(url);
            }
        }
Example #13
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultControlAttributes(rootNode, xDoc, this);


            if (rootNode.Attributes == null)
            {
                throw new Exception("Label에 최소한 Text 속성은 있어야 합니다.");
            }



            this.TextAlign = GlobalVars.ContentAlignment(XmlGetter.Attribute(rootNode, "TextAlign"));
        }
Example #14
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultControlAttributes(rootNode, xDoc, this);


            if (XmlGetter.Attribute(rootNode, "TextAlign").Equals("Right"))
            {
                this.TextAlign = HorizontalAlignment.Right;
            }
            else if (XmlGetter.Attribute(rootNode, "TextAlign").Equals("Center"))
            {
                this.TextAlign = HorizontalAlignment.Center;
            }
            else
            {
                this.TextAlign = HorizontalAlignment.Left;
            }
        }
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this);

            _tagName = rootNode.Name;
            if (rootNode.ChildNodes.Count > 0)
            {
                XmlNode xImg;
                string  url = "";

                xImg = XmlGetter.Child(rootNode, "NormalImage");
                //xImg = rootNode.SelectSingleNode("NormalImage");
                url = XmlGetter.Attribute(xImg, "URL");
                AddImage(url);
                xImg = xImg = XmlGetter.Child(rootNode, "CheckImage");
                url  = XmlGetter.Attribute(xImg, "URL");
                AddImage(url);
                xImg = xImg = XmlGetter.Child(rootNode, "InterImage");
                url  = XmlGetter.Attribute(xImg, "URL");
                AddImage(url);
                xImg = xImg = XmlGetter.Child(rootNode, "DisabledImage");
                url  = XmlGetter.Attribute(xImg, "URL");
                AddImage(url);
            }

            /*
             * for (int i = 0; i < rootNode.ChildNodes.Count; i++)
             * {
             *  XmlNode xImg = rootNode.ChildNodes[i];
             *  string url = XmlGetter.getAttr(xImg, "URL");
             *
             *  AddImage(url);
             * }
             */
        }
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this);
            _xRows = rootNode;
            Clear();

            for (int i = 0; i < rootNode.ChildNodes.Count; i++)
            {
                XmlNode xRow = rootNode.ChildNodes[i];
                if (xRow.NodeType == XmlNodeType.Comment)
                {
                    continue;
                }

                XmlScenarioRow row = new XmlScenarioRow(_table);
                row.LoadXml(xDoc, xRow);
                Add(row);
            }
        }
Example #17
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this);

            this.Clear();
            if (rootNode == null)
            {
                throw new Exception("올바른 Actions Tag가 아닙니다. 루트가 Actions 가 아닙니다. ");
            }
            for (int i = 0; i < rootNode.ChildNodes.Count; i++)
            {
                XmlNode xChild = rootNode.ChildNodes[i];
                if (xChild.Name.Equals("Condition"))
                {
                    XmlNode condNode = xChild.FirstChild;
                    Condition = XmlCondition.New(condNode.Name);
                    Condition.LoadXml(xDoc, xChild);
                }
                else if (xChild.Name.Equals("ComponentCondition"))
                {
                    ComCondition = XmlComConditions.New();//현재 loading중인 conmponent의 고유 ComponentCondition을 가져온다.
                    ComCondition.LoadXml(xDoc, xChild);
                }
                else
                {
                    XmlNode   xAction = xChild;
                    XmlAction action  = new XmlAction();
                    action.LoadXml(xDoc, xAction);
                    this.Add(action);
                }
            }
        }
Example #18
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this);

            string name = XmlGetter.Attribute(rootNode, "Name");

            //string realTimeArgs = XmlGetter.Attribute(rootNode, "IsRealTimeArgs");

            Name = name;
            //IsRealTimeArgs = ValueParser.IsTrue(realTimeArgs);

            XmlNodeList argList = XmlGetter.Children(rootNode, "Arg"); //Arg로 하나씩 나누었을 때

            if (argList.Count == 0)
            {
                XmlNode node = XmlGetter.Child(rootNode, "Args");//Args로 빈칸으로 구분하여 넣었을 때
                if (node != null)
                {
                    string[] args = node.InnerText.Split(" ,".ToCharArray());
                    Args = args;
                }
            }
            else
            {
                List <String> args = new List <string>();
                foreach (XmlNode node in argList)
                {
                    args.Add(node.InnerText);
                }
                Args = args.ToArray();
            }
        }
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, bool refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultControlAttributes(rootNode, xDoc, this, refLoad, Args, GetComponentValue);

            XmlNode xNode = XmlGetter.Child(rootNode, "TableInfo/BaseRowHeight");

            if (xNode != null)
            {
                this.BaseRowHeight = int.Parse(xNode.InnerText);
            }

            #region getTableColumn

            XmlNodeList xNodeList = XmlGetter.Children(rootNode, "Columns/Column");

            for (int i = 0; i < xNodeList.Count; i++)
            {
                XmlNode colNode = xNodeList[i];
                if (colNode.NodeType == XmlNodeType.Comment)
                {
                    continue;
                }

                int         wid                 = int.Parse(XmlGetter.Attribute(colNode, "Width"));
                String      name                = XmlGetter.Attribute(colNode, "Name");
                ItemTypes   itemType            = (ItemTypes)(ItemTypesText.ToList().IndexOf(XmlGetter.Attribute(colNode, "ItemType")));
                XmlNodeList colItems            = colNode.ChildNodes;
                Actions     onClickAction       = Actions.Auto;
                Actions     onDoubleClickAction = Actions.Auto;
                Actions     onRightClickAction  = Actions.Auto;

                XmlNode properties = null;
                for (int ci = 0; ci < colItems.Count; ci++)
                {
                    if (colItems[ci].NodeType == XmlNodeType.Comment)
                    {
                        continue;
                    }

                    if (colItems[ci].Name.Equals("Actions"))
                    {
                        XmlNodeList xActions = colItems[ci].ChildNodes;
                        for (int ai = 0; ai < xActions.Count; ai++)
                        {
                            if (xActions[ai].NodeType == XmlNodeType.Comment)
                            {
                                continue;
                            }

                            switch (xActions[ai].Name)
                            {
                            case "OnClick":
                                onClickAction = (Actions)(ActionsText.ToList().IndexOf(xActions[ai].InnerText));
                                break;

                            case "OnDoubleClick":
                                onDoubleClickAction = (Actions)(ActionsText.ToList().IndexOf(xActions[ai].InnerText));
                                break;

                            case "OnRightClick":
                                onRightClickAction = (Actions)(ActionsText.ToList().IndexOf(xActions[ai].InnerText));
                                break;
                            }
                        }
                    }
                    else
                    {
                        properties = colItems[ci];
                    }
                }

                MakeAColumn(wid, itemType, name, properties, onClickAction, onDoubleClickAction, onRightClickAction);
            }
            #endregion

            #region getRows

            XmlNode xRows = XmlGetter.Child(rootNode, "Rows");

            if (xRows != null && xRows.ChildNodes.Count > 0)
            {
                _rows = new XmlScenarioRows(this);
                Rows.LoadXml(xDoc, xRows);
            }
            else
            {
                _rows = new XmlScenarioRows(this, xDoc, rootNode);
            }
            //xNodeList = XmlGetter.Children(rootNode,"Rows/Row");

            #endregion
        }
 public void RunEvent(String eventName)
 {
     XmlControlHandler.RunEvent(_owner, eventName);
 }
Example #21
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this);

            String name = XmlGetter.Attribute(rootNode, "Name");
            //if (rowNode.NodeType == XmlNodeType.Comment) continue;

            XmlNodeList rowChildren = rootNode.ChildNodes;

            //Dictionary<String, object> relObjs = new Dictionary<string, object>();

            for (int chi = 0; chi < rowChildren.Count; chi++)
            {
                XmlNode rowNode = rowChildren[chi];
                //if (child.NodeType == XmlNodeType.Comment) continue;

                if (rowNode.Name.Equals("RowInfo"))
                {
                    for (int ri = 0; ri < rowNode.ChildNodes.Count; ri++)
                    {
                        XmlNode info = rowNode.ChildNodes[ri];
                        if (info.NodeType == XmlNodeType.Comment)
                        {
                            continue;
                        }

                        if (info.Name.Equals("Height"))
                        {
                            if (info.InnerText != null && info.InnerText.Length > 0)
                            {
                                this.Height = int.Parse(info.InnerText);
                            }
                        }
                        else if (info.Name.Equals("RelativeObjects"))
                        {
                            for (int roi = 0; roi < info.ChildNodes.Count; roi++)
                            {
                                XmlNode obj = info.ChildNodes[roi];
                                if (obj.NodeType == XmlNodeType.Comment)
                                {
                                    continue;
                                }

                                this.RelativeObject[XmlGetter.Attribute(obj, "Name")] = XmlGetter.Attribute(obj, "Value");
                            }
                        }
                    }
                }
                else if (rowNode.Name.Equals("Cells")) //cells
                {
                    XmlNodeList cells = rowNode.ChildNodes;
                    if (cells.Count < _table.ColumnCount)
                    {
                        throw new Exception("ParsingError: Table/Rows/Row/Cells/ 아래의 Cell 태그의 수가 Column의 개수보다 적습니다. Row:" + name);
                    }
                    object[] args     = new object[_table.ColumnCount];
                    String[] tooltips = new string[_table.ColumnCount];

                    int count = 0;
                    for (int ci = 0; ci < cells.Count; ci++) //Cell
                    {
                        XmlNode cell = cells[ci];
                        if (cell.NodeType == XmlNodeType.Comment)
                        {
                            continue;
                        }
                        else if (cell.Name.Equals("Cell") == false)
                        {
                            continue;
                        }

                        //string value = XmlGetter.Attribute(cell, "Value");
                        string tooltip = XmlGetter.Attribute(cell, "Tooptip");

                        if (tooltip.Length > 0)
                        {
                            tooltips[count] = tooltip;
                        }

                        string value = XmlGetter.Attribute(cell, "Value");
                        if (value.Length > 0)
                        {
                            //if (value == null) args[count] = GetSimpleValue(count, "");
                            //else
                            args[count] = GetSimpleValue(count, value);
                        }
                        else
                        {
                            XmlNode firstChild = XmlGetter.FirstChild(cell);

                            if (firstChild != null && firstChild.Name.Equals("ItemInfo")) //itemInfo
                            {
                                EasyGridCellInfo info = GetCellInfo(count, firstChild.ChildNodes);
                                if (firstChild.Attributes != null)
                                {
                                    XmlAttribute xItemType = firstChild.Attributes["ItemType"];
                                    if (xItemType != null)
                                    {
                                        info.ItemType = (ItemTypes)(XmlScenarioTable.ItemTypesText.ToList().IndexOf(xItemType.Value));
                                    }
                                }
                                args[count] = info;
                            }
                            else //simple value
                            {
                                if (value == null)
                                {
                                    args[count] = GetSimpleValue(count, "");               //빈 셀일때 default값을 받아온다.
                                }
                                else
                                {
                                    args[count] = GetSimpleValue(count, cell.InnerText);
                                }
                            }
                        }
                        count++;
                    }
                    this.MakeCells(args, tooltips);
                }
                else if (rowNode.Name.Equals("ChosenCells")) //cells
                {
                    XmlNodeList cells = rowNode.ChildNodes;


                    ListDic <String, String> ttps   = new ListDic <string, string>();
                    ListDic <String, object> argDic = new ListDic <string, object>();

                    /*
                     * for (int i = 0; i < _table.ColumnCount; i++)
                     * {
                     *  argDic[_table.ColumnName(i)] = GetSimpleValue(i, "");
                     *  ttps[_table.ColumnName(i)] = "";
                     * }
                     */
                    for (int ci = 0; ci < cells.Count; ci++) //Cell
                    {
                        XmlNode cell    = cells[ci];
                        String  colName = XmlGetter.Attribute(cell, "ColumnName");

                        if (cell.NodeType == XmlNodeType.Comment)
                        {
                            continue;
                        }
                        else if (cell.Name.Equals("Cell") == false)
                        {
                            continue;                                         //반드시 Cell Tag여야 한다.
                        }
                        else if (colName.Length == 0)
                        {
                            continue;                          //반드시 columnName이 있어야 한다.
                        }
                        string value   = XmlGetter.Attribute(cell, "Value");
                        string tooltip = XmlGetter.Attribute(cell, "Tooptip");

                        ttps[colName] = tooltip;
                        if (value.Length > 0)
                        {
                            argDic[colName] = value;
                        }
                        else
                        {
                            XmlNode itemInfo = XmlGetter.FirstChild(cell);

                            if (itemInfo != null && itemInfo.Name.Equals("ItemInfo")) //itemInfo
                            {
                                String    itemTypeText = XmlGetter.Attribute(itemInfo, "ItemType");
                                ItemTypes itemType     = (ItemTypes)(XmlScenarioTable.ItemTypesText.ToList().IndexOf(itemTypeText));

                                EasyGridCellInfo info = GetCellInfo(itemType, itemInfo.ChildNodes);
                                argDic[colName] = info;
                            }
                            else
                            {
                                throw new Exception("Cell의 내부 Tag로서 유효한 것은 ItemInfo밖에 없습니다. ChosenCell의 값은 반드시 있어야합니다.");
                            }
                        }
                    }
                    this.MakeCells(argDic, ttps);
                }
                else
                {
                    MessageBox.Show("Parsing Error: /Table/Rows/Row/ 아래에는 RowInfo 나 Cells 또는 ChosenCells 만 올 수 있습니다.");
                    return;
                }
            }
        }
Example #22
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, bool refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }


            string refPath  = XmlGetter.Attribute(rootNode, "Ref");
            bool   refExist = refPath.Length > 0;

            XmlNode comNode;

            if (refExist)
            {
                if (XmlLayoutCollection.NowLoadingPath.Length > 0)
                {
                    refPath = XmlLayoutCollection.NowLoadingPath + XmlLayoutCollection.PathSeperator + refPath;
                }

                comNode   = XmlGetter.RootNode(out _xDoc, refPath, null, XmlSchemaValidation);
                _filePath = refPath;
            }
            else
            {
                if (rootNode.ChildNodes.Count == 0)
                {
                    throw new Exception("Component 태그의 정의가 완전하지 않습니다. Ref로 xml파일을 불러오거나 직접 내부에 정의해야 합니다.\r\n name:" + XmlGetter.Attribute(rootNode, "Name"));
                }

                comNode = rootNode.ChildNodes[0];
            }
            string nameText;

            nameText = XmlGetter.Attribute(rootNode, "Name");

            XmlControlHandler.LoadInterface(this, rootNode, xDoc);


            Control control = XmlControlHandler.AddControl(nameText, xDoc, comNode, _panel, _idList, _namespace);;

            _realComponent = control;
            NowLoading     = control as IXmlComponent;
            //if (txt.Length > 0) control.Name = txt;
            if (XmlGetter.Attribute(rootNode, "Margin").Length > 0)
            {
                control.Margin = ValueParser.Padding(XmlGetter.Attribute(rootNode, "Margin"));
            }
            if (XmlGetter.Attribute(rootNode, "Padding").Length > 0)
            {
                control.Padding = ValueParser.Padding(XmlGetter.Attribute(rootNode, "Padding"));
            }
            if (XmlGetter.Attribute(rootNode, "Enabled").Length > 0)
            {
                control.Enabled = (XmlGetter.Attribute(rootNode, "Enabled").Equals("false") == false);
            }



            String hgt = XmlGetter.Attribute(rootNode, "Height");

            if (hgt.Length != 0)
            {
                control.Height = int.Parse(hgt);
            }
            String wid = XmlGetter.Attribute(rootNode, "Width");

            if (wid.Length != 0)
            {
                control.Width = int.Parse(wid);
            }

            if (_panel is FlowLayoutPanel)
            {
            }
            else if (_panel is Panel)
            {
                String x        = XmlGetter.Attribute(rootNode, "X");
                Point  location = new Point();
                if (x.Length != 0)
                {
                    location.X = int.Parse(x);
                }
                String y = XmlGetter.Attribute(rootNode, "Y");
                if (y.Length != 0)
                {
                    location.Y = int.Parse(y);
                }
                control.Location = location;
            }
        }
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this);

            if (rootNode.ChildNodes.Count == 0)
            {
                throw new Exception("올바른 LayoutCollection 태그가 아닙니다. <Layout>이 적어도 하나는 있어야 합니다.");
            }

            String xmlNamespace = XmlGetter.Attribute(rootNode, "NameSpace");

            if (xmlNamespace.Length > 0)
            {
                _namespace = xmlNamespace;                         //namepace를 덮어씌운다.
            }
            for (int i = 0; i < rootNode.ChildNodes.Count; i++)
            {
                XmlNode xLayout = rootNode.ChildNodes[i];
                if (xLayout.NodeType != XmlNodeType.Element)
                {
                    continue;                                          //주석을 거른다.
                }
                if (xLayout.Name.Equals("Layout") == false)
                {
                    continue;                                         //오직 자식으로는 Component만을 가진다.
                }
                XmlLayout layout = new XmlLayout(_localComponents, _namespace);
                layout.LoadXml(xDoc, xLayout);
                _parent.Controls.Add(layout);
            }

            foreach (string key in _localComponents.Keys)
            {
                if (_globalComponents.ContainsKey(key))
                {
                    throw new Exception("이미 [" + key + "] 이름으로 추가된 컴포넌트가 존재합니다. ");
                }
                else
                {
                    _globalComponents.Add(key, _localComponents[key]);
                }

                /*
                 * if (_namespace.Length == 0)
                 * {
                 *  if (_globalComponents.ContainsKey(key))
                 *  {
                 *      throw new Exception("이미 [" + key + "] 이름으로 추가된 컴포넌트가 존재합니다. ");
                 *  }
                 *  else
                 *  {
                 *      _globalComponents.Add(key, _localComponents[key]);
                 *  }
                 * }
                 * else
                 * {
                 *  if (_globalComponents.ContainsKey(_namespace +  GlobalVars.Seperator + key))
                 *  {
                 *      throw new Exception("같은 namespace [" + _namespace + "] 가 존재합니다. Namespace를 같이 쓰면 안됩니다.");
                 *  }
                 *  else
                 *  {
                 *      _globalComponents.Add(_namespace +  GlobalVars.Seperator + key, _localComponents[key]);
                 *  }
                 * }
                 */
            }
        }
Example #24
0
 protected override void OnClick(EventArgs e)
 {
     XmlControlHandler.RunEvent(this, EventTypes.OnClick.ToString());
     base.OnClick(e);
 }
Example #25
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultControlAttributes(rootNode, xDoc, this);

            String ns = XmlGetter.Attribute(rootNode, "NameSpace");

            if (ns.Length > 0)
            {
                if (_namespace != null && _namespace.Length > 0)
                {
                    _namespace += GlobalVars.Seperator + ns;
                }
                else
                {
                    _namespace = ns;
                }
            }

            XmlNode xInfo = XmlGetter.Child(rootNode, "TabControlInfo"); // rootNode.SelectSingleNode("TabControlInfo");

            XmlNode xTabImages = XmlGetter.Child(rootNode, "TabImages"); //xInfo.SelectSingleNode("TabImages");

            if (xTabImages != null)
            {
                XmlImageList xImgList = new XmlImageList("TabImages");

                xImgList.LoadXml(xDoc, xTabImages);
                this.ImageList = xImgList;
            }

            XmlNodeList xTabs = XmlGetter.Children(rootNode, "Tabs/Tab");

            for (int i = 0; i < xTabs.Count; i++)
            {
                XmlNode xTab = xTabs[i];
                //if (xTab.NodeType != XmlNodeType.Element) continue; //주석을 거른다.
                if (xTab.Name.Equals("Tab") == false)
                {
                    continue;                                   //오직 자식으로는 Component만을 가진다.
                }
                XmlTab tab = new XmlTab(_idList, _namespace);
                tab.LoadXml(xDoc, xTab);

                this.TabPages.Add(tab);
                //_parent.Controls.Add(tab);


                Dictionary <String, IXmlComponent> idList = tab._idList;

                /*
                 * for (int ids = 0; ids < idList.Count; ids++)
                 * {
                 *  string name = idList.Keys.ElementAt(ids);
                 *  if (_namespace.Length > 0) name = _namespace + "." + name; //namespace가 있으면 붙여서 namepace.name 형식으로 다시 naming..
                 *  Controls.Add(name, idList.Values.ElementAt(ids));
                 * }
                 */
            }
        }
Example #26
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            XmlControlHandler.GetDefaultControlAttributes(rootNode, xDoc, this);

            this.TextAlign = GlobalVars.ContentAlignment(XmlGetter.Attribute(rootNode, "TextAlign"));


            string disIndex = XmlGetter.Attribute(rootNode, "DisabledImageIndex");

            if (disIndex.Length > 0)
            {
                this.U_ButtonDisabledType = int.Parse(disIndex);
            }

            string color = XmlGetter.Attribute(rootNode, "ActivationColor");

            if (color.Length > 0)
            {
                this.ActiveBackColor = ValueParser.StringToColor(color);
            }



            string imageLayout = XmlGetter.Attribute(rootNode, "ImageLayout");

            if (imageLayout.Length > 0)
            {
                this.BackgroundImageLayout = (ImageLayout)GlobalVars.ImageLayouts.ToList().IndexOf(imageLayout);
            }
            else
            {
                this.BackgroundImageLayout = ImageLayout.Zoom;
            }


            //this.BackgroundImageLayout = ImageLayout.Stretch;

            XmlNode XImages = XmlGetter.Child(rootNode, "Images");// rootNode.SelectSingleNode("Images");

            _imageList.LoadXml(xDoc, XImages);

            /*
             *
             * for (int i = 0; i < rootNode.ChildNodes.Count; i++)
             * {
             *  XmlNode xChild = rootNode.ChildNodes[i];
             *  if (xChild.Name.Equals("Events"))
             *  {
             *      _events.LoadXml(xDoc, xChild);
             *  }
             *  else if (xChild.Name.Equals("Images"))
             *  {
             *      _imageList.LoadXml(xDoc, xChild);
             *      //_imageList = new XmlImageList();
             *      this.U_ImageList = _imageList;
             *
             *  }
             * }
             */
        }