コード例 #1
0
        //private bool IsContainedInHookChain(ChangeTrackingObject trackingObject)
        //{
        //    if (HookedObjects.Count == 0)
        //        return false;
        //    if (HookedObjects.Any(x => x.Value == trackingObject))
        //        return true;

        //    foreach (var childObj in HookedObjects)
        //    {
        //        if (childObj.Value.IsContainedInHookChain(trackingObject))
        //            return true;
        //    }
        //    return false;
        //}

        private void AttachChildEvents(ChangeTrackingObject trackingObject, string propertyName = null)
        {
            var childHook = new ChildEventHook(propertyName, trackingObject);

            if (!HookedObjects.Contains(childHook))
            {
                HookedObjects.Add(childHook);
                childHook.Attach(OnChildEventRaised);
            }
        }
コード例 #2
0
 private void DettachChildEvents(ChangeTrackingObject trackingObject)
 {
     trackingObject.PropertyValueChanging -= ChildObject_PropertyValueChanging;
     trackingObject.PropertyValueChanged  -= ChildObject_PropertyValueChanged;
     trackingObject.ChildEventForwarded   -= ChildObject_ChildEventForwarded;
 }
コード例 #3
0
 public ChildEventHook(string propertyName, ChangeTrackingObject value)
 {
     PropertyName = propertyName;
     Value        = value;
 }
コード例 #4
0
 public ChangeTrackingCollection(ChangeTrackingObject trackingObject)
 {
     trackingObject.AttachCollection(this);
 }