public override void OnSetValue(LocationInterceptionArgs args) { // WARNING: changed this from != to ! equals if ((args.Value == null && args.GetCurrentValue() != null) || (args.Value != null && !args.Value.Equals(args.GetCurrentValue()))) { var obj = (IModelObject)args.Instance; if (obj.Container != null) { obj.Container.NotifyObjectModified(obj); } } //args.ProceedSetValue(); base.OnSetValue(args); }
public void OnPropertySet(LocationInterceptionArgs args) { // Don't go further if the new value is equal to the old one. // (Possibly use object.Equals here). if (args.Value == args.GetCurrentValue()) { return; } // Actually sets the value. args.ProceedSetValue(); // Ignore properties with AutoDirtyIgnoreAttribute. var propertyInfo = args.Location.PropertyInfo; if (propertyInfo.GetCustomAttributes(typeof(AutoDirtyIgnoreAttribute), true).Any()) { return; } if (Instance is IDirty dirtyObject) { dirtyObject.SetDirty(); } }
public override void OnGetValue(LocationInterceptionArgs args) { if (args.GetCurrentValue() == null) { Console.WriteLine("Property ({0}) not initialized", args.LocationFullName); } }
public override void OnSetValue(LocationInterceptionArgs args) { var holder = (MauComponent)args.Instance; MauPropertyHolder mauPropHolder = holder.GetMauPropHolder(PropertyName); object curValue = args.GetCurrentValue(); // Mark this property as it's changed by .Net mauPropHolder.Touched = true; // Set value first, so i can reflect it base.OnSetValue(args); // Todo: make that 'callBackMethod' an global var mauPropHolder.SetCallBackMethod ??= holder.GetType().GetMethod($"{args.LocationName}OnSet", BindingFlags.NonPublic | BindingFlags.Static); if (mauPropHolder.SetCallBackMethod != null && args.Value?.Equals(curValue) == false) { mauPropHolder.SetCallBackMethod.Invoke(null, new object[] { holder }); } // HandleOnSet .? if (!mauPropHolder.HandleOnSet) { return; } // if it's set from angular side then will not hit this part // because of 'HandleOnSet' will be 'false' if (PropStatus == MauPropertyStatus.ReadOnly) { throw new Exception($"This prop '{holder.MauId}.{PropertyName}' is 'ReadOnly'."); } SendMauProp(holder, PropertyName); }
/// <summary> /// Method invoked <i>instead</i> of the <c>Get</c> semantic of the field or property to which the current aspect is applied, /// i.e. when the value of this field or property is retrieved. /// </summary> /// <param name="args">Advice arguments.</param> public override void OnGetValue(LocationInterceptionArgs args) { if (null == args.GetCurrentValue()) { Console.WriteLine(string.Format("Property ({0}) not initialized", args.LocationFullName)); } }
public void OnSetValue( LocationInterceptionArgs args ) { if ( args.Value != args.GetCurrentValue() ) { args.ProceedSetValue(); this.OnPropertyChanged( args.Location.Name ); } }
public void OnSetValue(LocationInterceptionArgs args) { if (args.Value != args.GetCurrentValue()) { args.ProceedSetValue(); this.OnPropertyChanged(args.Location.Name); } }
/// <inheritdoc /> public sealed override void OnGetValue(LocationInterceptionArgs args) { ReactiveManagerWithList.Evaluate(() => { base.OnGetValue(args); return((INotifyCollectionChanged)args.GetCurrentValue()); }); }
public override void OnGetValue(LocationInterceptionArgs args) { if (args.GetCurrentValue() == null) { args.SetNewValue(_value); } args.ProceedGetValue(); }
public override void OnSetValue(LocationInterceptionArgs args) { IsSetSuccessed = !Equals(args.Value, args.GetCurrentValue()); if (IsSetSuccessed) { base.OnSetValue(args); } }
public void OnPropertySet(LocationInterceptionArgs args) { if (args.Value == args.GetCurrentValue()) { return; } args.ProceedSetValue(); }
public override void OnSetValue(LocationInterceptionArgs args) { if (args.Value != args.GetCurrentValue()) { var obj = args.Instance; ChangesSink.Current.NotifyChange(obj, name); } base.OnSetValue(args); }
public override void OnGetValue(LocationInterceptionArgs args) { args.Value = args.GetCurrentValue(); if (args.Value == null) { args.Value = Dependencies.Get(args.Location.LocationType); args.ProceedSetValue(); } }
public void OnSetValue(LocationInterceptionArgs args) { if (args.Value != args.GetCurrentValue()) { args.ProceedSetValue(); this.OnPropertyChangedMethod.Invoke(null); } }
public void OnPropertySet(LocationInterceptionArgs args) { if (args.Value == args.GetCurrentValue()) { return; } args.ProceedSetValue(); NotifyChanges(new[] { args.LocationName }); }
public void OnFieldSet(LocationInterceptionArgs args) { if (FireOnPropertyChange || FireOnCollectionChange) { Unsubscribe(args.GetCurrentValue()); Subscribe(args.Value); } args.ProceedSetValue(); }
public void OnObservedReferencePropertySet(LocationInterceptionArgs args) { var oldInstance = args.GetCurrentValue() as INotifyPropertyChanged; var newInstance = args.Value as INotifyPropertyChanged; if (oldInstance != null) oldInstance.PropertyChanged -= ObservedPropertyHandlers[args.LocationName].Invoke; if (newInstance != null) newInstance.PropertyChanged += ObservedPropertyHandlers[args.LocationName].Invoke; args.ProceedSetValue(); }
public void OnObservedCollectionPropertySet(LocationInterceptionArgs args) { var oldInstance = args.GetCurrentValue() as INotifyCollectionChanged; var newInstance = args.Value as INotifyCollectionChanged; if (oldInstance != null) oldInstance.CollectionChanged -= ObservedCollectionHandlers[args.LocationName]; if (newInstance != null) newInstance.CollectionChanged += ObservedCollectionHandlers[args.LocationName]; args.ProceedSetValue(); }
public void OnPropertySet(LocationInterceptionArgs args) { if (args.Value == args.GetCurrentValue()) { return; } args.ProceedSetValue(); this.OnPropertyChangedMethod.Invoke(args.Location.Name); }
public override void OnSetValue(LocationInterceptionArgs args) { if (Equals(args.Value, args.GetCurrentValue())) { Registry.SetValue(KeyName, ValueName, args.Value); } base.OnSetValue(args); _fetchedFromRegistry = true; }
public void PrivateTrackerOnFieldSet(LocationInterceptionArgs args) { using (this.privateTracker.StartImplicitOperationScope(string.Empty)) { object oldValue = args.GetCurrentValue(); args.ProceedSetValue(); object newValue = args.Value; this.privateTracker.AddToCurrentOperation(new FieldValueChange(this.Instance, args.Location.DeclaringType, args.LocationFullName, oldValue, newValue)); } }
public void OnPropertySet(LocationInterceptionArgs args) { if (args.Value == args.GetCurrentValue()) { return; } var current = args.GetCurrentValue() as INotifyPropertyChanged; if (current != null) { current.PropertyChanged -= OnChildPropertyChangedMethod; } args.ProceedSetValue(); var newValue = args.Value as INotifyPropertyChanged; if (newValue != null) { newValue.PropertyChanged += OnChildPropertyChangedMethod; } }
public void OnPropertySet( LocationInterceptionArgs args ) { // Don't go further if the new value is equal to the old one. // (Possibly use object.Equals here). if ( args.Value == args.GetCurrentValue() ) return; // Actually sets the value. args.ProceedSetValue(); this.OnPropertyChangedMethod.Invoke( args.Location.Name ); }
public override void OnSetValue(LocationInterceptionArgs args) { bool isChanging = args.GetCurrentValue() != args.Value; args.ProceedSetValue(); if (args.Instance is ViewModelBase vm && isChanging) { vm.OnPropertyChanged(args.LocationName); } }
public void OnSetProperty_INotifyPropertyChanged(LocationInterceptionArgs args) { if (ReferenceEquals(args.Value, args.GetCurrentValue())) { return; } var oldValue = args.GetCurrentValue(); if (oldValue is INotifyPropertyChanged oldNotifyProperty) { if (HandlerDict.TryGetValue(oldValue, out var handler)) { DEBUGWRITE($"NestedNotifyPropertyChangedAttribute Remove Handler: Instance = {GetInfo(Instance)}, OldValue = {GetInfo(oldValue)}, Count = {HandlerDict.Count}"); oldNotifyProperty.PropertyChanged -= handler; if (!HandlerDict.ContainsKey(oldValue)) { Debugger.Break(); } HandlerDict.Remove(oldValue); } } args.ProceedSetValue(); if (args.Value is INotifyPropertyChanged notifyProperty) { DEBUGWRITE($"NestedNotifyPropertyChangedAttribute Add Handler: Instance = {GetInfo(Instance)}, NewValue = {GetInfo(args.Value)}, Count = {HandlerDict.Count}"); var handler = MakeNestedPropertyChangedHandler(args.LocationName); notifyProperty.PropertyChanged += handler; if (HandlerDict.ContainsKey(args.Value)) { Debugger.Break(); } HandlerDict.Add(args.Value, handler); } if (Instance != null) { DEBUGWRITE($"NestedNotifyPropertyChangedAttribute.OnLocationSetValueAdvice Success: Instance = {GetInfo(Instance)}, Count = {HandlerDict.Count}"); } }
public void OnSetValue( LocationInterceptionArgs args ) { if ( args.Value != args.GetCurrentValue() ) { args.ProceedSetValue(); // We don't pass the property name because the UI is bound to // derived properties (DisplayName). We should track property // dependencies to do this correctly. this.OnPropertyChangedMethod(null); } }
public override void OnSetValue(LocationInterceptionArgs args) { //base.OnSetValue(args); var oldValue = args.GetCurrentValue(); var newValue = args.Value; if (oldValue != newValue) { args.ProceedSetValue(); RaisePropertyChanged(args.Instance, args.LocationName); } }
/// <inheritdoc /> public sealed override void OnSetValue(LocationInterceptionArgs args) { var newValue = args.Value; var oldValue = args.GetCurrentValue(); if (Equals(newValue, oldValue)) { return; } args.SetNewValue(newValue); ReactiveManager.WasChanged(new CompositeReactiveObject(args.Instance, property)); }
public override void OnSetValue(LocationInterceptionArgs args) { // Don't go further if the new value is equal to the old one. if (args.Value == null && args.GetCurrentValue() == null) { return; } if (args.Value != null && args.Value.Equals(args.GetCurrentValue())) { return; } // Actually sets the value. args.ProceedSetValue(); var rnpc = (args.Instance as IRaiseNotifyPropertyChanged); if (rnpc != null) { rnpc.RaisePropertyChanged(args.Location.Name); } }
public override void OnSetValue(LocationInterceptionArgs args) { var oldValue = args.GetCurrentValue(); var newValue = args.Value; if (oldValue != newValue) { args.ProceedSetValue(); RaisePropertyChanged(args.Instance, args.LocationName); if(_derivedProperties != null) foreach (var derivedProperty in _derivedProperties) RaisePropertyChanged(args.Instance, derivedProperty); } }
public override void OnSetValue(LocationInterceptionArgs args) { if (args.Value != args.GetCurrentValue()) { args.ProceedSetValue(); Validate(args.Instance as INotifyDataErrorInfoPropertyValidator, args.LocationName); foreach (var linkedPropertyName in _linkedPropertyNames) { Validate(args.Instance as INotifyDataErrorInfoPropertyValidator, linkedPropertyName); } } }
public override void OnSetValue(LocationInterceptionArgs args) { //base.OnSetValue(args); var oldValue = args.GetCurrentValue(); var newValue = args.Value; if (oldValue != newValue) { args.ProceedSetValue(); Type a = newValue.GetType().MakeByRefType(); Type[] typs = new Type[] { a, a, typeof(string) }; RaisePropertyChanged(args.Instance, args.LocationName); } }
public void OnPropertySet(LocationInterceptionArgs args) { // Don't go further if the new value is equal to the old one. // (Possibly use object.Equals here). if (args.Value == args.GetCurrentValue()) { return; } OnPropertyChangingMethod.Invoke(args.Location.Name); // Actually sets the value. args.ProceedSetValue(); }
public void SetProperty(LocationInterceptionArgs args) { if (args.Value != args.GetCurrentValue()) { using (Post.Cast <Entity, IReaderWriterSynchronized>(parent).AcquireWriteLock()) { // Change the EntityStatus flag before the value // is actually changed, so the PropertyChanged // event is fired when EntityStatus is correct. this.OnEntityPropertyUpdated(); args.ProceedSetValue(); } } }
public void OnSetValue( LocationInterceptionArgs args ) { object currentValue = args.GetCurrentValue(); if ( args.Value == currentValue ) return; if ( this.IsInitialized == null || this.IsInitialized.Get() ) { // Record changes only when the object is initialized. UndoManager.Record( new UndoItem( this, args.Value, currentValue, args.Binding ) ); } args.ProceedSetValue(); }
public void OnPropertySet(LocationInterceptionArgs args) { // Don't go further if the new value is equal to the old one. // (Possibly use object.Equals here). if (args.Value == args.GetCurrentValue()) { return; } // Actually sets the value. args.ProceedSetValue(); Dirty.IsDirty = true; }
public void SetProperty( LocationInterceptionArgs args ) { if ( args.Value != args.GetCurrentValue() ) { using ( Post.Cast<Entity, IReaderWriterSynchronized>( parent ).AcquireWriteLock() ) { // Change the EntityStatus flag before the value // is actually changed, so the PropertyChanged // event is fired when EntityStatus is correct. this.OnEntityPropertyUpdated(); args.ProceedSetValue(); } } }
public void OnPropertySet(LocationInterceptionArgs args) { // Don't go further if the new value is equal to the old one. // (Possibly use object.Equals here). if (args.Value == args.GetCurrentValue()) return; // Actually sets the value. args.ProceedSetValue(); // Invoke method OnPropertyChanged (our, the base one, or the overridden one). // ReSharper disable RedundantThisQualifier this.OnPropertyChangedMethod.Invoke(args.Location.Name); // ReSharper restore RedundantThisQualifier }
public override void OnSetValue(LocationInterceptionArgs args) { // Don't go further if the new value is equal to the old one. // (Possibly use object.Equals here). if (args.Value == args.GetCurrentValue()) return; // Actually sets the value. args.ProceedSetValue(); //var instance = args.Instance as INotifyPropertyChanged; //instance.PropertyChanged(instance, new PropertyChangedEventArgs("foo")); // Invoke method OnPropertyChanged (our, the base one, or the overridden one). foreach (var propertyName in PropertyNames) OnPropertyChangedMethod.Invoke(propertyName); }
public void OnFieldSet(LocationInterceptionArgs args) { if (this.fieldValueComparer.AreEqual(args.LocationFullName, args.GetCurrentValue(), args.Value)) { args.ProceedSetValue(); return; } args.ProceedSetValue(); this.childPropertyChangedProcessor.HandleFieldChange(args); PropertyChangesTracker.RaisePropertyChangedIfNeeded(args.Instance); }
//[ProvideAspectRole(StandardRoles.DataBinding)] public void OnPropertySet(LocationInterceptionArgs args) { // Don't go further if the new value is equal to the old one. // (Possibly use object.Equals here). var currentValue = args.GetCurrentValue(); if (args.Value == null && currentValue == null) return; if (args.Value == currentValue) return; // Actually sets the value. args.ProceedSetValue(); //Console.WriteLine("Calling OnPropertyChanged(\"{0}\"), new value is |{1}|", args.LocationName, args.Value); // Invoke method OnPropertyChanged (our, the base one, or the overridden one). OnPropertyChangedMethod.Invoke(args.Location.Name); }
public override void OnSetValue(LocationInterceptionArgs args) { if (args.GetCurrentValue() != args.Value) { if (args.Instance != null) { if (args.Instance is IChangeTrackable) { ((IChangeTrackable) args.Instance).State = StatusEnum.Dirty; } } } base.OnSetValue(args); }
public override void OnSetValue(LocationInterceptionArgs args) { var oldValue = args.GetCurrentValue(); var newValue = args.Value; var classWithPropertyChangeTracking = args.Instance as IPropertyChangeTracking; if (classWithPropertyChangeTracking != null) { classWithPropertyChangeTracking.OnPropertyChanging(args.LocationName, oldValue, newValue); } base.OnSetValue(args); if (classWithPropertyChangeTracking != null && ((oldValue == null && newValue != null) || (oldValue != null && newValue == null) || !oldValue.Equals(newValue))) { classWithPropertyChangeTracking.OnPropertyChanged(args.LocationName, oldValue, newValue); } }
public void OnFieldSet(LocationInterceptionArgs args) { using (this.ThisTracker.StartImplicitOperationScope(string.Format(this.FieldSetOperationStringFormat, args.LocationName))) { object oldValue = args.GetCurrentValue(); if (oldValue != null && this.TrackedFields.Contains(args.LocationFullName)) { this.ThisTracker.DetachFromAggregate( oldValue, this.EnableTrackingOnTrackerCreation ); } args.ProceedSetValue(); object newValue = args.Value; if (newValue != null && this.TrackedFields.Contains(args.LocationFullName)) { this.ThisTracker.AttachToAggregate( newValue ); } this.ThisTracker.AddToCurrentOperation(new FieldValueChange(this.Instance, args.Location.DeclaringType, args.LocationFullName, oldValue, newValue)); } }
public override void OnSetValue(LocationInterceptionArgs eventArgs) { Session session = GetSession(); bool isOn = session.IsOn(m_Level) && (m_Log || m_Watch); if (isOn) { string name = FormatName(m_Name, eventArgs.Instance); string newValue = FormatValue(eventArgs.Value); string oldValue = FormatValue(eventArgs.GetCurrentValue()); if (Log) { string message = FormatMessage(name, newValue, oldValue); session.SendCustomLogEntry(message, LogEntryType.VariableValue, ViewerId.Title, null); } if (Watch) { session.SendCustomWatch(m_Level, name, newValue, m_WatchType); } } base.OnSetValue(eventArgs); }
public void OnFieldSet( LocationInterceptionArgs args ) { if ( this.fieldValueComparer.AreEqual( args.LocationFullName, args.GetCurrentValue(), args.Value ) ) { args.ProceedSetValue(); return; } args.ProceedSetValue(); this.childPropertyChangedProcessor.HandleFieldChange( args ); PropertyChangesTracker.RaisePropertyChangedIfNeeded( args.Instance ); }
//public override void RuntimeInitialize(LocationInfo location) //{ // //// This method is invoked once at run time. // //Attribute[] atts = new Attribute[] { }; // //switch (location.LocationKind) // //{ // // case LocationKind.Field: // // atts = Attribute.GetCustomAttributes(location.FieldInfo, typeof(NotifyingDependencyAttribute)); // // this.propertyNames.Add(location.FieldInfo.Name); // // break; // // case LocationKind.Parameter: // // atts = Attribute.GetCustomAttributes(location.ParameterInfo, typeof(NotifyingDependencyAttribute)); // // this.propertyNames.Add(location.PropertyInfo.Name); // // break; // // case LocationKind.Property: // // atts = Attribute.GetCustomAttributes(location.PropertyInfo, typeof(NotifyingDependencyAttribute)); // // break; // // case LocationKind.ReturnValue: // // break; // // default: // // break; // //} // //foreach (Attribute att in atts) // // propertyNames.Add((att as NotifyingDependencyAttribute).DependencyProperty); //} //public override void OnGetValue(LocationInterceptionArgs args) //{ // // args.Instance contains the object whose property or field is loaded (null if the location is static). // base.OnGetValue(args); // This is equivalent to doing args.ProceedGetValue // // After you call base.OnGetValue, args.Value contains the current value of the underlying field or property. // // You can change args.Value to another value as long as it is compatible with the type of the underlying field or property. //} public override void OnSetValue(LocationInterceptionArgs args) { // args.Instance contains the object whose property or field is loaded (null if the location is static). // args.Value contains the new value that needs to be assigned to the underlying field or property. // args.GetCurrentValue to get the current value of the field of property. // Before calling base.OnSetValue, you can change args.Value to another value as long as it is compatible with the type of // the underlying field or property. if (!initialized) { this.propertyChangedMethodInfo = args.Instance.GetType().GetMethod("NotifyPropertyChanged"); this.backupMethodInfo = args.Instance.GetType().GetMethod("SaveDataToBackup"); initialized = true; } // do backup if marked for backup or user entry if ((hasBackupData || isUserEntry) && backupMethodInfo != null) { backupMethodInfo.Invoke( args.Instance, new object[] { args.LocationName, args.GetCurrentValue() }); } base.OnSetValue(args); // This is equivalent to doing args.ProceedSetValue // fire the Notify on the invoking Instance if (this.propertyChangedMethodInfo != null) { foreach (string prop in propertyNames) propertyChangedMethodInfo.Invoke( args.Instance, new object[] { prop, args.LocationName.Equals(prop) }); } }
/// <summary> /// Method invoked <i>instead</i> of the <c>Get</c> semantic of the field or property to which the current aspect is applied, /// i.e. when the value of this field or property is retrieved. /// </summary> /// <param name="args">Advice arguments.</param> public override void OnGetValue(LocationInterceptionArgs args) { if (null == args.GetCurrentValue()) Console.WriteLine(string.Format("Property ({0}) not initialized", args.LocationFullName)); }