You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
3.3 KiB
C#

1 year ago
using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.IO;
using System.Xml;
namespace Mesnac.Gui.Edit.Global
{
/// <summary>
/// 此类用于解析平设计应用程序配置文件及保存全局变量
/// </summary>
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"];
}
/// <summary>
/// 应用程序配置文件解析类实例
/// </summary>
public static AppConfigHandler Instance
{
get
{
if (instance == null)
{
instance = new AppConfigHandler();
}
return instance;
}
}
#endregion
#region 配置文件变量
/// <summary>
/// 布局配置文件
/// </summary>
public string LayoutConfigFile
{
get { return _layoutConfigFile; }
}
/// <summary>
/// 工程向导文件
/// </summary>
public string ProjectWizardFile
{
get { return _projectWizardFile; }
}
/// <summary>
/// 工程模板路径
/// </summary>
public string TemplatePath
{
get { return _templatePath; }
}
/// <summary>
/// 工具箱控件库文件
/// </summary>
public string ControlLibraryFile
{
get { return _controlLibraryFile; }
}
#endregion
#region 自定义全局变量
/// <summary>
/// 当前工程文件的完整路径
/// </summary>
public string FullFileName
{
get { return _fullFileName; }
set { _fullFileName = value; }
}
/// <summary>
/// 当前工程模板名称
/// </summary>
public string CurrentProjectWizardName
{
get
{
return this._currentProjectWizardName;
}
set
{
this._currentProjectWizardName = value;
}
}
#endregion
}
}