public PropertyValueExceptionEventArgs(string message, PropertyValue value, PropertyValueExceptionSource source, Exception exception)
 {
     if (message == null)
     {
         throw new ArgumentNullException("message");
     }
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     if (!EnumValidator.IsValid(source))
     {
         throw new ArgumentOutOfRangeException("source");
     }
     if (exception == null)
     {
         throw new ArgumentNullException("exception");
     }
     if (exception.GetType() == typeof(TargetInvocationException))
     {
         exception = exception.InnerException;
     }
     this._message   = message;
     this._value     = value;
     this._source    = source;
     this._exception = exception;
 }
Пример #2
0
 public static bool IsValid(PropertyValueExceptionSource value)
 {
     if (value != PropertyValueExceptionSource.Get)
     {
         return(value == PropertyValueExceptionSource.Set);
     }
     return(true);
 }
        /// <summary>
        /// Creates a PropertyValueExceptionEventArgs
        /// </summary>
        /// <param name="message">A message indicating what failed</param>
        /// <param name="value">The PropertyValue in which the exception is occuring</param>
        /// <param name="source">The source that generated this exception (get or set)</param>
        /// <param name="exception">The inner excpetion</param>
        /// <exception cref="ArgumentNullException">When message is null</exception>
        /// <exception cref="ArgumentNullException">When value is null</exception>
        /// <exception cref="ArgumentNullException">When exception is null</exception>
        public PropertyValueExceptionEventArgs(string message, PropertyValue value, PropertyValueExceptionSource source, Exception exception)
        {
            if (message == null) throw FxTrace.Exception.ArgumentNull("message");
            if (value == null) throw FxTrace.Exception.ArgumentNull("value");
            if (!EnumValidator.IsValid(source)) throw FxTrace.Exception.AsError(new ArgumentOutOfRangeException("source"));
            if (exception == null) throw FxTrace.Exception.ArgumentNull("exception");

            _message = message;
            _value = value;
            _source = source;
            _exception = exception;
        }
        /// <summary>
        /// Creates a PropertyValueExceptionEventArgs
        /// </summary>
        /// <param name="message">A message indicating what failed</param>
        /// <param name="value">The PropertyValue in which the exception is occuring</param>
        /// <param name="source">The source that generated this exception (get or set)</param>
        /// <param name="exception">The inner excpetion</param>
        /// <exception cref="ArgumentNullException">When message is null</exception>
        /// <exception cref="ArgumentNullException">When value is null</exception>
        /// <exception cref="ArgumentNullException">When exception is null</exception>
        public PropertyValueExceptionEventArgs(string message, PropertyValue value, PropertyValueExceptionSource source, Exception exception)
        {
            if (message == null)
            {
                throw FxTrace.Exception.ArgumentNull("message");
            }
            if (value == null)
            {
                throw FxTrace.Exception.ArgumentNull("value");
            }
            if (!EnumValidator.IsValid(source))
            {
                throw FxTrace.Exception.AsError(new ArgumentOutOfRangeException("source"));
            }
            if (exception == null)
            {
                throw FxTrace.Exception.ArgumentNull("exception");
            }

            _message   = message;
            _value     = value;
            _source    = source;
            _exception = exception;
        }
Пример #5
0
 public static bool IsValid(PropertyValueExceptionSource value)
 {
     return value == PropertyValueExceptionSource.Get || value == PropertyValueExceptionSource.Set;
 }