private void FireCollectionChangedEvent(NotifyCollectionChangeAction action, object item, int index, object oldItem = null) { try { if (CollectionChanged != null) { EditActionAttribute.BubbleIndentCounter++; if (EventSettings.EnableLogging) { eventsLog.DebugFormat(EditActionAttribute.BubbleIndent + "CollectionChanged L<< '{0}[{1}]', item:{2}, index:{3}, action:{4} - END <<<<<<<<<<<<<<", "EventedList", typeof(T).Name, item, index, action); } var args = new NotifyCollectionChangingEventArgs(action, item, index, -1) { OldItem = oldItem }; CollectionChanged(this, args); EditActionAttribute.BubbleIndentCounter--; } } finally { EditActionAttribute.FireAfterEventCall(this, false, false); } }
private bool FireCollectionChangingEvent(NotifyCollectionChangeAction action, T item, int index) { EditActionAttribute.FireBeforeEventCall(this, false); if (CollectionChanging != null) { if (EventSettings.EnableLogging) { eventsLog.DebugFormat(EditActionAttribute.BubbleIndent + "CollectionChanging L>> '{0}[{1}]', item:{2}, index:{3}, action:{4} - BEGIN >>>>>>>>>>>>>>", "EventedList", typeof(T).Name, item, index, action); } var args = new NotifyCollectionChangingEventArgs(action, item, index, -1); try { CollectionChanging(this, args); } catch { EditActionAttribute.FireAfterEventCall(this, false, args.Cancel); throw; } if (args.Cancel) { EditActionAttribute.FireAfterEventCall(this, false, args.Cancel); } return(!args.Cancel); } return(true); }
protected static void FireBeforeEventCall(object sender, bool isPropertyChange) { EditActionAttribute.FireBeforeEventCall(sender, isPropertyChange); }