Example #1
0
 public void GetAccessType(ITypeCategory category, TaskContext context)
 {
     category.Dispatcher.Invoke(() =>
     {
         category.GetAccessType(context.Authentication);
     });
 }
        public async Task AddNewCategoryAsync(ITypeCategory category, TaskContext context)
        {
            var authentication = context.Authentication;
            var categoryNanme  = RandomUtility.NextIdentifier();

            if (context.AllowException == false)
            {
                if (category.GetAccessType(authentication) < AccessType.Master)
                {
                    return;
                }
            }
            await category.AddNewCategoryAsync(authentication, categoryNanme);
        }
        public async Task NewTypeAsync(ITypeCategory category, TaskContext context)
        {
            var authentication = context.Authentication;

            if (context.AllowException == false)
            {
                if (await category.Dispatcher.InvokeAsync(() => category.GetAccessType(authentication)) < AccessType.Master)
                {
                    return;
                }
            }
            var template = await category.AddNewTypeAsync(authentication);

            context.Push(template);
        }
Example #4
0
        public TypeCategoryDescriptor(Authentication authentication, ITypeCategory 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.accessInfo   = category.AccessInfo;
            this.lockInfo     = category.LockInfo;
            this.accessType   = category.GetAccessType(authentication);

            this.typesReadonly      = new ReadOnlyObservableCollection <TypeDescriptor>(this.types);
            this.categoriesReadonly = new ReadOnlyObservableCollection <TypeCategoryDescriptor>(this.categories);
            this.category.ExtendedProperties[this.owner] = this;

            if (this.descriptorTypes.HasFlag(DescriptorTypes.IsSubscriptable) == true)
            {
                this.category.Renamed       += Category_Renamed;
                this.category.Moved         += Category_Moved;
                this.category.Deleted       += Category_Deleted;
                this.category.AccessChanged += Category_AccessChanged;
                this.category.LockChanged   += Category_LockChanged;
            }

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

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

                foreach (var item in this.category.Types)
                {
                    var descriptor = new TypeDescriptor(this.authentication, item, this.descriptorTypes, this.owner);
                    this.types.Add(descriptor);
                }
            }
        }
Example #5
0
 public void GetAccessType()
 {
     category.GetAccessType(authentication);
 }