/// <summary> /// Record the parent <see cref="IClassPropertyPair"/> and read an initial value. /// </summary> /// <param name="parent"></param> private void SetParent(IClassPropertyPair parent) { // need to consider fact that we need to 'bin off' any of our current monitors Parent = parent; // setup a value change listener for when its value changes Parent.ValueChanged += Parent_ValueChanged; // if there current is a value for the parent... if (parent.Value != null) { SetupMonitorAndReadCurrent(); } else { SetValue(null); } }
/// <summary> /// Create an instance for a specified member, parent. /// </summary> /// <param name="memberDetails"></param> /// <param name="parent"></param> /// <param name="changeSelector"></param> public ClassPropertyPair(MemberDetails memberDetails, IClassPropertyPair parent, IPropertyChangeNotifierSelector changeSelector) { if (parent == null) { throw new ArgumentNullException(nameof(parent)); } if (changeSelector == null) { throw new ArgumentNullException(nameof(changeSelector)); } _memberDetails = memberDetails; _changeSelector = changeSelector; SetParent(parent); }