public void UnRegisterChangedAction(string origin, params Action[] target_action) { if (PropertyRelations.TryGetValue(origin, out var rel)) { rel.RelatedChangedActions.RemoveWhere(x => target_action.Contains(x)); } }
public void UnRegisterRelationProperty(string origin, NotifyBase target_owner, params string[] target_prop) { if (PropertyRelations.TryGetValue(origin, out var rel)) { rel.RelatedProps.RemoveWhere(x => x.Owner == target_owner && target_prop.Contains(x.PropertyName)); } }
public void RegisterChangedAction(string origin, params Action[] target_action) { if (!PropertyRelations.TryGetValue(origin, out var rel)) { PropertyRelations[origin] = rel = new PropertyRelation(); } foreach (var action in target_action) { if (!rel.RelatedChangedActions.Contains(action)) { rel.RelatedChangedActions.Add(action); } } }
public void RegisterRelationProperty(string origin, NotifyBase target_owner, params string[] target_prop) { if (!PropertyRelations.TryGetValue(origin, out var rel)) { PropertyRelations[origin] = rel = new PropertyRelation(); } foreach (var prop in target_prop) { var desc = new NotifyDescriptor(target_owner, prop); if (!rel.RelatedProps.Contains(desc)) { rel.RelatedProps.Add(desc); } } }
private void NotifyBase_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (PropertyRelations.TryGetValue(e.PropertyName, out var rel)) { //notify all relations //execute all changed actions foreach (var item in rel.RelatedProps) { item.RaiseChanged(); } foreach (var item in rel.RelatedChangedActions) { item?.Invoke(); } } }