internal void OnChangedNotify(AbstractEntity sender, CacheItemEventArgs e) { if (ChangedHandle != null) { ChangedHandle(sender, e); } }
/// <summary> /// 当前对象(包括继承)的属性触发通知事件 /// </summary> /// <param name="sender">触发事件源</param> /// <param name="eventArgs"></param> protected override void Notify(object sender, CacheItemEventArgs eventArgs) { if (_isReadOnly || CheckChnage()) { return; } //modify resean: not notify to ItemSet object. //eventArgs.Source = sender; AddChangePropertys(eventArgs.PropertyName); //base.Notify(this, eventArgs); PutToChangeKeys(this); }
/// <summary> /// 当前对象(包括继承)的属性触发通知事件 /// </summary> /// <param name="sender">触发事件源</param> /// <param name="eventArgs"></param> protected override void Notify(object sender, CacheItemEventArgs eventArgs) { IItemChangeEvent val = sender as IItemChangeEvent; if (val != null && !val.HasChanged) { return; } _hasChanged = true; PutToChangeKeys(sender); DoChangedNotify(sender as AbstractEntity, eventArgs); }
/// <summary> /// /// </summary> /// <param name="sender">由IContainer对象触发</param> /// <param name="eventArgs"></param> protected override void NotifyByChildren(object sender, CacheItemEventArgs eventArgs) { if (_isReadOnly || CheckChnage()) { return; } //eventArgs.Source = sender; AddChangePropertys(eventArgs.PropertyName); //更改子类事件触发者 //base.NotifyByChildren(this, eventArgs); PutToChangeKeys(this); }
private void BackplaneChanged(object sender, CacheItemEventArgs e) { if (this.Cache.Name == "CacheA") { UpdateStatus(0, 0, 1, 0); } else { UpdateStatus(0, 0, 0, 1); } //Console.WriteLine($"Changed {e.Key} {e.Region} on {this.Cache.Name}."); //ChangedEvents.Add(e); }
public void UnChangeNotify(string key) { CacheItemSet itemSet; if (Container.TryGetValue(key, out itemSet)) { //触发Unchange事件通知 var e = new CacheItemEventArgs { ChangeType = CacheItemChangeType.UnChange }; itemSet.UnChangeNotify(this, e); } }
/// <summary> /// 触发UnChange事件通知 /// </summary> internal override void UnChangeNotify(object sender, CacheItemEventArgs eventArgs) { if (ChildrenEvent != null) { ChildrenEvent.NotifyAll(sender, eventArgs); } if (!eventArgs.HasChanged) { _hasChanged = false; } if (eventArgs.ChangeType == CacheItemChangeType.DisableEvent) { SetDisableEvent(); } }
/// <summary> /// 当前对象中的属性包含的子类触发通知事件 /// </summary> /// <param name="sender">触发事件源</param> /// <param name="eventArgs"></param> protected virtual void NotifyByChildren(object sender, CacheItemEventArgs eventArgs) { if (!_isDisableEvent && (IsInCache || !(this is AbstractEntity))) { _hasChanged = true; if (ItemEvent != null) { if (string.IsNullOrEmpty(eventArgs.PropertyName)) { eventArgs.PropertyName = PropertyName; } ItemEvent.Notify(sender, eventArgs); } } }
/// <summary> /// 当前对象(包括继承)的属性触发通知事件 /// </summary> /// <param name="sender">触发事件源</param> /// <param name="eventArgs"></param> protected virtual void Notify(object sender, CacheItemEventArgs eventArgs) { //modify reason:调用ExclusiveModify方法多个属性被修改时,修改状态延后通知,减少频繁同步数据 if (!_isDisableEvent && !IsModifying && (IsInCache || !(this is AbstractEntity))) { IItemChangeEvent val; if ((val = sender as IItemChangeEvent) != null && !val.IsInCache) { val.IsInCache = true; } _hasChanged = true; if (ItemEvent != null) { ItemEvent.Notify(sender, eventArgs); } } }
public void UnChangeNotify(string key) { CacheItemSet itemSet; if (Container.TryGetValue(key, out itemSet)) { //触发Unchange事件通知 var e = new CacheItemEventArgs { ChangeType = CacheItemChangeType.UnChange }; var itemData = itemSet.ItemData as IItemChangeEvent; if (itemData != null) { itemData.UnChangeNotify(this, e); } } }
/// <summary> /// entity data send to client /// </summary> /// <param name="sender"></param> /// <param name="eventargs"></param> public static void OnChange(AbstractEntity sender, CacheItemEventArgs eventargs) { try { if (sender == null || (sender as BaseEntity) == null || !sender.GetSchema().IsEntitySync) { return; } string key = sender.GetKeyCode(); if (!_syncPools.ContainsKey(key)) { _syncPools[key] = true; _sendQueue.Enqueue(sender as BaseEntity); singal.Set(); } } catch (Exception ex) { TraceLog.WriteError("EntitySync Notify error:{0}", ex); } }
/// <summary> /// entity data send to client /// </summary> /// <param name="sender"></param> /// <param name="eventargs"></param> public static void OnChange(AbstractEntity sender, CacheItemEventArgs eventargs) { try { if (sender == null || (sender as BaseEntity) == null || !sender.GetSchema().IsEntitySync) { return; } string key = sender.GetKeyCode(); if (!_syncPools.ContainsKey(key)) { _syncPools[key] = true; _sendQueue.Enqueue(sender as BaseEntity); singal.Set(); } } catch (Exception ex) { TraceLog.WriteError("EntitySync Notify error:{0}", ex); } }
private static void QueueCacheItem_Removed(object Sender, CacheItemEventArgs <string, TabQueue> e) { TabQueue Queue = e.Value; string TabID = Queue.TabID; string Location; lock (Queue) { Queue.Queue.Clear(); } lock (locationByTabID) { if (locationByTabID.TryGetValue(TabID, out Location)) { locationByTabID.Remove(TabID); } else { Location = null; } } if (Location != null) { lock (tabIdsByLocation) { if (tabIdsByLocation.TryGetValue(Location, out Dictionary <string, List <KeyValuePair <string, string> > > TabIDs)) { if (TabIDs.Remove(TabID) && TabIDs.Count == 0) { tabIdsByLocation.Remove(Location); } } } } }
/// <summary> /// 当前对象中的属性包含的子类触发通知事件,通知到此层为根 /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> protected override void NotifyByChildren(object sender, CacheItemEventArgs eventArgs) { _hasChanged = true; PutToChangeKeys(sender); DoChangedNotify(sender as AbstractEntity, eventArgs); }
/// <summary> /// 当前对象(包括继承)的属性触发通知事件 /// </summary> /// <param name="sender">触发事件源</param> /// <param name="eventArgs"></param> protected override void Notify(object sender, CacheItemEventArgs eventArgs) { IItemChangeEvent val = sender as IItemChangeEvent; if (val != null && !val.HasChanged) { return; } _hasChanged = true; PutToChangeKeys(sender); DoChangedNotify(sender as AbstractEntity, eventArgs); }
private void OnChangedNotify(AbstractEntity sender, CacheItemEventArgs e) { if (sender != null) { //���ﴦ��Model����֪ͨ Console.WriteLine("update:{0},{1},{2}", sender.GetType().Name, e.ChangeType, e.PropertyName); EntitySyncManger.OnChange(sender, e); } }
/// <summary> /// 当前对象中的属性包含的子类触发通知事件 /// </summary> /// <param name="sender">触发事件源</param> /// <param name="eventArgs"></param> protected virtual void NotifyByChildren(object sender, CacheItemEventArgs eventArgs) { if (!_isDisableEvent) { _hasChanged = true; if (ItemEvent != null) { if (string.IsNullOrEmpty(eventArgs.PropertyName)) { eventArgs.PropertyName = PropertyName; } ItemEvent.Notify(sender, eventArgs); } } }
private void BackplaneRemoved(object sender, CacheItemEventArgs e) { //Console.WriteLine($"Removed {e.Key} {e.Region} from {this.Cache.Name}."); //RemovedEvents.Add(e); }
/// <summary> /// 解除变更事件通知 /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> internal abstract void UnChangeNotify(object sender, CacheItemEventArgs eventArgs);
/// <summary> /// 当前对象中的属性包含的子类触发通知事件,通知到此层为根 /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> protected override void NotifyByChildren(object sender, CacheItemEventArgs eventArgs) { _hasChanged = true; }
internal override void UnChangeNotify(object sender, CacheItemEventArgs eventArgs) { }
/// <summary> /// /// </summary> /// <param name="sender">由IContainer对象触发</param> /// <param name="eventArgs"></param> protected override void NotifyByChildren(object sender, CacheItemEventArgs eventArgs) { }
/// <summary> /// 当前对象(包括继承)的属性触发通知事件 /// </summary> /// <param name="sender">触发事件源</param> /// <param name="eventArgs"></param> protected virtual void Notify(object sender, CacheItemEventArgs eventArgs) { if (!_isDisableEvent) { _hasChanged = true; if (ItemEvent != null) { ItemEvent.Notify(sender, eventArgs); } } }
/// <summary> /// 当前对象(包括继承)的属性触发通知事件 /// </summary> /// <param name="sender">触发事件源</param> /// <param name="eventArgs"></param> protected override void Notify(object sender, CacheItemEventArgs eventArgs) { eventArgs.Source = sender; AddChangePropertys(eventArgs.PropertyName); base.Notify(this, eventArgs); }
/// <summary> /// 当前对象中的属性包含的子类触发通知事件,通知到此层为根 /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> protected override void NotifyByChildren(object sender, CacheItemEventArgs eventArgs) { _hasChanged = true; PutToChangeKeys(sender as AbstractEntity); DoChangedNotify(sender as AbstractEntity, eventArgs); }
private void OnServiceAdded(object sender, CacheItemEventArgs <NetworkService> e) { FoundService?.Invoke(this, new NetworkServiceEventArgs(e.Value)); }
private void DoChangedNotify(AbstractEntity sender, CacheItemEventArgs eventArgs) { if (OnChangedNotify != null) { OnChangedNotify.BeginInvoke(sender, eventArgs, null, null); } }
private static void Semaphores_Removed(object Sender, CacheItemEventArgs <string, MultiReadSingleWriteObject> e) { e.Value.Dispose(); }
/// <summary> /// 当前对象(包括继承)的属性触发通知事件 /// </summary> /// <param name="sender">触发事件源</param> /// <param name="eventArgs"></param> protected virtual void Notify(object sender, CacheItemEventArgs eventArgs) { //modify reason:调用ExclusiveModify方法多个属性被修改时,修改状态延后通知,减少频繁同步数据 if (!_isDisableEvent && !IsModifying) { _hasChanged = true; if (ItemEvent != null) { ItemEvent.Notify(sender, eventArgs); } } }
/// <summary> /// 触发UnChange事件通知 /// </summary> internal override void UnChangeNotify(object sender, CacheItemEventArgs eventArgs) { if (ChildrenEvent != null) { ChildrenEvent.NotifyAll(sender, eventArgs); } if (!eventArgs.HasChanged) { _hasChanged = false; } if (eventArgs.ChangeType == CacheItemChangeType.DisableEvent) { SetDisableEvent(); } }
private static void CacheItem_Removed(object Sender, CacheItemEventArgs <string, ChunkRecord> e) { e.Value.Dispose(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="eventargs"></param> protected virtual void DoChangedNotify(AbstractEntity sender, CacheItemEventArgs eventargs) { EntityChangedNotifyEvent handler = OnChangedNotify; if (handler != null) handler(sender, eventargs); }
/// <summary> /// 解除变更事件通知 /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> internal abstract void UnChangeNotify(object sender, CacheItemEventArgs eventArgs);