public CollectionChangedEventArgs(ChangTransaction transaction) { if (transaction == null) { throw new ArgumentNullException(); } this.Transaction = transaction; }
public ValueChangedEventArgs(TValue oldValue, TValue newValue, ChangTransaction transaction) { if (transaction == null) { throw new ArgumentNullException(); } this.OldValue = oldValue; this.NewValue = newValue; this.Transaction = transaction; }
public void TriggerChanged(TValue oldValue, TValue newValue) { if (this.Changed == null) { return; } ChangTransaction.Perform(delegate(ChangTransaction t) { ValueChangedEventArgs <TValue> e = new ValueChangedEventArgs <TValue>(oldValue, newValue, t); this.Changed(this, e); }); }
public bool TriggerChanging(TValue oldValue, TValue newValue) { if (this.Changing == null) { return(true); } return(ChangTransaction.Perform(delegate(ChangTransaction t) { ValueChangingEventArgs <TValue> e = new ValueChangingEventArgs <TValue>(oldValue, newValue, t); this.Changing(this, e); return !e.Cancel; })); }
public void TriggerChanged(NotifyingCollection <TItem> oldValue, NotifyingCollection <TItem> newValue) { if (this.Changed == null) { return; } ChangTransaction.Perform(delegate(ChangTransaction t) { ValueChangingEventArgs <NotifyingCollection <TItem> > e = new ValueChangingEventArgs <NotifyingCollection <TItem> >(oldValue, newValue, t); this.Changed(this, e); }); }
public bool TriggerChanging(NotifyingCollection <TItem> oldValue, NotifyingCollection <TItem> newValue) { if (this.Changing == null) { return(true); } return(ChangTransaction.Perform(delegate(ChangTransaction t) { ValueChangingEventArgs <NotifyingCollection <TItem> > e = new ValueChangingEventArgs <NotifyingCollection <TItem> >(oldValue, newValue, t); this.Changing(this, e); return !e.Cancel; })); }
public static void Perform(Action <ChangTransaction> func) { ChangTransaction transaction = ChangTransaction.Current; if (transaction == null) { ChangTransaction.Current = new ChangTransaction(); } try { func(ChangTransaction.Current); if (transaction == null) { ChangTransaction.Current.Perform(); } } finally { ChangTransaction.Current = transaction; } }
public static TResult Perform <TResult>(Func <ChangTransaction, TResult> func) { TResult result; ChangTransaction transaction = ChangTransaction.Current; if (transaction == null) { ChangTransaction.Current = new ChangTransaction(); } try { result = func(ChangTransaction.Current); if (transaction == null) { ChangTransaction.Current.Perform(); } } finally { ChangTransaction.Current = transaction; } return(result); }
public ValueChangingEventArgs(TValue oldValue, TValue newValue, ChangTransaction transaction, bool cancel) : base(oldValue, newValue, transaction) { this.Cancel = cancel; }
public ValueChangingEventArgs(TValue oldValue, TValue newValue, ChangTransaction transaction) : base(oldValue, newValue, transaction) { this.Cancel = false; }