Ejemplo n.º 1
0
        public CollectionChangedEventArgs(ChangTransaction transaction)
        {
            if (transaction == null)
            {
                throw new ArgumentNullException();
            }

            this.Transaction = transaction;
        }
Ejemplo n.º 2
0
        public ValueChangedEventArgs(TValue oldValue, TValue newValue, ChangTransaction transaction)
        {
            if (transaction == null)
            {
                throw new ArgumentNullException();
            }

            this.OldValue    = oldValue;
            this.NewValue    = newValue;
            this.Transaction = transaction;
        }
Ejemplo n.º 3
0
 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);
     });
 }
Ejemplo n.º 4
0
 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;
     }));
 }
Ejemplo n.º 5
0
 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);
     });
 }
Ejemplo n.º 6
0
 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;
     }));
 }
Ejemplo n.º 7
0
        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;
            }
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
 public ValueChangingEventArgs(TValue oldValue, TValue newValue, ChangTransaction transaction, bool cancel)
     : base(oldValue, newValue, transaction)
 {
     this.Cancel = cancel;
 }
Ejemplo n.º 10
0
 public ValueChangingEventArgs(TValue oldValue, TValue newValue, ChangTransaction transaction)
     : base(oldValue, newValue, transaction)
 {
     this.Cancel = false;
 }