// This is made internal so that the PropertyGrid can raise this continually so that // window visiblity is purely reactive internal void IncludeAndExcludeAccordingToValue(PropertyGrid propertyGrid) { for (int i = 0; i < mMemberVisibleConditions.Count; i++) { MemberVisibleCondition mvc = mMemberVisibleConditions[i]; // Update the SelectedObject mvc.MemberCondition.SelectedObjectAsObject = propertyGrid.GetSelectedObject(); bool result = mvc.MemberCondition.Result; #region If the member condition is true if (result) { if ((mvc.VisibilitySettings & VisibilitySetting.ExcludeOnTrue) == VisibilitySetting.ExcludeOnTrue) { propertyGrid.ExcludeMember(mvc.MemberToAffect); } if ((mvc.VisibilitySettings & VisibilitySetting.IncludeOnTrue) == VisibilitySetting.IncludeOnTrue) { if (string.IsNullOrEmpty(this.Category)) { propertyGrid.IncludeMember(mvc.MemberToAffect); } else { propertyGrid.IncludeMember(mvc.MemberToAffect, Category); } } } #endregion #region Else if the member condition is false else // result == false { if ((mvc.VisibilitySettings & VisibilitySetting.ExcludeOnFalse) == VisibilitySetting.ExcludeOnFalse) { propertyGrid.ExcludeMember(mvc.MemberToAffect); } if ((mvc.VisibilitySettings & VisibilitySetting.IncludeOnFalse) == VisibilitySetting.IncludeOnFalse) { if (string.IsNullOrEmpty(this.Category)) { propertyGrid.IncludeMember(mvc.MemberToAffect); } else { propertyGrid.IncludeMember(mvc.MemberToAffect, Category); } } } #endregion } }