コード例 #1
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (Authenticator.Current == null)
            {
                return(value);
            }

            if (parameter == null)
            {
                parameter = this.PropertyName;
            }

            if (value != null && parameter is string propertyName)
            {
                if (value is ITableDescriptor descriptor)
                {
                    if (propertyName == IsBeingEdited)
                    {
                        return(TableDescriptorUtility.IsBeingEdited(Authenticator.Current, descriptor));
                    }
                    else if (propertyName == IsContentEditor)
                    {
                        throw new NotImplementedException();
                        //return TableDescriptorUtility.IsContentEditor(Authenticator.Current, descriptor);
                    }
                    else if (propertyName == IsBeingSetup)
                    {
                        return(TableDescriptorUtility.IsBeingSetup(Authenticator.Current, descriptor));
                    }
                    else if (propertyName == IsTemplateEditor)
                    {
                        throw new NotImplementedException();
                        //return TableDescriptorUtility.IsTemplateEditor(Authenticator.Current, descriptor);
                    }
                    else if (propertyName == IsInherited)
                    {
                        return(TableDescriptorUtility.IsInherited(Authenticator.Current, descriptor));
                    }
                    else if (propertyName == IsBaseTemplate)
                    {
                        return(TableDescriptorUtility.IsBaseTemplate(Authenticator.Current, descriptor));
                    }
                }
                else
                {
                    var prop = value.GetType().GetProperty(propertyName);
                    if (prop != null)
                    {
                        return(prop.GetValue(value));
                    }
                }
            }
            return(value);
        }
コード例 #2
0
 protected override bool OnCanExecute(object parameter)
 {
     if (parameter is ITableDescriptor descriptor)
     {
         if (TableDescriptorUtility.IsBeingSetup(this.authenticator, descriptor) == false)
         {
             return(false);
         }
         return(descriptor.IsTemplateEditor == true || this.authenticator.Authority == Authority.Admin);
     }
     return(false);
 }
コード例 #3
0
        protected override bool OnCanExecute(object parameter)
        {
            if (parameter is ITableDescriptor descriptor)
            {
                if (TableDescriptorUtility.IsBeingSetup(this.authenticator, descriptor) == false)
                {
                    return(false);
                }
                return(descriptor.TableState.HasFlag(TableState.IsOwner) || this.authenticator.Authority == Authority.Admin);
            }

            return(false);
        }