Пример #1
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);
                }
            }
        }
Пример #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);
        }
Пример #3
0
 public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
 {
     if (rootNode == null)
     {
         return;
     }
     XmlControlHandler.GetDefaultControlAttributes(rootNode, xDoc, this);
 }
Пример #4
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);
            }
        }
Пример #5
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"));
        }
Пример #6
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);
            }
        }
Пример #7
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"));
        }
Пример #8
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;
            }
        }
Пример #9
0
        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
        }
Пример #10
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;
             *
             *  }
             * }
             */
        }
Пример #11
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));
                 * }
                 */
            }
        }