public SpreadsheetCellDataFieldViewModel(Type viewModelType, PropertyInfo propertyInfo, IEditableProxy model, DetailsViewModel parentViewModel, IColumnItem column) { _propertyInfo = propertyInfo; _parentModel = model; if (_parentModel != null) { var parentModelBO = _parentModel as BusinessBase; if (parentModelBO != null) { var weakListener = new WeakEventListener<SpreadsheetCellDataFieldViewModel, BusinessBase, PropertyChangedEventArgs>(this, parentModelBO); parentModelBO.PropertyChanged += weakListener.OnEvent; weakListener.OnEventAction += OnParentModelPropertyChanged; weakListener.OnDetachAction += Static; } _allProperties = _parentModel.GetAllPropertiesForInstance(); var root = _parentModel.GetModel(); if (root != null) _allMasterProperties = root.GetAllPropertiesForInstance(); } _parentDetailsVM = parentViewModel; _fieldViewModelType = viewModelType; _column = column; }
/// <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; }