Added Printing/Length property

This commit is contained in:
Rich 2010-02-02 20:52:31 +00:00
parent 4a3cbb7b80
commit 572ff1f085

View File

@ -5,74 +5,91 @@ using System.ComponentModel;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
{ {
[Serializable] [Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
public class DocumentConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged public class DocumentConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{ {
#region XML #region XML
private XMLProperties _Xp; private XMLProperties _Xp;
private XMLProperties Xp private XMLProperties Xp
{
get { return _Xp; }
}
#endregion
#region Constructors
public Document _Document;
private DocumentInfo _DocumentInfo;
public DocumentConfig(Document document)
{ {
_Document = document; get { return _Xp; }
string xml = _Document.Config; }
#endregion
#region Constructors
public Document _Document;
private DocumentInfo _DocumentInfo;
public DocumentConfig(Document document)
{
_Document = document;
string xml = _Document.Config;
if (xml == string.Empty) xml = "<config/>"; if (xml == string.Empty) xml = "<config/>";
_Xp = new XMLProperties(xml); _Xp = new XMLProperties(xml);
} }
public DocumentConfig(DocumentInfo documentInfo) public DocumentConfig(DocumentInfo documentInfo)
{ {
_DocumentInfo = documentInfo; _DocumentInfo = documentInfo;
string xml = _DocumentInfo.Config; string xml = _DocumentInfo.Config;
if (xml == string.Empty) xml = "<config/>"; if (xml == string.Empty) xml = "<config/>";
_Xp = new XMLProperties(xml); _Xp = new XMLProperties(xml);
} }
internal string GetValue(string group, string item) internal string GetValue(string group, string item)
{ {
return _Xp[group, item]; return _Xp[group, item];
} }
#endregion #endregion
#region Properties #region Properties
[Category("General")] [Category("General")]
[DisplayName("Name")] [DisplayName("Name")]
[Description("Name")] [Description("Name")]
public string Name public string Name
{ {
get { return (_Document != null ? _Document.LibTitle : _DocumentInfo.LibTitle); } get { return (_Document != null ? _Document.LibTitle : _DocumentInfo.LibTitle); }
set { if (_Document != null) _Document.LibTitle = value; } set { if (_Document != null) _Document.LibTitle = value; }
} }
[Category("General")] [Category("General")]
[DisplayName("Comment")] [DisplayName("Comment")]
[RefreshProperties(RefreshProperties.All)] [RefreshProperties(RefreshProperties.All)]
[Description("Comment")] [Description("Comment")]
public string LibDoc_Comment public string LibDoc_Comment
{ {
get get
{ {
string s = _Xp["LibDoc", "Comment"];// get the saved value string s = _Xp["LibDoc", "Comment"];// get the saved value
return s; return s;
} }
set set
{ {
_Xp["LibDoc", "Comment"] = value; _Xp["LibDoc", "Comment"] = value;
OnPropertyChanged("LibDoc_Comment"); OnPropertyChanged("LibDoc_Comment");
} }
} }
#endregion [Category("Printing")]
#region ToString [DisplayName("Length")]
public override string ToString() [Description("Length of Document in Full and Partial Pages")]
{ public float Printing_Length
string s = _Xp.ToString(); {
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty; get
return s; {
} string s = _Xp["Printing", "Length"];// get the saved value
#endregion
} return float.Parse(s);
}
set
{
_Xp["Printing", "Length"] = string.Format("{0:0.0000}", value);
OnPropertyChanged("Printing_Length");
}
}
#endregion
#region ToString
public override string ToString()
{
string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty;
return s;
}
#endregion
}
} }