This commit is contained in:
parent
36323b44a7
commit
44b6d0e177
102
PROMS/VEPROMS.CSLA.Library/Config/AssocConfig.cs
Normal file
102
PROMS/VEPROMS.CSLA.Library/Config/AssocConfig.cs
Normal file
@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
[Serializable]
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public class AssociationConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
|
||||
{
|
||||
#region DynamicTypeDescriptor
|
||||
internal override bool IsReadOnly
|
||||
{
|
||||
get { return _Association == null; }
|
||||
}
|
||||
#endregion
|
||||
#region XML
|
||||
private XMLProperties _Xp;
|
||||
private XMLProperties Xp
|
||||
{
|
||||
get { return _Xp; }
|
||||
}
|
||||
#endregion
|
||||
#region Constructors
|
||||
private Association _Association;
|
||||
public AssociationConfig(Association association)
|
||||
{
|
||||
_Association = association;
|
||||
string xml = association.Config;
|
||||
if (xml == string.Empty) xml = "<Config/>";
|
||||
_Xp = new XMLProperties(xml);
|
||||
}
|
||||
private AssociationInfo _AssociationInfo;
|
||||
public AssociationConfig(AssociationInfo association)
|
||||
{
|
||||
_AssociationInfo = association;
|
||||
string xml = association.Config;
|
||||
if (xml == string.Empty) xml = "<Config/>";
|
||||
_Xp = new XMLProperties(xml);
|
||||
}
|
||||
public AssociationConfig(string xml)
|
||||
{
|
||||
_Xp = new XMLProperties(xml);
|
||||
}
|
||||
public AssociationConfig()
|
||||
{
|
||||
string xml = "<Config/>";
|
||||
_Xp = new XMLProperties(xml);
|
||||
}
|
||||
internal string GetValue(string group, string item)
|
||||
{
|
||||
return _Xp[group, item];
|
||||
}
|
||||
#endregion
|
||||
public Association MyAssociation
|
||||
{ get { return _Association; } }
|
||||
#region RODefaults // From proc.ini
|
||||
[Category("Referenced Objects")]
|
||||
[DisplayName("Default RO Prefix")]
|
||||
[RefreshProperties(RefreshProperties.All)]
|
||||
[Description("Setpoint Prefix")]
|
||||
public string RODefaults_setpointprefix
|
||||
{
|
||||
get
|
||||
{
|
||||
string s = _Xp["RODefaults", "Setpoint"];// get the saved value
|
||||
return s;
|
||||
}
|
||||
set
|
||||
{
|
||||
_Xp["RODefaults", "Setpoint"] = value; // save selected value
|
||||
OnPropertyChanged("RODefaults_setpointprefix");
|
||||
}
|
||||
}
|
||||
[Category("Referenced Objects")]
|
||||
[DisplayName("Default Graphics Prefix")]
|
||||
[RefreshProperties(RefreshProperties.All)]
|
||||
[Description("Graphics Prefix")]
|
||||
public string RODefaults_graphicsprefix
|
||||
{
|
||||
get
|
||||
{
|
||||
string s = _Xp["RODefaults", "Graphics"];// get the saved value
|
||||
return s;
|
||||
}
|
||||
set
|
||||
{
|
||||
_Xp["RODefaults", "Graphics"] = value; // save selected value
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region ToString
|
||||
public override string ToString()
|
||||
{
|
||||
string s = _Xp.ToString();
|
||||
if (s == "<Config/>" || s == "<Config></config>") return string.Empty;
|
||||
return s;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -163,43 +163,6 @@ namespace VEPROMS.CSLA.Library
|
||||
|
||||
#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")]
|
||||
@ -273,43 +236,6 @@ namespace VEPROMS.CSLA.Library
|
||||
OnPropertyChanged("RODefaults_graphicsprefix");
|
||||
}
|
||||
}
|
||||
[Category("Referenced Objects")]
|
||||
[DisplayName("Graphic File Extension")]
|
||||
[RefreshProperties(RefreshProperties.All)]
|
||||
[Description("Default File Extension")]
|
||||
public string Graphics_defaultext
|
||||
{
|
||||
get
|
||||
{
|
||||
string s = _Xp["Graphics", "defaultext"];// 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("Graphics", "defaultext"); // get the parent value
|
||||
// If there is no parent value, then use the volian default
|
||||
if (s == string.Empty)
|
||||
return s = "TIF";// default to volian default
|
||||
|
||||
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("Graphics", "defaultext"); // get the parent value
|
||||
|
||||
if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default
|
||||
parval = "TIF";
|
||||
|
||||
if (parval.Equals(value))
|
||||
_Xp["Graphics", "defaultext"] = string.Empty; // reset to parent value
|
||||
else
|
||||
_Xp["Graphics", "defaultext"] = value; // save selected value
|
||||
|
||||
OnPropertyChanged("Graphics_defaultext");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region PrintSettingsCategory // From curset.dat
|
||||
[Category("Print Settings")]
|
||||
|
Loading…
x
Reference in New Issue
Block a user