Exemplo n.º 1
0
 public IEnumerable <Localizable> Validate(IComponentContext <float> context, IValidationContext validationContext, float value)
 {
     if ((value < _min) || (value > _max))
     {
         yield return(new Localizable(
                          "ValueOutsideRange",
                          Localizable.NotLocalizable(_min),
                          Localizable.NotLocalizable(_max)));
     }
 }
Exemplo n.º 2
0
        private IProperty GetProperty(object @object, PropertyInfo property, AssemblingContext assemblingContext)
        {
            var name    = GetAttribute <ComponentNameAttribute>(property)?.Value ?? Localizable.NotLocalizable(property.Name);
            var initial = (dynamic)property.GetValue(@object);
            var form    = GetFormType(assemblingContext);

            if ((GetAttribute <ComplexAttribute>(property) != null) && (initial != null))
            {
                return(CreateComponent(initial, name, Combine(GetConfiguration(property, form), GetConfiguration(property.PropertyType, form)), assemblingContext));
            }

            if (property.PropertyType.IsEnum || _knownTypes.Contains(property.PropertyType))
            {
                return(CreateProperty(@object, initial, property, name, form));
            }

            if (property.PropertyType == typeof(string))
            {
                return(CreateStringProperty(@object, initial, property, name, form, assemblingContext?.TokenReplacer));
            }

            return(null);
        }
Exemplo n.º 3
0
 public ErrorOccuredNotification(Exception exception)
 {
     Error = Localizable.NotLocalizable(exception.Message);
     Type  = Localizable.NotLocalizable(exception.GetType().FullName);
 }