using System; using System.Collections.Generic; using System.Text; using System.Configuration; using System.IO; using System.Xml; namespace Mesnac.Gui.Edit.Global { /// /// 此类用于解析平设计应用程序配置文件及保存全局变量 /// public class AppConfigHandler { #region 字段定义 private string _layoutConfigFile = String.Empty; //系统布局配置文件 private string _projectWizardFile = String.Empty; //工程向导配置文件 private string _templatePath = String.Empty; //工程模板路径 private string _controlLibraryFile = String.Empty; //工具箱控件库文件 private string _currentProjectWizardName = String.Empty; //当前工程模板名称 private string _localDbDefault = string.Empty; //本地默认连接数据库别名 private string _fullFileName = String.Empty; //保存当前工程文件的完整路径 #endregion #region 单例实现 private static AppConfigHandler instance = null; private AppConfigHandler() { this._layoutConfigFile = ConfigurationManager.AppSettings["layoutConfigFile"]; this._projectWizardFile = ConfigurationManager.AppSettings["projectWizardFile"]; this._templatePath = ConfigurationManager.AppSettings["templatePath"]; this._controlLibraryFile = ConfigurationManager.AppSettings["controlLibraryFile"]; } /// /// 应用程序配置文件解析类实例 /// public static AppConfigHandler Instance { get { if (instance == null) { instance = new AppConfigHandler(); } return instance; } } #endregion #region 配置文件变量 /// /// 布局配置文件 /// public string LayoutConfigFile { get { return _layoutConfigFile; } } /// /// 工程向导文件 /// public string ProjectWizardFile { get { return _projectWizardFile; } } /// /// 工程模板路径 /// public string TemplatePath { get { return _templatePath; } } /// /// 工具箱控件库文件 /// public string ControlLibraryFile { get { return _controlLibraryFile; } } #endregion #region 自定义全局变量 /// /// 当前工程文件的完整路径 /// public string FullFileName { get { return _fullFileName; } set { _fullFileName = value; } } /// /// 当前工程模板名称 /// public string CurrentProjectWizardName { get { return this._currentProjectWizardName; } set { this._currentProjectWizardName = value; } } #endregion } }