예제 #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");
 }
예제 #4
0
 protected static Characteristic <TC> CreateHiddenCharacteristic <TC>(string memberName) => Characteristic.CreateHidden <T, TC>(memberName);
예제 #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);
예제 #8
0
 public T ResolveValue <T>(Characteristic <T> characteristic, IResolver resolver)
 {
     return(resolver.Resolve(this, characteristic));
 }
예제 #9
0
 public T ResolveValue <T>(Characteristic <T> characteristic, T defaultValue)
 {
     return(HasValue(characteristic) ? GetValue(characteristic) : (T)characteristic.ResolveValueCore(this, defaultValue));
 }
예제 #10
0
        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);
        }
예제 #11
0
 internal T GetValue <T>(Characteristic <T> characteristic)
 {
     return((T)GetValue((Characteristic)characteristic));
 }
예제 #12
0
        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}");
        }
예제 #13
0
 public bool CanResolve(Characteristic characteristic) => resolvers.Any(r => r.CanResolve(characteristic));
예제 #14
0
 protected void Register <T>(Characteristic <T> characteristic, Func <T> resolver) =>
 resolvers[characteristic] = obj => resolver();
예제 #15
0
 public T ResolveValue <[DynamicallyAccessedMembers(CharacteristicObject.CharacteristicMemberTypes)] T>(Characteristic <T> characteristic, T defaultValue)
 {
     return(HasValue(characteristic) ? GetValue(characteristic) : (T)characteristic.ResolveValueCore(this, defaultValue));
 }
예제 #16
0
 public T?ResolveValueAsNullable <T>(Characteristic <T> characteristic) where T : struct
 {
     return(HasValue(characteristic) ? GetValue(characteristic) : (T?)null);
 }
예제 #17
0
 public object ResolveValue(Characteristic characteristic, object defaultValue)
 {
     return(HasValue(characteristic) ? GetValue(characteristic) : characteristic.ResolveValueCore(this, defaultValue));
 }
예제 #18
0
 internal void SetValue <T>(Characteristic <T> characteristic, T value)
 {
     SetValue((Characteristic)characteristic, value);
 }
예제 #19
0
 internal void SetValue <[DynamicallyAccessedMembers(CharacteristicMemberTypes)] T>(Characteristic <T> characteristic, T value)
 {
     SetValue((Characteristic)characteristic, value);
 }
예제 #20
0
 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);
예제 #22
0
 private object ResolveCore(Characteristic characteristic, object result)
 {
     return(characteristic.ResolveValueCore(this, result));
 }
예제 #23
0
 protected static Characteristic <TC> CreateIgnoreOnApplyCharacteristic <TC>(string memberName) => Characteristic.CreateIgnoreOnApply <T, TC>(memberName);
예제 #24
0
 public T ResolveValue <[DynamicallyAccessedMembers(CharacteristicMemberTypes)] T>(Characteristic <T> characteristic, IResolver resolver, T defaultValue)
 {
     return(resolver.Resolve(this, characteristic, defaultValue));
 }
예제 #25
0
 public override string ToPresentation(CharacteristicObject obj, Characteristic characteristic)
 {
     return(obj.HasValue(characteristic)
         ? FolderNameHelper.ToFolderName(characteristic[obj])
         : "Default");
 }
예제 #26
0
 public object ResolveValue(Characteristic characteristic, IResolver resolver)
 {
     return(resolver.Resolve(this, characteristic));
 }
 public abstract string ToPresentation(JobMode jobMode, Characteristic characteristic);
예제 #28
0
 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");
 }
예제 #30
0
 public override string ToPresentation(CharacteristicObject obj, Characteristic characteristic)
 => obj.HasValue(characteristic)
         ? ToPresentation(characteristic[obj], characteristic)
         : "Default";