Exemple #1
0
 public bool CanResolve(Characteristic characteristic) => resolvers.ContainsKey(characteristic);
 public static bool IsPresentableCharacteristic(this Characteristic c, bool includeIgnoreOnApply = false) =>
 !c.HasChildCharacteristics && (includeIgnoreOnApply || !c.IgnoreOnApply);
 public override string ToPresentation(JobMode jobMode, Characteristic characteristic)
 {
     return(jobMode.HasValue(characteristic)
         ? characteristic[jobMode]?.ToString() ?? ""
         : "Default");
 }
Exemple #4
0
 protected static Characteristic <TC> CreateHiddenCharacteristic <TC>(string memberName) => Characteristic.CreateHidden <T, TC>(memberName);
Exemple #5
0
 public abstract string ToPresentation(CharacteristicObject obj, Characteristic characteristic);
 public T?ResolveValueAsNullable <[DynamicallyAccessedMembers(CharacteristicMemberTypes)] T>(Characteristic <T> characteristic) where T : struct
 {
     return(HasValue(characteristic) ? GetValue(characteristic) : (T?)null);
 }
 protected static Characteristic <TC> CreateHiddenCharacteristic <[DynamicallyAccessedMembers(CharacteristicMemberTypes)] TC>(string memberName) => Characteristic.CreateHidden <T, TC>(memberName);
Exemple #8
0
 public T ResolveValue <T>(Characteristic <T> characteristic, IResolver resolver)
 {
     return(resolver.Resolve(this, characteristic));
 }
Exemple #9
0
 public T ResolveValue <T>(Characteristic <T> characteristic, T defaultValue)
 {
     return(HasValue(characteristic) ? GetValue(characteristic) : (T)characteristic.ResolveValueCore(this, defaultValue));
 }
        public T Resolve <[DynamicallyAccessedMembers(CharacteristicObject.CharacteristicMemberTypes)] T>(CharacteristicObject obj, Characteristic <T> characteristic, T defaultValue)
        {
            if (obj.HasValue(characteristic))
            {
                return(characteristic[obj]);
            }

            var resolver = resolvers.FirstOrDefault(r => r.CanResolve(characteristic));

            if (resolver != null)
            {
                return(resolver.Resolve(obj, characteristic, defaultValue));
            }
            return(defaultValue);
        }
Exemple #11
0
 internal T GetValue <T>(Characteristic <T> characteristic)
 {
     return((T)GetValue((Characteristic)characteristic));
 }
        public T Resolve <[DynamicallyAccessedMembers(CharacteristicObject.CharacteristicMemberTypes)] T>(CharacteristicObject obj, Characteristic <T> characteristic)
        {
            if (obj.HasValue(characteristic))
            {
                return(characteristic[obj]);
            }

            var resolver = resolvers.FirstOrDefault(r => r.CanResolve(characteristic));

            if (resolver != null)
            {
                return(resolver.Resolve(obj, characteristic));
            }
            throw new InvalidOperationException($"There is no default resolver for {characteristic.FullId}");
        }
 public bool CanResolve(Characteristic characteristic) => resolvers.Any(r => r.CanResolve(characteristic));
Exemple #14
0
 protected void Register <T>(Characteristic <T> characteristic, Func <T> resolver) =>
 resolvers[characteristic] = obj => resolver();
 public T ResolveValue <[DynamicallyAccessedMembers(CharacteristicObject.CharacteristicMemberTypes)] T>(Characteristic <T> characteristic, T defaultValue)
 {
     return(HasValue(characteristic) ? GetValue(characteristic) : (T)characteristic.ResolveValueCore(this, defaultValue));
 }
Exemple #16
0
 public T?ResolveValueAsNullable <T>(Characteristic <T> characteristic) where T : struct
 {
     return(HasValue(characteristic) ? GetValue(characteristic) : (T?)null);
 }
 public object ResolveValue(Characteristic characteristic, object defaultValue)
 {
     return(HasValue(characteristic) ? GetValue(characteristic) : characteristic.ResolveValueCore(this, defaultValue));
 }
Exemple #18
0
 internal void SetValue <T>(Characteristic <T> characteristic, T value)
 {
     SetValue((Characteristic)characteristic, value);
 }
 internal void SetValue <[DynamicallyAccessedMembers(CharacteristicMemberTypes)] T>(Characteristic <T> characteristic, T value)
 {
     SetValue((Characteristic)characteristic, value);
 }
 internal T GetValue <[DynamicallyAccessedMembers(CharacteristicMemberTypes)] T>(Characteristic <T> characteristic)
 {
     return((T)GetValue((Characteristic)characteristic));
 }
 protected static Characteristic <TC> CreateIgnoreOnApplyCharacteristic <[DynamicallyAccessedMembers(CharacteristicMemberTypes)] TC>(string memberName) => Characteristic.CreateIgnoreOnApply <T, TC>(memberName);
 private object ResolveCore(Characteristic characteristic, object result)
 {
     return(characteristic.ResolveValueCore(this, result));
 }
Exemple #23
0
 protected static Characteristic <TC> CreateIgnoreOnApplyCharacteristic <TC>(string memberName) => Characteristic.CreateIgnoreOnApply <T, TC>(memberName);
 public T ResolveValue <[DynamicallyAccessedMembers(CharacteristicMemberTypes)] T>(Characteristic <T> characteristic, IResolver resolver, T defaultValue)
 {
     return(resolver.Resolve(this, characteristic, defaultValue));
 }
Exemple #25
0
 public override string ToPresentation(CharacteristicObject obj, Characteristic characteristic)
 {
     return(obj.HasValue(characteristic)
         ? FolderNameHelper.ToFolderName(characteristic[obj])
         : "Default");
 }
 public object ResolveValue(Characteristic characteristic, IResolver resolver)
 {
     return(resolver.Resolve(this, characteristic));
 }
 public abstract string ToPresentation(JobMode jobMode, Characteristic characteristic);
 public object ResolveValue(Characteristic characteristic, IResolver resolver, object defaultValue)
 {
     return(resolver.Resolve(this, characteristic, defaultValue));
 }
 public override string ToPresentation(JobMode jobMode, Characteristic characteristic)
 {
     return(jobMode.HasValue(characteristic)
         ? FolderNameHelper.ToFolderName(characteristic[jobMode])
         : "Default");
 }
Exemple #30
0
 public override string ToPresentation(CharacteristicObject obj, Characteristic characteristic)
 => obj.HasValue(characteristic)
         ? ToPresentation(characteristic[obj], characteristic)
         : "Default";