Example #1
0
        public RelayCommandSubscription(
            IMvxCommand command,
            INotifyPropertyChanged propertyChanged,
            Expression <Func <object> >[] properties
            )
        {
            if (command == null)
            {
                throw new ArgumentNullException(nameof(command));
            }

            if (propertyChanged == null)
            {
                throw new ArgumentNullException(nameof(propertyChanged));
            }

            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            _commandReference = new WeakReference <IMvxCommand>(command);

            _subscription = propertyChanged.WeakSubscribe(OnPropertyChanged, properties);
        }
        public MvxPropertyChangedListener(INotifyPropertyChanged notificationObject)
        {
            if (notificationObject == null)
            {
                throw new ArgumentNullException("notificationObject");
            }

            _notificationObject = notificationObject;
            _token = _notificationObject.WeakSubscribe(NotificationObjectOnPropertyChanged);
        }
Example #3
0
 public static WeakPropertyChangedSubscription WeakSubscribe <T>(this INotifyPropertyChanged source, Expression <Func <T> > property, EventHandler <PropertyChangedEventArgs> target)
 {
     return(source.WeakSubscribe((property.Body as MemberExpression).Member.Name, target));
 }
Example #4
0
 public static WeakPropertyChangedSubscription WeakSubscribe(this INotifyPropertyChanged source, EventHandler <PropertyChangedEventArgs> target)
 {
     return(source.WeakSubscribe(null, target));
 }