Example #1
0
        public void MakeAwareOf(ActionExecutionContext context)
        {
            this.context = context;
            var inpc = context.Target as INotifyPropertyChanged;

            if (inpc == null)
            {
                return;
            }
            foreach (var viewModelProperty in ViewModelProperties(inpc))
            {
                observers.Add(new PropertyObserver(inpc, viewModelProperty, true, UpdateAvailability));
            }
            var otherProperties = from dependentProperty in dependentProperties.Select(propertyName => propertyName.Split('.'))
                                  where dependentProperty.Length > 1
                                  select dependentProperty;

            foreach (var args in otherProperties)
            {
                var viewModelProperty = args[0];
                var observer          = observers.FirstOrDefault(po => po.PropertyToWatch == viewModelProperty);
                if (observer == null)
                {
                    observers.Add(observer = new PropertyObserver(inpc, viewModelProperty, false, UpdateAvailability));
                }
                observer.AddChild(args);
            }
        }
 public void MakeAwareOf(ActionExecutionContext context)
 {
     this.context = context;
     var inpc = context.Target as INotifyPropertyChanged;
     if (inpc == null)
     {
         return;
     }
     foreach (var viewModelProperty in ViewModelProperties(inpc))
     {
         observers.Add(new PropertyObserver(inpc, viewModelProperty, true, UpdateAvailability));
     }
     var otherProperties = from dependentProperty in dependentProperties.Select(propertyName => propertyName.Split('.'))
                           where dependentProperty.Length > 1
                           select dependentProperty;
     foreach (var args in otherProperties)
     {
         var viewModelProperty = args[0];
         var observer = observers.FirstOrDefault(po => po.PropertyToWatch == viewModelProperty);
         if (observer == null)
         {
             observers.Add(observer = new PropertyObserver(inpc, viewModelProperty, false, UpdateAvailability));
         }
         observer.AddChild(args);
     }
 }