Event args for a tracking operation. Enables the handler to cancel the operation and to modify the data that will be persisted/applied.
Inheritance: System.ComponentModel.CancelEventArgs
Esempio n. 1
0
        private bool OnApplyingState(string property, ref object value)
        {
            var handler = ApplyingProperty;

            if (handler != null)
            {
                TrackingOperationEventArgs args = new TrackingOperationEventArgs(this, property, value);
                handler(this, args);
                value = args.Value;
                return(!args.Cancel);
            }
            else
            {
                return(true);
            }
        }
Esempio n. 2
0
        private object OnPersistingState(string property, object value)
        {
            var handler = PersistingProperty;

            if (handler != null)
            {
                TrackingOperationEventArgs args = new TrackingOperationEventArgs(this, property, value);
                handler(this, args);
                if (args.Cancel)
                {
                    throw new OperationCanceledException();
                }
                else
                {
                    return(args.Value);
                }
            }
            return(value);
        }