Example #1
0
 public DeviceViewModel(SensorDevice device, MvxNotifyPropertyChanged parentViewModel, IBluetoothService bluetoothService, IDeviceSlotService deviceSlotService, IUserDialogs userDialogs, IMvxLog log)
 {
     _device            = device;
     _parentViewModel   = parentViewModel;
     _bluetoothService  = bluetoothService;
     _deviceSlotService = deviceSlotService;
     _userDialogs       = userDialogs;
     _log = log;
 }
 public static void OnPropertyChanged <T>(
     this MvxNotifyPropertyChanged viewModel,
     Expression <Func <T> > property,
     Action action)
 {
     if (property.Body is MemberExpression memberExpression)
     {
         viewModel.PropertyChanged += (sender, args) =>
         {
             if (args.PropertyName == memberExpression.Member.Name)
             {
                 action();
             }
         };
     }
     else
     {
         throw new ArgumentException("Expression must be of type MemberExpression and have a body.", nameof(property));
     }
 }
        public static void NotifyPropertyChanged <T> (this MvxNotifyPropertyChanged vm, Expression <Func <T> > property)
        {
            string propertyNameFromExpression = MvxPropertyNameExtensionMethods.GetPropertyNameFromExpression <T> (vm, property);

            vm.RaisePropertyChanged(propertyNameFromExpression);
        }
Example #4
0
 public static IApplicationService GetApplication(this MvxNotifyPropertyChanged that)
 {
     return(Mvx.IoCProvider.Resolve <IApplicationService>());
 }
 //TODO : rename to RaisePropertyChanged
 public static void NotifyPropertyChanged(this MvxNotifyPropertyChanged vm, [CallerMemberName] String propertyNameOrNothing = "")
 {
     vm.RaisePropertyChanged(propertyNameOrNothing);
 }