public bool SetData(CacheInfo <T> pCacheInfo, bool bIniting = false) { if (pCacheInfo == null) { return(false); } //缓存数据对象 pCacheInfo.IsNewDataTime = this.DataCache_Set.IsNewDataTime(pCacheInfo.DateTime); // 数据变动状态判断 _DataCaches[pCacheInfo.DateTime] = pCacheInfo; //数据变更事件 if (!bIniting && this.DataCache_Change != null) { DataCache_Event pArgs = new DataCache_Event(this, pCacheInfo); try { this.DataCache_Change(this, pArgs); } catch (Exception) { throw; } } //更新数据设置与检查执行 bool bResult = this.SetLastTime(pCacheInfo.DateTime) && this.CheckData(pCacheInfo.DateTime, pCacheInfo.Data); return(bResult); }
//缓存数据变动事件 public virtual void EventHandler_DataCacheChange(object sender, DataCache_Event e) { //事件转发-外部实现 if (this.DataCache_Change != null) { try { this.DataCache_Change(sender, e); } catch (Exception) { throw; } } }
//缓存数据检查对象初始事件--便于外部统一设置检查对象 public bool Event_DataChecks_Initial() { if (this.DataChecks_Initial != null) { DataCache_Event pArgs = new DataCache_Event(this, null);; try { this.DataChecks_Initial(null, pArgs); } catch (Exception) { throw; } } return(true); }
//触发数据装载事件--便于外部统一装载数据 public bool Event_DataCache_Load() { if (this.DataCache_Load != null) { DataCache_Event pArgs = new DataCache_Event(this, null); try { this.DataCache_Load(null, pArgs); } catch (Exception) { throw; } } return(true); }