public override bool FromXML(System.Xml.XmlElement myElement) { base.FromXML(myElement); strUserName = myElement.GetAttribute("user"); //dtmDateTime = ZYCommon.StringCommon.ConvertToDateTime( myElement.GetAttribute("time"),null,System.DateTime.Now); dtmDateTime = StringCommon.ConvertToDateTime(myElement.GetAttribute("time"), null, ZYTime.GetServerTime()); intLevel = StringCommon.ToInt32Value(myElement.GetAttribute("level"), intLevel); return(true); }
/// <summary> /// 已重载:从XML节点加载对象数据 /// </summary> /// <param name="myElement">XML节点</param> /// <returns>操作是否成功</returns> public override bool FromXML(System.Xml.XmlElement myElement) { if (base.FromXML(myElement)) { this.Width = 30; this.Height = 30; if (myImage != null) { myImage.Dispose(); myImage = null; imagecontent = string.Empty; } if (this.SaveInFile) { try { myImage = StringCommon.ImageFromBase64String(myElement.InnerText); } catch { //如果不能加载出图片,则说明是该图片已经被修改过了 //需要使用图片编辑器 myImage = null; } if (myImage == null) { imagecontent = myElement.InnerText; MemoryStream ms = new MemoryStream(Convert.FromBase64String(imagecontent)); m_temppanel.LoadImage(ms); myImage = m_temppanel.CurrentImage; } } else { myImage = ZYTextConst.ImageFromURL(this.Src); //todo } if (myImage != null) { this.Width = myImage.Size.Width; this.Height = myImage.Size.Height; } if (myElement.HasAttribute(ZYTextConst.c_Width)) { this.Width = StringCommon.ToInt32Value(myElement.GetAttribute(ZYTextConst.c_Width), intWidth); } if (myElement.HasAttribute(ZYTextConst.c_Height)) { this.Height = StringCommon.ToInt32Value(myElement.GetAttribute(ZYTextConst.c_Height), intHeight); } myAttributes.SetValue(ZYTextConst.c_Width, intWidth.ToString()); myAttributes.SetValue(ZYTextConst.c_Height, intHeight.ToString()); return(true); } return(false); }
public bool FromXML(System.Xml.XmlElement myElement) { if (myElement != null) { strUserName = myElement.GetAttribute("name"); //dtSaveDateTime = ZYCommon.StringCommon.ConvertToDateTime( myElement.GetAttribute("time"),null,System.DateTime.Now); dtSaveDateTime = StringCommon.ConvertToDateTime(myElement.GetAttribute("time"), null, ZYTime.GetServerTime()); this.Lock = myElement.HasAttribute("lock"); this.Level = StringCommon.ToInt32Value(myElement.GetAttribute("level"), 0); return(true); } return(false); }
public bool FromXML(System.Xml.XmlElement RootElement) { if (RootElement != null) { UserName = RootElement.GetAttribute("username"); //MarkTime = StringCommon.ConvertToDateTime( RootElement.GetAttribute("marktime"),null,System.DateTime.Now); MarkTime = StringCommon.ConvertToDateTime(RootElement.GetAttribute("marktime"), null, ZYTime.GetServerTime()); Senior = RootElement.GetAttribute("senior"); SaveLogIndex = StringCommon.ToInt32Value(RootElement.GetAttribute("savelog"), 0); return(true); } return(false); }
/// <summary> /// 对元素数据进行基础的加载 /// </summary> /// <param name="myElement"></param> /// <returns></returns> protected bool BaseFromXML(System.Xml.XmlElement myElement) { if (myElement != null) { myAttributes.FromXML(myElement); //myAttributes.RemoveAttribute(ZYTextConst.c_Creator); //myAttributes.RemoveAttribute(ZYTextConst.c_Deleter); myAttributes.RemoveAttribute("createtime"); myAttributes.RemoveAttribute("deletetime"); if (myElement.HasAttribute(ZYTextConst.c_Creator)) { this.CreatorIndex = StringCommon.ToInt32Value(myElement.GetAttribute(ZYTextConst.c_Creator), 0); } else { this.CreatorIndex = 0; } if (myElement.HasAttribute(ZYTextConst.c_Deleter)) { this.DeleterIndex = StringCommon.ToInt32Value(myElement.GetAttribute(ZYTextConst.c_Deleter), -1); } else { this.DeleterIndex = -1; } //intDeleter = myAttributes.GetInt32( ZYTextConst.c_Deleter ); //intCreatorIndex = myAttributes.GetInt32( ZYTextConst.c_Creator); if (myBorder != null) { myBorder.FromXML(myElement); } UpdateAttrubute(); return(true); } return(false); }
/// <summary> /// 更新属性值 /// </summary> public virtual void UpdateAttrubute() { intDeleter = StringCommon.ToInt32Value(myAttributes.GetString(ZYTextConst.c_Deleter), -1); intCreatorIndex = StringCommon.ToInt32Value(myAttributes.GetString(ZYTextConst.c_Creator), -1); }
public override void UpdateAttrubute() { base.Width = StringCommon.ToInt32Value(myAttributes.GetString(ZYTextConst.c_Width), base.Width); base.Height = StringCommon.ToInt32Value(myAttributes.GetString(ZYTextConst.c_Height), base.Height); base.UpdateAttrubute(); }
/// <summary> /// 向XML节点加载对象数据,该函数不会重置所有的数据 /// </summary> /// <param name="myElement">XML节点对象</param> /// <returns>加载是否成功</returns> public bool FromXMLWithoutClear(System.Xml.XmlElement myElement) { if (myElement != null) { // all if (myElement.HasAttribute(c_Border_Color)) { this.BorderColor = StringCommon.ColorFromHtml(myElement.GetAttribute(c_Border_Color), DefaultColor); } if (myElement.HasAttribute(c_Border_Width)) { this.BorderWidth = StringCommon.ToInt32Value(myElement.GetAttribute(c_Border_Width), DefaultWidth); } if (myElement.HasAttribute(c_Border_Style)) { this.BorderStyle = ToBorderStyle(myElement.GetAttribute(c_Border_Style)); } // left if (myElement.HasAttribute(c_Border_Left_Color)) { leftColor = StringCommon.ColorFromHtml(myElement.GetAttribute(c_Border_Left_Color), DefaultColor); } if (myElement.HasAttribute(c_Border_Left_Width)) { leftWidth = StringCommon.ToInt32Value(myElement.GetAttribute(c_Border_Left_Width), DefaultWidth); } if (myElement.HasAttribute(c_Border_Left_Style)) { leftStyle = ToBorderStyle(myElement.GetAttribute(c_Border_Left_Style)); } // top if (myElement.HasAttribute(c_Border_Top_Color)) { topColor = StringCommon.ColorFromHtml(myElement.GetAttribute(c_Border_Top_Color), DefaultColor); } if (myElement.HasAttribute(c_Border_Top_Width)) { topWidth = StringCommon.ToInt32Value(myElement.GetAttribute(c_Border_Top_Width), DefaultWidth); } if (myElement.HasAttribute(c_Border_Top_Style)) { topStyle = ToBorderStyle(myElement.GetAttribute(c_Border_Top_Style)); } // right if (myElement.HasAttribute(c_Border_Right_Color)) { rightColor = StringCommon.ColorFromHtml(myElement.GetAttribute(c_Border_Right_Color), DefaultColor); } if (myElement.HasAttribute(c_Border_Right_Width)) { rightWidth = StringCommon.ToInt32Value(myElement.GetAttribute(c_Border_Right_Width), DefaultWidth); } if (myElement.HasAttribute(c_Border_Right_Style)) { rightStyle = ToBorderStyle(myElement.GetAttribute(c_Border_Right_Style)); } // bottom if (myElement.HasAttribute(c_Border_Bottom_Color)) { bottomColor = StringCommon.ColorFromHtml(myElement.GetAttribute(c_Border_Bottom_Color), DefaultColor); } if (myElement.HasAttribute(c_Border_Bottom_Width)) { bottomWidth = StringCommon.ToInt32Value(myElement.GetAttribute(c_Border_Bottom_Width), DefaultWidth); } if (myElement.HasAttribute(c_Border_Bottom_Style)) { bottomStyle = ToBorderStyle(myElement.GetAttribute(c_Border_Bottom_Style)); } // 背景色 hasBackGround = myElement.HasAttribute(c_BackGround_Color); if (hasBackGround) { backColor = StringCommon.ColorFromHtml(myElement.GetAttribute(c_BackGround_Color), DefaultBackColor); } else { backColor = DefaultBackColor; } return(true); } return(false); }