String to an arbitrary enumeration converter.
Inheritance: ValueConverterAttribute
Ejemplo n.º 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 + "."));
 }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }