Esempio n. 1
0
 public static bool RaiseIfChanging <TSource, TReturn>(this TSource source,
                                                       TReturn backingField,
                                                       TReturn newValue, MvxPropertyChangingEventArgs <TReturn> args)
     where TSource : IMvxNotifyPropertyChanged
 {
     return(RaiseIfChanging(source, backingField, newValue, () => source.RaisePropertyChanging(args)));
 }
        public virtual bool RaisePropertyChanging <T>(MvxPropertyChangingEventArgs <T> changingArgs)
        {
            // check for interception before broadcasting change
            if (InterceptRaisePropertyChanging(changingArgs)
                == MvxInpcInterceptionResult.DoNotRaisePropertyChanging)
            {
                return(!changingArgs.Cancel);
            }

            if (ShouldLogInpc())
            {
                MvxLog.Instance.Trace($"Property '{changingArgs.PropertyName}' changing value to {changingArgs.NewValue.ToString()}");
            }

            PropertyChanging?.Invoke(this, changingArgs);

            return(!changingArgs.Cancel);
        }
Esempio n. 3
0
        public virtual bool RaisePropertyChanging <T>(MvxPropertyChangingEventArgs <T> changingArgs)
        {
            if (changingArgs == null)
            {
                return(false);
            }

            // check for interception before broadcasting change
            if (InterceptRaisePropertyChanging(changingArgs)
                == MvxInpcInterceptionResult.DoNotRaisePropertyChanging)
            {
                return(!changingArgs.Cancel);
            }

            if (ShouldLogInpc())
            {
                MvxLogHost.Default?.Log(LogLevel.Trace, "Property '{propertyName}' changing value to {newValue}",
                                        changingArgs.PropertyName, changingArgs.NewValue);
            }

            PropertyChanging?.Invoke(this, changingArgs);

            return(!changingArgs.Cancel);
        }
        public bool RaisePropertyChanging <T>(T newValue, [CallerMemberName] string whichProperty = "")
        {
            var changedArgs = new MvxPropertyChangingEventArgs <T>(whichProperty, newValue);

            return(RaisePropertyChanging(changedArgs));
        }