Exemplo n.º 1
0
        public List <XmlNode> GetDataNodes(XmlDocument xdoc)
        {
            if (null == xdoc)
            {
                return(null);
            }

            List <XmlNode> list = new List <XmlNode>();

            try
            {
                string name = string.Empty;
                if (null != Tag)
                {
                    PmsEdit edit = Tag as PmsEdit;
                    if (null != edit)
                    {
                        name = edit.Name;
                    }
                    else
                    {
                        if (null != ((IElement)this).ExtendObject &&
                            !string.IsNullOrEmpty(((IElement)this).ExtendObject.Name))
                        {
                            name = ((IElement)this).ExtendObject.Name;
                        }
                    }
                }
                else
                {
                    name = Name;
                }
                XmlElement element = xdoc.CreateElement(name);
                //element.Attributes.Append(
                XmlAttribute xa = xdoc.CreateAttribute("id");
                xa.InnerText = Name;
                element.Attributes.Append(xa);
                element.InnerText = Text;
                list.Add(element);
            }
            catch (Exception ex)
            {
                PMSPublicInfo.Message.Error(ex.Message);
            }
            return(list);
        }
Exemplo n.º 2
0
        public object Clone()
        {
            PmsEdit edit = new PmsEdit();

            edit.BackColor       = this.BackColor;
            edit.Anchor          = this.Anchor;
            edit.Bounds          = this.Bounds;
            edit.ForeColor       = this.ForeColor;
            edit.Height          = this.Height;
            edit.Width           = this.Width;
            edit.VerticalScale   = this.VerticalScale;
            edit.HorizontalScale = this.HorizontalScale;
            edit.Location        = this.Location;
            edit.Left            = this.Left;
            edit.Top             = this.Top;
            edit.Var             = this.Var;
            edit.Text            = this.Text;
            edit.Region          = this.Region;
            edit.RightToLeft     = this.RightToLeft;
            edit.Site            = this.Site;
            edit.RealText        = this.RealText;
            edit.Size            = this.Size;
            edit.Name            = this.Name;
            edit.TextAlign       = this.TextAlign;
            edit.Font            = this.Font.Clone() as Font;
            edit.EnableMapping   = EnableMapping;
            edit.MappingTable    = MappingTable;
            edit.Visible         = Visible;
            edit.MESType         = MESType;
            edit.Multiline       = this.Multiline;
            if (null != ((IElement)this).Border)
            {
                ((IElement)edit).Border = ((IElement)this).Border.Clone() as ElementBorder;
                ((IElement)edit).Border.OwnerElement = edit;
            }
            ((IElement)edit).BorderName = ((IElement)this).BorderName;
            if (null != ((IElement)this).ExternDatas)
            {
                ((IElement)edit).ExternDatas = new List <ExternData>();
                foreach (ExternData ed in ((IElement)this).ExternDatas)
                {
                    object value = ed.Value;
                    if (null != value && value is ICloneable)
                    {
                        value = ((ICloneable)value).Clone();
                    }
                    ((IElement)edit).ExternDatas.Add(new ExternData(ed.Key, value));
                }
            }

            if (null != Tag)
            {
                if (Tag is ICloneable)
                {
                    edit.Tag = ((ICloneable)Tag).Clone();
                }
                else
                {
                    edit.Tag = Tag;
                }
            }

            if (null != ((IElement)this).ExtendObject)
            {
                ((IElement)edit).ExtendObject = ((IElement)this).ExtendObject.Clone() as ExtendObject;
            }
            return(edit);
        }