diff --git a/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs index 15165115..43efd5fc 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs @@ -11,21 +11,28 @@ namespace VEPROMS.CSLA.Library [TypeConverter(typeof(ExpandableObjectConverter))] public class DocVersionConfig : DynamicTypeDescriptor, INotifyPropertyChanged { + #region Events public event PropertyChangedEventHandler PropertyChanged; private void OnPropertyChanged(String info) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(info)); } + #endregion + #region DynamicTypeDescriptor internal override bool IsReadOnly { get { return _DocVersion == null; } } + #endregion + #region XML private XMLProperties _Xp; private XMLProperties Xp { get { return _Xp; } } + #endregion + #region Constructors //PROPGRID: Hide ParentLookup [Browsable(false)] public bool ParentLookup @@ -95,6 +102,8 @@ namespace VEPROMS.CSLA.Library { return _Xp[group, item]; } + #endregion + #region Local Properties [Category("General")] [DisplayName("Name")] [Description("Name")] @@ -121,13 +130,17 @@ namespace VEPROMS.CSLA.Library { get { - if (_DocVersion != null && _DocVersion.MyFormat != null) return _DocVersion.MyFormat.PlantFormat.FormatData.Name; - if (_DocVersionInfo != null && _DocVersionInfo.MyFormat != null) return _DocVersionInfo.MyFormat.PlantFormat.FormatData.Name; + if (_DocVersion != null && _DocVersion.MyFormat != null) return _DocVersion.MyFormat.FullName; + if (_DocVersionInfo != null && _DocVersionInfo.MyFormat != null) return _DocVersionInfo.MyFormat.FullName; return null; } set { - if (_DocVersion != null) _DocVersion.MyFormat = FormatList.ToFormat(value); // Can only be set if _DocVersion is set + if (_DocVersion != null) + { + _DocVersion.MyFormat = FormatList.ToFormat(value); // Can only be set if _DocVersion is set + _DocVersion.ActiveFormat = null; + } } } [Category("Format Settings")] @@ -138,22 +151,61 @@ namespace VEPROMS.CSLA.Library { get { - if (_DocVersion != null && _DocVersion.MyFolder != null && _DocVersion.MyFolder.ActiveParent != null) return _DocVersion.MyFolder.ActiveFormat.PlantFormat.FormatData.Name; - if (_DocVersionInfo != null && _DocVersionInfo.MyFolder != null && _DocVersionInfo.MyFolder.ActiveParent != null) return _DocVersionInfo.MyFolder.ActiveFormat.PlantFormat.FormatData.Name; + if (_DocVersion != null && _DocVersion.MyFolder != null && _DocVersion.MyFolder.ActiveParent != null) return _DocVersion.MyFolder.ActiveFormat.FullName; + if (_DocVersionInfo != null && _DocVersionInfo.MyFolder != null && _DocVersionInfo.MyFolder.ActiveParent != null) return _DocVersionInfo.MyFolder.ActiveFormat.FullName; return null; } } + #endregion + #region ToString public override string ToString() { string s = _Xp.ToString(); if (s == "" || s == "") return string.Empty; return s; } - + #endregion // #region RODefaults // From proc.ini [Category("Referenced Objects")] + [DisplayName("RO Path")] + [RefreshProperties(RefreshProperties.All)] + [Description("Path to RO.FST")] + public string RODefaults_ropath + { + get + { + string s = _Xp["RODefaults", "ROPATH"];// get the saved value + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("RODefaults", "ROPATH"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + s = ""; // no default for empty for path + + return s; + } + set + { + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("RODefaults", "ROPATH"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ""; + + if (parval.Equals(value)) + _Xp["RODefaults", "ROPATH"] = string.Empty; // reset to parent value + else + _Xp["RODefaults", "ROPATH"] = value; // save selected value + + OnPropertyChanged("RODefaults_ropath"); + } + } + [Category("Referenced Objects")] [DisplayName("Default RO Prefix")] [RefreshProperties(RefreshProperties.All)] [Description("Setpoint Prefix")] diff --git a/PROMS/VEPROMS.CSLA.Library/Config/FolderConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/FolderConfig.cs index 15f0c252..94b4037b 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/FolderConfig.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/FolderConfig.cs @@ -12,21 +12,28 @@ namespace VEPROMS.CSLA.Library //public class FolderConfig : INotifyPropertyChanged public class FolderConfig : DynamicTypeDescriptor, INotifyPropertyChanged { + #region Events public event PropertyChangedEventHandler PropertyChanged; private void OnPropertyChanged(String info) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(info)); } + #endregion + #region DynamicTypeDescriptor internal override bool IsReadOnly { get { return _Folder == null; } } + #endregion + #region XML private XMLProperties _Xp; private XMLProperties Xp { get { return _Xp; } } + #endregion + #region Constructors //PROPGRID: Hide ParentLookup [Browsable(false)] public bool ParentLookup @@ -61,7 +68,11 @@ namespace VEPROMS.CSLA.Library return GetParentValue(args.Group, args.Item); return string.Empty; } - + public bool HasParent() + { + if (_Folder.ActiveParent != null) return true; + return false; + } public string GetParentValue(string group, string item) { for (Folder folder = _Folder.MyParent; folder != null; folder = folder.MyParent) @@ -104,13 +115,15 @@ namespace VEPROMS.CSLA.Library { return _Xp[group, item]; } + #endregion + #region Local Properties [Category("General")] [DisplayName("Name")] [Description("Name")] public string Name { get { return (_Folder != null ? _Folder.Name : _FolderInfo.Name); } - set { if (_Folder != null)_Folder.Name = value; } + set { if (_Folder != null) _Folder.Name = value; } } //PROPGRID: Hide Title [Category("General")] @@ -140,13 +153,17 @@ namespace VEPROMS.CSLA.Library { get { - if (_Folder != null && _Folder.MyFormat != null) return _Folder.MyFormat.PlantFormat.FormatData.Name; - if (_FolderInfo != null && _FolderInfo.MyFormat != null) return _FolderInfo.MyFormat.PlantFormat.FormatData.Name; + if (_Folder != null && _Folder.MyFormat != null) return _Folder.MyFormat.FullName; + if (_FolderInfo != null && _FolderInfo.MyFormat != null) return _FolderInfo.MyFormat.FullName; return null; } set { - if (_Folder != null) _Folder.MyFormat = FormatList.ToFormat(value); + if (_Folder != null) + { + _Folder.MyFormat = FormatList.ToFormat(value); + _Folder.ActiveFormat = null; + } } } [Category("Format Settings")] @@ -157,17 +174,59 @@ namespace VEPROMS.CSLA.Library { get { - if (_Folder != null && _Folder.MyParent != null && _Folder.MyParent.ActiveFormat != null) return _Folder.MyParent.ActiveFormat.PlantFormat.FormatData.Name; - if (_FolderInfo != null && _FolderInfo.MyParent != null && _FolderInfo.MyParent.ActiveFormat != null) return _FolderInfo.MyParent.ActiveFormat.PlantFormat.FormatData.Name; + if (_Folder != null && _Folder.ActiveParent != null && _Folder.ActiveParent.ActiveFormat != null) return _Folder.ActiveParent.ActiveFormat.FullName; + if (_FolderInfo != null && _FolderInfo.MyParent != null && _FolderInfo.MyParent.ActiveFormat != null) return _FolderInfo.MyParent.ActiveFormat.FullName; return null; } } + #endregion + #region ToString public override string ToString() { string s = _Xp.ToString(); if (s == "" || s == "") return string.Empty; return s; } + #endregion + #region RODefaults + [Category("Referenced Objects")] + [DisplayName("RO Path")] + [RefreshProperties(RefreshProperties.All)] + [Description("Path to RO.FST")] + public string RODefaults_ropath + { + get + { + string s = _Xp["RODefaults", "ROPATH"];// get the saved value + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("RODefaults", "ROPATH"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + s = ""; // no default for empty for path + + return s; + } + set + { + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("RODefaults", "ROPATH"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ""; + + if (parval.Equals(value)) + _Xp["RODefaults", "ROPATH"] = string.Empty; // reset to parent value + else + _Xp["RODefaults", "ROPATH"] = value; // save selected value + + OnPropertyChanged("RODefaults_ropath"); + } + } + #endregion #region GraphicsCategory // From veproms.ini public bool CanWrite(string str) { @@ -549,7 +608,7 @@ namespace VEPROMS.CSLA.Library Default = 0, [Description("Single Column")] OneColumn, - [Description("Duel Column")] + [Description("Dual Column")] TwoColumn, [Description("Triple Column")] ThreeColumn, @@ -612,7 +671,6 @@ namespace VEPROMS.CSLA.Library } } #endregion - #region DefaultsCategory // from proc.ini [Category("Referenced Objects")] [DisplayName("Default RO Prefix")] @@ -1097,6 +1155,7 @@ namespace VEPROMS.CSLA.Library } } #endregion + #region EditorSettingsCategory //[Category("Defaults")] //PROPGRID: Hide text background color @@ -1128,5 +1187,16 @@ namespace VEPROMS.CSLA.Library OnPropertyChanged("Default_BkColor"); } } + #endregion + + public bool CheckUniqueName(string p) + { + FolderInfo parent = FolderInfo.Get(_Folder.ParentID); + foreach (FolderInfo fi in parent.ChildFolders) + { + if (fi.FolderID != _Folder.FolderID && p == fi.Name) return false; + } + return true; + } } } diff --git a/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs index 55392698..ddd3cbbb 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs @@ -185,6 +185,8 @@ namespace VEPROMS.CSLA.Library return null; } } + public Procedure MyProcedure + { get { return _Procedure; } } #endregion #region ToString public override string ToString() @@ -201,7 +203,7 @@ namespace VEPROMS.CSLA.Library Default = 0, [Description("Single Column")] OneColumn, - [Description("Duel Column")] + [Description("Dual Column")] TwoColumn, [Description("Triple Column")] ThreeColumn, diff --git a/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs index 1cbb7c2c..b3c86674 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs @@ -175,18 +175,41 @@ namespace VEPROMS.CSLA.Library [Category("Format")] [DisplayName("Format")] [Description("Format")] - [TypeConverter(typeof(FormatList))] + [TypeConverter(typeof(FormatList))] public string FormatSelection { get { - if (_Section != null && _Section.MyContent.MyFormat != null) return _Section.MyContent.MyFormat.PlantFormat.FormatData.Name; - if (_SectionInfo != null && _SectionInfo.MyContent.MyFormat != null) return _SectionInfo.MyContent.MyFormat.PlantFormat.FormatData.Name; + if (_Section != null && _Section.MyContent.MyFormat != null) return _Section.MyContent.MyFormat.FullName; + if (_SectionInfo != null && _SectionInfo.MyContent.MyFormat != null) return _SectionInfo.MyContent.MyFormat.FullName; return null; } set { - if (_Section != null) _Section.MyContent.MyFormat = FormatList.ToFormat(value); // Can only be set if _DocVersion is set + if (_Section != null) + { + _Section.MyContent.MyFormat = FormatList.ToFormat(value); // Can only be set if _DocVersion is set + _Section.ActiveFormat = null; + DocStyleListConverter.MySection = _Section; + } + } + } + [Browsable(false)] + public FormatInfo MyFormat + { + get + { + if (_Section != null) + { + SectionInfo sectionInfo = SectionInfo.Get(_Section.ItemID); + return sectionInfo.LocalFormat; + } + return _SectionInfo.LocalFormat; + } + set + { + if (_Section != null) + _Section.MyContent.MyFormat = value == null ? null : value.Get(); } } [Category("Format")] @@ -197,11 +220,64 @@ namespace VEPROMS.CSLA.Library { get { - if (_Section != null && _Section.ActiveParent != null && _Section.ActiveParent.ActiveFormat != null) return _Section.ActiveParent.ActiveFormat.PlantFormat.FormatData.Name; - if (_SectionInfo != null && _SectionInfo.MyParent != null && _SectionInfo.MyParent.ActiveFormat != null) return _SectionInfo.MyParent.ActiveFormat.PlantFormat.FormatData.Name; + if (_Section != null && _Section.ActiveParent != null && _Section.ActiveParent.ActiveFormat != null) return _Section.ActiveParent.ActiveFormat.FullName; + if (_SectionInfo != null && _SectionInfo.MyParent != null && _SectionInfo.MyParent.ActiveFormat != null) return _SectionInfo.MyParent.ActiveFormat.FullName; return null; } } + [Browsable(false)] + public FormatInfo MyDefaultFormat + { + get + { + if (_Section != null) + { + SectionInfo sectionInfo = SectionInfo.Get(_Section.ItemID); + return sectionInfo.ActiveParent.ActiveFormat; + } + return _SectionInfo.ActiveParent.ActiveFormat; + } + } + //[Browsable(false)] + [Category("Format")] + [DisplayName("Section Type")] + [Description("Section Type")] + [TypeConverter(typeof(DocStyleListConverter))] + public string MySectionType + { + get + { + if (_Section != null) + { + return DocStyleListConverter.ToString(_Section.MyContent.Type); + } + return string.Empty; + } + set + { + if (_Section != null) + _Section.MyContent.Type = DocStyleListConverter.ToSectionType(value); + } + } + [Browsable(false)] + public int? SectionType + { + get + { + if (_Section != null) + { + return _Section.MyContent.Type-10000; + } + return null; + } + set + { + if (_Section != null) + _Section.MyContent.Type = value+10000; + } + } + public Section MySection + { get { return _Section; } } #endregion #region ToString public override string ToString() @@ -331,7 +407,7 @@ namespace VEPROMS.CSLA.Library Default = 0, [Description("Single Column")] One, - [Description("Duel Column")] + [Description("Dual Column")] Two, [Description("Triple Column")] Three, diff --git a/PROMS/VEPROMS.CSLA.Library/Config/XMLProperties.cs b/PROMS/VEPROMS.CSLA.Library/Config/XMLProperties.cs index c63d0bff..741af4cf 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/XMLProperties.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/XMLProperties.cs @@ -22,7 +22,7 @@ namespace VEPROMS.CSLA.Library public XMLProperties() { _XmlContents = new XmlDocument(); - _XmlContents.LoadXml(""); + _XmlContents.LoadXml(""); } public XMLProperties(string xml) {