From 3b5e898cea4a7209a609c6d43de7e49710dc34a0 Mon Sep 17 00:00:00 2001 From: Kathy Date: Fri, 3 Oct 2008 11:25:33 +0000 Subject: [PATCH] --- .../Config/DocVersionConfig.cs | 2 + .../Config/DocumentConfig.cs | 86 +++++++++++++++++++ .../Config/FolderConfig.cs | 2 + .../Config/SectionConfig.cs | 4 +- 4 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 PROMS/VEPROMS.CSLA.Library/Config/DocumentConfig.cs diff --git a/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs index 43efd5fc..6e133581 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs @@ -156,6 +156,8 @@ namespace VEPROMS.CSLA.Library return null; } } + public DocVersion MyDocVersion + { get { return _DocVersion; } } #endregion #region ToString public override string ToString() diff --git a/PROMS/VEPROMS.CSLA.Library/Config/DocumentConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/DocumentConfig.cs new file mode 100644 index 00000000..d5e4b4ce --- /dev/null +++ b/PROMS/VEPROMS.CSLA.Library/Config/DocumentConfig.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.ComponentModel; + +namespace VEPROMS.CSLA.Library +{ + [Serializable] + [TypeConverter(typeof(ExpandableObjectConverter))] + public class DocumentConfig : DynamicTypeDescriptor, INotifyPropertyChanged + { + #region Events + public event PropertyChangedEventHandler PropertyChanged; + private void OnPropertyChanged(String info) + { + if (PropertyChanged != null) + PropertyChanged(this, new PropertyChangedEventArgs(info)); + } + #endregion + #region XML + private XMLProperties _Xp; + private XMLProperties Xp + { + get { return _Xp; } + } + #endregion + #region Constructors + public Document _Document; + private DocumentInfo _DocumentInfo; + public DocumentConfig(Document document) + { + _Document = document; + string xml = _Document.Config; + if (xml == string.Empty) xml = ""; + _Xp = new XMLProperties(xml); + } + public DocumentConfig(DocumentInfo documentInfo) + { + _DocumentInfo = documentInfo; + string xml = _DocumentInfo.Config; + if (xml == string.Empty) xml = ""; + _Xp = new XMLProperties(xml); + } + internal string GetValue(string group, string item) + { + return _Xp[group, item]; + } + #endregion + #region Properties + [Category("General")] + [DisplayName("Name")] + [Description("Name")] + public string Name + { + get { return (_Document != null ? _Document.LibTitle : _DocumentInfo.LibTitle); } + set { if (_Document != null) _Document.LibTitle = value; } + } + [Category("General")] + [DisplayName("Comment")] + [RefreshProperties(RefreshProperties.All)] + [Description("Comment")] + public string LibDoc_Comment + { + get + { + string s = _Xp["LibDoc", "Comment"];// get the saved value + + return s; + } + set + { + _Xp["LibDoc", "Comment"] = value; + OnPropertyChanged("LibDoc_Comment"); + } + } + #endregion + #region ToString + public override string ToString() + { + string s = _Xp.ToString(); + if (s == "" || s == "") return string.Empty; + return s; + } + #endregion + } +} \ No newline at end of file diff --git a/PROMS/VEPROMS.CSLA.Library/Config/FolderConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/FolderConfig.cs index 94b4037b..2c8678f9 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/FolderConfig.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/FolderConfig.cs @@ -179,6 +179,8 @@ namespace VEPROMS.CSLA.Library return null; } } + public Folder MyFolder + { get { return _Folder; } } #endregion #region ToString public override string ToString() diff --git a/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs index b3c86674..45465785 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs @@ -50,7 +50,8 @@ namespace VEPROMS.CSLA.Library set { _AncestorLookup = value; } } private Section _Section; - private SectionInfo _SectionInfo; + private SectionInfo _SectionInfo; + public SectionConfig(Section section) { _Section = section; @@ -527,6 +528,7 @@ namespace VEPROMS.CSLA.Library OnPropertyChanged("LibDoc_Comment"); } } + #endregion } }