Пример #1
0
 public static IObservable <ValidationErrorEventArgs> ObserveValidationErrors(this INotifyValidationError validable, string property)
 {
     if (validable == null)
     {
         throw new ArgumentNullException("validable");
     }
     if (property == null)
     {
         throw new ArgumentNullException("property");
     }
     return(Observable.FromEventPattern <EventHandler <ValidationErrorEventArgs>, ValidationErrorEventArgs>(
                o => validable.ErrorsChanged += o,
                o => validable.ErrorsChanged -= o)
            .Where(c => property == c.EventArgs.PropertyName)
            .Select(c => c.EventArgs));
 }
Пример #2
0
 public static Task <bool> HasError <T>(this INotifyValidationError validable, Expression <Func <T> > property)
 {
     return(validable.HasErrorAsync(property.GetPropertyName()));
 }
Пример #3
0
 public static IObservable <ValidationErrorEventArgs> ObserveValidationErrors <T>(this INotifyValidationError validable, Expression <Func <T> > property)
 {
     return(validable.ObserveValidationErrors(property.GetPropertyName()));
 }