String to an arbitrary enumeration converter.
Inheritance: ValueConverterAttribute
示例#1
0
 public void Function(StringValue type)
 {
     var stec = new StringToEnumConverter(typeof(DisplayStyle));
     var value = stec.Convert(type);
     Context.DefaultDisplayStyle = (DisplayStyle)value;
     Context.RaiseNotification(new NotificationEventArgs(NotificationType.Information, "Display format changed to " + value + "."));
 }
示例#2
0
        public ScalarValue Function(StringValue p)
        {
            var conv = new StringToEnumConverter(typeof(VideoProperty));
            var property = (VideoProperty)conv.Convert(p);
            var deviceReader = default(VideoDeviceReader);

            if (NamedProperties.TryGetValue(property, out deviceReader))
            {
                return deviceReader.GetValue(_sensor);
            }

            return new ScalarValue();
        }
示例#3
0
        public ScalarValue Function(StringValue p)
        {
            var conv = new StringToEnumConverter(typeof(AudioProperty));
            var property = (AudioProperty)conv.Convert(p);
            var callback = default(Func<Microphone, ScalarValue>);

            if (NamedProperties.TryGetValue(property, out callback))
            {
                return callback(_sensor);
            }

            return new ScalarValue();
        }