Example #1
0
 public void RegisterItemActionChanged(string origin, params Action[] OnChanged)
 {
     if (!ItemPropertyRelations.TryGetValue(origin, out var rel))
     {
         ItemPropertyRelations[origin] = rel = new PropertyRelation();
     }
     foreach (var act in OnChanged)
     {
         if (rel.RelatedChangedActions.Contains(act))
         {
             continue;
         }
         rel.RelatedChangedActions.Add(act);
     }
 }
Example #2
0
 private void Item_PropertyChanging(object sender, PropertyChangingEventArgs e)
 {
     RaiseItemPropertyChanging((T)sender, e);
     if (ItemPropertyRelations.TryGetValue(e.PropertyName, out var rel))
     {
         foreach (var item in rel.RelatedProps)
         {
             item.RaiseChanging();
         }
         foreach (var item in rel.RelatedChangingActions)
         {
             item();
         }
     }
 }
Example #3
0
 public void RegisterItemRelationProperty(string origin, NotifyBase target_owner, params string[] target_prop)
 {
     if (!ItemPropertyRelations.TryGetValue(origin, out var rel))
     {
         ItemPropertyRelations[origin] = rel = new PropertyRelation();
     }
     foreach (var prop in target_prop)
     {
         var temp = new NotifyDescriptor(target_owner, prop);
         if (rel.RelatedProps.Contains(temp))
         {
             continue;
         }
         rel.RelatedProps.Add(temp);
     }
 }