Exemplo n.º 1
0
 static string GetLinearValue(Input input)
 {
     return input is SingleValueInput ? ((SingleValueInput)input).Value : ((MultiValueInput)input).Values.JoinString(", ");
 }
Exemplo n.º 2
0
        static IEnumerable<string> GetValues(Input input)
        {
            var s = input as SingleValueInput;
            if (s != null)
                return s.Value == string.Empty ? Enumerable.Empty<string>() : new[] { s.Value };

            var m = input as MultiValueInput;
            if (m != null)
                return m.Values;

            throw new InvalidOperationException();
        }
Exemplo n.º 3
0
        static bool AssignValue(Input input, ICommand command, ICommandInputDescriptor descriptor)
        {
            var s = input as SingleValueInput;
            if (s != null)
                return descriptor.TrySetValue(command, s.Value == string.Empty ? Enumerable.Empty<string>() : new[] { s.Value });

            var m = input as MultiValueInput;
            if (m != null)
                return descriptor.TrySetValue(command, m.Values);
            throw new InvalidOperationException();
        }
Exemplo n.º 4
0
 static bool AssignValue(Input input, ICommand command, ICommandInputDescriptor descriptor)
 {
     return descriptor.TrySetValue(command, GetValues(input));
 }