protected void ClearAllEvents() { if (PropertyChanged != null) { foreach (var eventhandler in PropertyChanged.GetInvocationList()) { PropertyChanged -= (PropertyChangedEventHandler)eventhandler; } PropertyChanged = null; } if (NotifyDirty != null) { foreach (var eventhandler in NotifyDirty.GetInvocationList()) { NotifyDirty -= (System.EventHandler)eventhandler; } NotifyDirty = null; } if (ObjectChanged != null) { foreach (var eventhandler in ObjectChanged.GetInvocationList()) { ObjectChanged -= (ObjectChangedEventHandler)eventhandler; } ObjectChanged = null; } }
public event EventHandler <EventArgs> ObjectChanged; //Об'єкт змінився - подія public void RaiseChanged() //Об'єкт змінився - пробудити подію { if (ObjectChanged != null) { ObjectChanged.Invoke(this, new EventArgs()); } }
private void OnObjectChanged(Object obj) { ObjectChanged?.Invoke(obj); //========================= Thickness RealCM_Margin = MarginCM(); MarginCM_Change.Invoke(RealCM_Margin); }
private void btn_Save_Click(object sender, EventArgs e) { if (objectIsNew) { DataSource.Add(editObject); } StopEditMode(); ObjectChanged?.Invoke(this, editObject); }
internal void DoObjectChanged(TabularObject obj, string propertyName, object oldValue, object newValue) { if (_disableUpdates) { return; } var e = new ObjectChangedEventArgs(obj, propertyName, oldValue, newValue); ObjectChanged?.Invoke(this, e); }
public void SetValue(object value) { Property.SetValue(Instance.ProxiedObject, value); ObjectChanged?.Invoke(new ObjectChangedEventArgs { Object = Instance.ProxiedObject, PropertyName = Property.Name }); Instance.RaisePropertyChanged(string.Empty); }
public void Save <T>(T reference, Predicate <T> predicate) where T : Sprite, new() { if (reference == null) { return; } var obj = Query(predicate); obj = reference; ObjectChanged?.Invoke(obj); }
public void SetObject(T value) { if (!ReferenceEquals(_obj, value)) { object old = _obj; if (_obj != null) { _obj.PropertyChanged -= _obj_PropertyChanged; } _obj = value; if (_obj != null) { _obj.PropertyChanged += _obj_PropertyChanged; } ObjectChanged?.Invoke(this, new ObjectChangedEventArgs(old)); ObjectPropertyChanged?.Invoke(this, new PropertyChangedEventArgs(null)); } }
/// <summary>Selects the objects changed.</summary> /// <typeparam name="T"></typeparam> /// <param name="entries">The entries.</param> /// <param name="properties">The properties.</param> /// <returns></returns> public static IReadOnlyCollection <ObjectChanged <T> > SelectObjectsChanged <T>(this ChangeTracker entries, ICollection <string> properties) where T : class { var itens = new List <ObjectChanged <T> >(); if (entries?.HasChanges() != true) { return(itens); } foreach (var entry in entries.Entries <T>().Where(e => !IgnoreStates.Contains(e.State))) { var propertiesChanged = entry.SelectPropertiesChanged(properties); if (!propertiesChanged.Any()) { continue; } var oc = new ObjectChanged <T>(((int)entry.State), entry.State.ToString(), entry.Entity, propertiesChanged); itens.Add(oc); } return(itens); }
/// <summary> /// Raises an ObjectChanged event. /// </summary> private void OnObjectChanged(object changeArgument) { ObjectChanged?.Invoke(this, new ObjectChangedEventArgs(commandConfig, changeArgument)); }
/// <summary> /// Вызвать событие ObjectChanged /// </summary> private void OnObjectChanged(object changeArgument) { ObjectChanged?.Invoke(this, new ObjectChangedEventArgs(modbusCmd, changeArgument)); }
internal void DoObjectChanged(TabularObject obj, string propertyName, object oldValue, object newValue) { var e = new ObjectChangedEventArgs(obj, propertyName, oldValue, newValue); ObjectChanged?.Invoke(this, e); }
private void _NotifyObservers() { ObjectChanged.Invoke(this, null); }
/// <summary> /// Raises an ObjectChanged event. /// </summary> private void OnObjectChanged(object changeArgument) { ObjectChanged?.Invoke(this, new ObjectChangedEventArgs(subscriptionConfig, changeArgument)); }
protected virtual void NotifyPrimitiveChanged(SyncPrimitive primitive) { ObjectChanged.RaiseEvent(this); }
public void OnNext(ObjectChanged<Person> value) { Console.WriteLine(value); }
/// <summary> /// Вызвать событие ObjectChanged /// </summary> private void OnObjectChanged(object changeArgument) { ObjectChanged?.Invoke(this, new ObjectChangedEventArgs(elemInfo, changeArgument)); }
private void OnObjectChanged(ObjectChangedEventArgs args) { ObjectChanged?.Invoke(this, args); }
public void RaiseObjectChanged(CustomEventArgs <object> args) { ObjectChanged?.Invoke(this, args); }
public void OnObjectChanged(object target, EventArgs e) { ObjectChanged.Raise(target, e); }
/// <summary> /// Raises the <see cref="ObjectChanged"/> event for the specified <paramref name="propertyName"/>. /// </summary> /// <param name="propertyName">Name of the changed property</param> protected virtual void RaiseObjectChanged(string propertyName) { ObjectChanged?.Invoke(this, propertyName); }