Пример #1
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (parameter == null)
            {
                parameter = this.PropertyName;
            }

            if (value != null && parameter is string propertyName)
            {
                if (value is ILockableDescriptor descriptor)
                {
                    if (propertyName == IsLocked)
                    {
                        return(LockableDescriptorUtility.IsLocked(Authenticator.Current, descriptor));
                    }
                    else if (propertyName == IsLockInherited)
                    {
                        return(LockableDescriptorUtility.IsLockInherited(Authenticator.Current, descriptor));
                    }
                    else if (propertyName == IsLockOwner && Authenticator.Current != null)
                    {
                        return(LockableDescriptorUtility.IsLockOwner(Authenticator.Current, descriptor));
                    }
                }
                else
                {
                    var prop = value.GetType().GetProperty(propertyName);
                    if (prop != null)
                    {
                        return(prop.GetValue(value));
                    }
                }
            }
            return(value);
        }
Пример #2
0
 protected async override void OnExecute(object parameter)
 {
     if (parameter is ILockableDescriptor descriptor)
     {
         await LockableDescriptorUtility.LockAsync(this.authenticator, descriptor);
     }
 }
Пример #3
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value is ILockableDescriptor descriptor)
     {
         return(LockableDescriptorUtility.IsLockOwner(Authenticator.Current, descriptor));
     }
     return(false);
 }
Пример #4
0
 public async Task UnlockAsync()
 {
     await LockableDescriptorUtility.UnlockAsync(this.authentication, this);
 }