public void Dispose() { if (MonitorConfig != null) { MonitorConfig = null; } if (_instance != null) { _instance = null; } }
public object Clone() { MonitorConfigData newObj = new MonitorConfigData(); bool res = this.CopyTo(newObj); if (!res) { return(null); } else { return(newObj); } }
public void LoadMonitorConfig() { //1.判断是否有原始配置 //{ //读取原始配置给以上对象 //保存一次 //} //else //{ // 读库; //} //判断是否为空 //{ // 空的对象new一次。 // 也需要保存一次 //} MonitorConfig = new MonitorConfigData(); }
public bool CopyTo(object obj) { if (!(obj is MonitorConfigData)) { return(false); } MonitorConfigData temp = (MonitorConfigData)obj; temp.MonitorCycle = (MonitorCycleData)this.MonitorCycle.Clone(); temp.MonitorUIConfig = (MonitorUIDisplayConfig)this.MonitorUIConfig.Clone(); if (this.AllDisplayMonitorSysDataDic == null) { temp.AllDisplayMonitorSysDataDic = null; } else { temp.AllDisplayMonitorSysDataDic = new SerializableDictionary <string, OneDisplayMonitorData>(); foreach (KeyValuePair <string, OneDisplayMonitorData> keyvalue in this.AllDisplayMonitorSysDataDic) { temp.AllDisplayMonitorSysDataDic.Add(keyvalue.Key, (OneDisplayMonitorData)keyvalue.Value.Clone()); } } if (this.AllDataThresholdDic == null) { temp.AllDataThresholdDic = null; } else { temp.AllDataThresholdDic = new SerializableDictionary <string, DataThresholdInfo>(); foreach (KeyValuePair <string, DataThresholdInfo> keyvalue in this.AllDataThresholdDic) { temp.AllDataThresholdDic.Add(keyvalue.Key, (DataThresholdInfo)keyvalue.Value.Clone()); } } if (this.ControlFCInfos == null) { temp.ControlFCInfos = null; } else { temp.ControlFCInfos = new List <CtrlFuncCardPowerInfo>(); foreach (CtrlFuncCardPowerInfo ctrl in this.ControlFCInfos) { temp.ControlFCInfos.Add(ctrl); } } if (this.ControlAliaNamesDic == null) { temp.ControlAliaNamesDic = null; } else { temp.ControlAliaNamesDic = new SerializableDictionary <string, string>(); foreach (KeyValuePair <string, string> keyvalue in this.ControlAliaNamesDic) { temp.ControlAliaNamesDic.Add(keyvalue.Key, keyvalue.Value); } } temp.CareRegisterUser = this.CareRegisterUser; if (this.ScreenInfos == null) { temp.ScreenInfos = null; } else { temp.ScreenInfos = new SerializableDictionary <string, ScreenInfo>(); foreach (KeyValuePair <string, ScreenInfo> keyvalue in this.ScreenInfos) { temp.ScreenInfos.Add(keyvalue.Key, (ScreenInfo)keyvalue.Value.Clone()); } } return(true); }