示例#1
0
        public void Delete(IUserCategory category, TaskContext context)
        {
            category.Dispatcher.Invoke(() =>
            {
                if (category.Parent == null)
                {
                    return;
                }
                if (Verify() == false)
                {
                    return;
                }
                category.Delete(context.Authentication);
                context.Complete(category);
            });

            bool Verify()
            {
                if (context.AllowException == true)
                {
                    return(true);
                }
                if (category.Parent == null)
                {
                    return(false);
                }
                if (EnumerableUtility.Descendants <IUserItem, IUser>(category as IUserItem, item => item.Childs).Any() == true)
                {
                    return(false);
                }
                return(true);
            }
        }
示例#2
0
 public void Delete()
 {
     category.Delete(authentication);
 }