public DomainCategoryDescriptor(Authentication authentication, IDomainCategory category, DescriptorTypes descriptorTypes, object owner)
            : base(authentication, category, descriptorTypes)
        {
            this.category = category;
            this.owner    = owner ?? this;
            this.category.Dispatcher.VerifyAccess();
            this.categoryName = category.Name;
            this.categoryPath = category.Path;

            this.domainsReadonly    = new ReadOnlyObservableCollection <DomainDescriptor>(this.domains);
            this.categoriesReadonly = new ReadOnlyObservableCollection <DomainCategoryDescriptor>(this.categories);

            if (this.descriptorTypes.HasFlag(DescriptorTypes.IsSubscriptable) == true)
            {
                this.category.Renamed += Category_Renamed;
            }

            if (this.descriptorTypes.HasFlag(DescriptorTypes.IsRecursive) == true)
            {
                if (this.descriptorTypes.HasFlag(DescriptorTypes.IsSubscriptable) == true)
                {
                    this.category.Domains.CollectionChanged    += Domains_CollectionChanged;
                    this.category.Categories.CollectionChanged += Categories_CollectionChanged;
                }

                foreach (var item in this.category.Categories)
                {
                    var descriptor = new DomainCategoryDescriptor(this.authentication, item, this.descriptorTypes, this.owner);
                    item.ExtendedProperties[this.owner] = descriptor;
                    this.categories.Add(descriptor);
                }

                foreach (var item in this.category.Domains)
                {
                    var descriptor = new DomainDescriptor(this.authentication, item, this.descriptorTypes, this.owner);
                    item.ExtendedProperties[this.owner] = descriptor;
                    this.domains.Add(descriptor);
                }
            }

            if (this.category.GetService(typeof(IDataBase)) is IDataBase dataBase)
            {
                this.isActivated = dataBase.IsLoaded;
                if (this.descriptorTypes.HasFlag(DescriptorTypes.IsSubscriptable) == true)
                {
                    dataBase.Loaded   += DataBase_Loaded;
                    dataBase.Unloaded += DataBase_Unloaded;
                }
            }
        }
 public DomainCategoryTreeViewItemViewModel(Authentication authentication, IDomainCategory category, object owner)
     : base(authentication, category, owner)
 {
     this.IsExpanded = true;
 }
 public DomainCategoryTreeItemBase(Authentication authentication, IDomainCategory category, object owner)
     : this(authentication, new DomainCategoryDescriptor(authentication, category, DescriptorTypes.All, owner), owner)
 {
 }