This commit is contained in:
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")]