using System.Collections.Generic; using System.Linq; using GDNXFD.Data; namespace IntelligentControlForsx { public class ClientCache { private AlertServiceClient asc = null; public IList AlertSnaps { get; set; } public Dictionary AlarmGroups { get; set; } public IList ShutdownEvents { get; set; } //光字牌分组统计,key: 光字牌ID public Dictionary LPModels { get; set; } #region 单例模式 private ClientCache() { } public static ClientCache Instance { get { return SingletonCreator.instance; } } class SingletonCreator { internal static readonly ClientCache instance = new ClientCache(); } #endregion #region 数据字典 public IList DataDict { get; set; } public IList GetDataDictByCategory(string category) { if (DataDict != null) { var tmp = DataDict.Where(c => c.Category == category && c.Enabled); if (tmp != null) return tmp.OrderBy(c => c.OrderNo).ToList(); } return null; } #endregion #region 风机数据 private IList wtList; private IList stList; private IList prjList; private IList lnList; public IList WindturbineList { get { if (wtList == null) { if (asc == null) asc = AlertServiceClientFactory.CreateAlertServiceClient(); wtList = asc.GetFDCWindturbinies(); } return wtList; } set { wtList = value; } } public IList StationList { get { if (stList == null) { if (asc == null) asc = AlertServiceClientFactory.CreateAlertServiceClient(); stList = asc.GetWindPowerStations(); } return stList; } set { stList = value; } } public IList ProjectList { get { if (prjList == null) { if (asc == null) asc = AlertServiceClientFactory.CreateAlertServiceClient(); prjList = asc.GetProjects(); } return prjList; } set { prjList = value; } } public IList LineList { get { if (lnList == null) { if (asc == null) asc = AlertServiceClientFactory.CreateAlertServiceClient(); lnList = asc.GetLines(); } return lnList; } set { lnList = value; } } #endregion } }