private void OnTransactionCommited(object sender, DslModeling.TransactionCommitEventArgs e) { if (!this.IsSerializing && !e.Transaction.IsNested && !e.Transaction.IsSerializing) { StoreEventBufferingScope.RaiseOrBufferEvent(() => { this.TransactionCommited(this, e); }); } }
private void OnElementDeleted(object sender, DslModeling.ElementDeletedEventArgs e) { var element = e.ModelElement as IInstanceBase; if (element != null && !this.IsSerializing) { StoreEventBufferingScope.RaiseOrBufferEvent(() => { var eventArgs = ValueEventArgs.Create(element); this.ElementDeleted(this, eventArgs); }); } }
private void OnElementAdded(object sender, DslModeling.ElementAddedEventArgs e) { var element = e.ModelElement as IInstanceBase; if (element != null) { // ElementCreated is raised always, regardless of how the element was created. StoreEventBufferingScope.RaiseOrBufferEvent(() => { var eventArgs = ValueEventArgs.Create(element); this.ElementCreated(this, eventArgs); }); if (!this.IsSerializing) { // We only invoke this event if the element has not been marked in the state. // it wants instantiation events (the default is true, see StoreEventBufferingScope ctor). if (ShouldRaiseInstantiate(e.ModelElement)) { StoreEventBufferingScope.RaiseOrBufferEvent(() => { var eventArgs = ValueEventArgs.Create(element); this.ElementInstantiated(this, eventArgs); }); } } else { // We're deserializing the element, so we raise the Loaded event. StoreEventBufferingScope.RaiseOrBufferEvent(() => { var eventArgs = ValueEventArgs.Create(element); this.ElementLoaded(this, eventArgs); }); } } }