132 lines
3.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
namespace VEPROMS.CSLA.Library
{
[Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))]
public class UserConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
public UserConfig(string xml)
{
if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
public UserConfig()
{
_Xp = new XMLProperties();
}
public override string ToString()
{
string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty;
return s;
}
#region UserCategory // from user.cfg
[Category("User")]
[DisplayName("User Location1")]
[RefreshProperties(RefreshProperties.All)]
[Description("User Location1")]
public string User_UserLoc1
{
get
{
return _Xp["user", "UserLoc1"];
}
set
{
_Xp["user", "UserLoc1"] = value;
OnPropertyChanged("User_UserLoc1");
}
}
[Category("User")]
[DisplayName("User Location2")]
[RefreshProperties(RefreshProperties.All)]
[Description("User Location2")]
public string User_UserLoc2
{
get
{
return _Xp["user", "UserLoc2"];
}
set
{
_Xp["user", "UserLoc2"] = value;
OnPropertyChanged("User_UserLoc2");
}
}
[Category("User")]
[DisplayName("User Phone1")]
[RefreshProperties(RefreshProperties.All)]
[Description("User Phone1")]
public string User_UserPhone1
{
get
{
return _Xp["user", "UserPhone1"];
}
set
{
_Xp["user", "UserPhone1"] = value;
OnPropertyChanged("User_UserPhone1");
}
}
[Category("User")]
[DisplayName("User Phone2")]
[RefreshProperties(RefreshProperties.All)]
[Description("User Phone2")]
public string User_UserPhone2
{
get
{
return _Xp["user", "UserPhone2"];
}
set
{
_Xp["user", "UserPhone2"] = value;
OnPropertyChanged("User_UserPhone2");
}
}
[Category("User")]
[DisplayName("User Email")]
[RefreshProperties(RefreshProperties.All)]
[Description("User Email")]
public string User_UserEmail
{
get
{
return _Xp["user", "UserEmail"];
}
set
{
_Xp["user", "UserEmail"] = value;
OnPropertyChanged("User_UserEmail");
}
}
[Category("User")]
[DisplayName("User Cell Phone")]
[RefreshProperties(RefreshProperties.All)]
[Description("User Cell Phone")]
public string User_CellPhone
{
get
{
return _Xp["user", "UserCellPhone"];
}
set
{
_Xp["user", "UserCellPhone"] = value;
OnPropertyChanged("User_UserCellPhone");
}
}
#endregion
}
}