/// <summary> /// Indicates the object is being disposed. /// </summary> /// <param name="disposing">Indicates <see cref="ViewModel.Dispose(bool)"/> was invoked through an explicit call to <see cref="ViewModel.Dispose()"/> instead of a finalizer call.</param> protected override void Dispose(bool disposing) { if (elementScope != null) { elementScope.CollectionChanged -= ElementScopeCollectionChanged; elementScope.Dispose(); elementScope = null; } if (reference != null) { reference.ElementFound -= ReferenceElementFound; reference.ElementDeleted -= ReferenceElementDeleted; reference.NameChanged -= ReferenceNameChanged; reference.Dispose(); reference = null; } if (changeScopePropertyWatcher != null) { changeScopePropertyWatcher.Dispose(); } ((INotifyCollectionChanged)ValidationResults).CollectionChanged -= ValidationCollectionChanged; base.Dispose(disposing); }
private void EnsureScopeInitialized() { if (scopeInitialized) { return; } elementScope = new DeferredElementScope(referenceAttribute, base.DeclaringElement, lookup); elementScope.CollectionChanged += ElementScopeCollectionChanged; changeScopePropertyWatcher.Refresh(elementScope); scopeInitialized = true; }
private void EnsureScopeInitialized() { if (scopeInitialized) return; elementScope = new DeferredElementScope(referenceAttribute, base.DeclaringElement, lookup); elementScope.CollectionChanged += ElementScopeCollectionChanged; changeScopePropertyWatcher.Refresh(elementScope); scopeInitialized = true; }