/// <summary> /// Overloaded Implementation of Dispose. /// </summary> /// <param name="isDisposing"></param> /// <remarks> /// <para><list type="bulleted">Dispose(bool isDisposing) executes in two distinct scenarios. /// <item>If <paramref name="isDisposing"/> equals true, the method has been called directly /// or indirectly by a user's code. Managed and unmanaged resources /// can be disposed.</item> /// <item>If <paramref name="isDisposing"/> equals false, the method has been called by the /// runtime from inside the finalizer and you should not reference /// other objects. Only unmanaged resources can be disposed.</item></list></para> /// </remarks> protected virtual void Dispose(bool isDisposing) { if (isDisposing) { _parentModel = null; _parentDetailsVM = null; _propertyInfo = null; _fieldViewModelType = null; _fieldViewModel = null; if (_displayInfo != null) { _displayInfo.Value = null; _displayInfo = null; } _allProperties.Clear(); _allMasterProperties.Clear(); _parentProperty = null; _childProperty = null; _parentPropertyOwner = null; } IsDisposed = true; }
private void GrabDisplayInfo() { if (_fieldViewModelType == typeof (SingleCrossRefFieldViewModel)) { if (_displayInfo == null) _displayInfo = new SingleCrossRefFieldDisplayInfo(); if (FieldViewModel != null) _displayInfo.Value = ((SingleCrossRefFieldViewModel)FieldViewModel).DisplayText; else GetCRDisplayFieldValue(_propertyInfo, _allProperties[_propertyInfo]); } if (_fieldViewModelType == typeof(TextFieldViewModel)) { if (_displayInfo == null) _displayInfo = new TextFieldDisplayInfo(); if (FieldViewModel != null) _displayInfo.Value = ((TextFieldViewModel) FieldViewModel).Value; else { var propertyValue = _propertyInfo.GetValue(_allProperties[_propertyInfo], null); _displayInfo.Value = propertyValue != null ? propertyValue.ToString() : string.Empty; } } if (_fieldViewModelType == typeof (RichTextFieldViewModel)) { if (_displayInfo == null) _displayInfo = new RichTextFieldDisplayInfo(); _displayInfo.Value = Constants.RichText; } }