diff --git a/CASA/gui/Config.cs b/CASA/gui/Config.cs new file mode 100644 index 00000000..c57214fc --- /dev/null +++ b/CASA/gui/Config.cs @@ -0,0 +1,68 @@ +using System; +using Novell.CASA.CASAPolicy; + +namespace Novell.CASA.GUI +{ + /// + /// Summary description for Config. + /// + public class Config + { + private UIPol uiPolicy = null; + public Config() + { + if (uiPolicy == null) + { + uiPolicy = (UIPol)ICASAPol.GetPolicy(CASAPolType.UI_POL); + } + } + + public void SetConfigSetting(string sName, bool bValue) + { + if (bValue) + SetConfigSetting(sName, "1"); + else + SetConfigSetting(sName, "0"); + } + + public void SetConfigSetting(string sName, string sValue) + { + uiPolicy.SetConfigSetting(sName, sValue); + } + + + public bool GetConfigSetting(string sName, bool bDefaultValue) + { + string sDefault = "0"; + if (bDefaultValue) + sDefault = "1"; + + string sValue = GetConfigSetting(sName, sDefault); + { + if (sValue != null) + { + if (sValue.Equals("1")) + return true; + else + return false; + } + else + return bDefaultValue; + } + } + + public string GetConfigSetting(string sName, string sDefaultValue) + { + string sValue = uiPolicy.GetConfigSetting(sName); + if (sValue == null) + return sDefaultValue; + else + return sValue; + } + + public void WriteConfig() + { + uiPolicy.WriteConfig(); + } + } +}