Esempio n. 1
0
        private void EnsureHasProperties()
        {
            if (properties == null)
            {
                properties = new ObservableCollection <Property>(GetAllProperties());
                //second set: to make sure the properties arent created twice when filter.
                properties = new ObservableCollection <Property>(properties.OrderBy(x => x.Category).ThenBy(x => x.DisplayName));

                extendedProperties = new ExtendedPropertyContainer(elementLookup, this, properties);
                PropagateNamePropertyChanges();
            }
        }
Esempio n. 2
0
        /// <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 (disposing)
            {
                if (parentElementModel != null)
                {
                    this.parentElementModel.PropertyChanged -= ParentPropertyChangedHandler;
                }

                if (properties != null)
                {
                    foreach (IDisposable prop in properties)
                    {
                        prop.Dispose();
                    }

                    properties.Clear();
                }

                if (extendedProperties != null)
                {
                    extendedProperties.Dispose();
                    extendedProperties = null;
                }

                if (childElements != null)
                {
                    foreach (var child in childElements)
                    {
                        child.Dispose();
                    }
                }
            }

            base.Dispose(disposing);
        }