This commit is contained in:
Kathy Ruffing 2008-08-12 11:18:05 +00:00
parent 3aedee5967
commit 610f408c6d
5 changed files with 224 additions and 24 deletions

View File

@ -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 == "<Config/>" || s == "<Config></Config>") return string.Empty;
return s;
}
#endregion
//<Config><RODefaults Setpoint="SP1" Graphics="IG1" ROPATH="g:\ops\vehlp\ro" /><PrintSettings ChangeBar="3" ChangeBarLoc="1" ChangeBarText="3" numcopies="1" Watermark="1" userformat=" " disableduplex="False" /><format plant="OHLP" /></Config>
#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")]

View File

@ -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 == "<config/>" || s == "<config></config>") 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;
}
}
}

View File

@ -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,

View File

@ -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,

View File

@ -22,7 +22,7 @@ namespace VEPROMS.CSLA.Library
public XMLProperties()
{
_XmlContents = new XmlDocument();
_XmlContents.LoadXml("<config/>");
_XmlContents.LoadXml("<Config/>");
}
public XMLProperties(string xml)
{