internal static PocketView GetSvg(this AnaloguePortDeviceBase analogueDevice) { switch (analogueDevice) { case LightSensor lightSensor: return(lightSensor.GetSvg()); case Potentiometer potentiometer: return(potentiometer.GetSvg()); case SoundSensor soundSensor: return(soundSensor.GetSvg()); default: throw new ArgumentOutOfRangeException(nameof(analogueDevice)); } }
public static object GetDeviceValue(this AnaloguePortDeviceBase analogueDevice) { switch (analogueDevice) { case LightSensor lightSensor: return(lightSensor.Value); case Potentiometer potentiometer: return(potentiometer.Position); case SoundSensor soundSensor: return(soundSensor.Value); default: throw new ArgumentOutOfRangeException(nameof(analogueDevice)); } }
internal static IHtmlContent DrawSvg(this AnaloguePortDeviceBase analogueDevice) { var id = "PiTopMakerArchitecture.Foundation.InteractiveExtension" + Guid.NewGuid().ToString("N"); return(div[id : id](svg(analogueDevice.GetSvg()))); }