Example #1
0
        private void Analysis()
        {
            foreach (XmlNode element in mDoc.SelectSingleNode("//Page").ChildNodes)
            {
                NewBaseControl newControl = ControlFactory.GetInstance().CreateControl(Util.Utils.GetElementType(element), Util.Utils.GetElementPosition(element));

                newControl.ControlNum  = Util.Utils.GetElementNum(element);
                newControl.ControlType = Util.Utils.GetElementType(element);
                newControl.ControlSize = Util.Utils.GetElementSize(element);
                newControl.ControlData = Util.Utils.GetElementData(element);
                newControl.Create();

                ControlList.Add(newControl);
            }
        }
Example #2
0
        public void Change(NewBaseControl baseControl)
        {
            XmlNode ChangeNode = mDoc.SelectSingleNode("//element[@Num=" + baseControl.ControlNum + "]");

            XmlNode position = ChangeNode.SelectSingleNode("position");

            position.Attributes["StartX"].Value = baseControl.ControlPosition.X.ToString();
            position.Attributes["StartY"].Value = baseControl.ControlPosition.Y.ToString();
            position.Attributes["Width"].Value  = baseControl.ControlSize.Width.ToString();
            position.Attributes["Height"].Value = baseControl.ControlSize.Height.ToString();

            XmlNode data = ChangeNode.SelectSingleNode("data");

            data.InnerText = baseControl.ControlData;
        }
Example #3
0
        private void Add(String controlType, Point position)
        {
            NewBaseControl control = ControlFactory.GetInstance().CreateControl(controlType, position);

            ControlList.Insert(Config.ElementNodeStartNum - 1, control);

            NodeBase   node         = NodeFactory.GetInstance().CreateNode(control);
            XmlElement beInsertNode = node.Create(mDoc);

            XmlNode parentNode   = mDoc.SelectSingleNode("//Page[@Num=1]");
            XmlNode previousNode = mDoc.SelectSingleNode("//element[@Num=" + (Config.ElementNodeStartNum - 1) + "]");

            parentNode.InsertAfter(beInsertNode, previousNode);

            Config.ElementNodeStartNum++;
        }
Example #4
0
        public NodeBase CreateNode(NewBaseControl control)
        {
            String Key = Util.Utils.GetElementKey(control.ControlType);

            NodeBase element = new NodeBase();

            element.Name = "element";
            element.Attrs.Add("Num", control.ControlNum);
            element.Attrs.Add("Key", Key);
            element.Attrs.Add("Type", control.ControlType);
            element.Attrs.Add("Desc", "");
            element.ChildNodes.Add(new NodeFormat(control.ControlType));

            NodeBase position = new NodeBase();

            position.Name    = "position";
            position.Content = "";
            position.Attrs   = new Dictionary <string, object>
            {
                { "StartX", control.ControlPosition.X },
                { "StartY", control.ControlPosition.Y },
                { "Width", control.ControlSize.Width },
                { "Height", control.ControlSize.Height }
            };
            position.ChildNodes = null;

            if (control.ControlType.Contains("Active"))
            {
                element.ChildNodes.Add(new NodeRequirement(Key));
            }

            if (control.ControlType.Equals("Table"))
            {
                position.Attrs.Add("rows", "2");
                position.Attrs.Add("columns", "2");
                position.Attrs.Add("cellWidth", "1,1");
            }

            element.ChildNodes.Add(position);

            element.ChildNodes.Add(new NodeBase {
                Name = "data", Content = control.ControlData, Attrs = null, ChildNodes = null
            });

            return(element);
        }
Example #5
0
        public NewBaseControl CreateControl(String controlType, Point position)
        {
            NewBaseControl control = null;

            switch (controlType)
            {
            case "Text":
                control = new NewText();
                break;

            case "ActiveText":
                control = new NewActiveText();
                break;

            case "Image":
                control = new NewImage();
                break;

            case "ActiveImage":
                control = new NewActiveImage();
                break;

            case "BackGroundImage":
                control = new NewBackGroundImage();
                break;

            case "Line":
                control = new NewLine();
                break;

            case "Table":
                control = new NewTable();
                break;
            }
            control.ControlNum      = Config.ElementNodeStartNum;
            control.ControlType     = controlType;
            control.ControlPosition = position;
            control.Create();

            return(control);
        }