protected override void WriteOutputState() { if (string.IsNullOrEmpty(Error) && owner != null && owner.PoKeysIndex.HasValue && PinId.HasValue) { PoKeysDevice pokeysDevice = PoKeysEnumerator.Singleton.PoKeysDevice; if (!pokeysDevice.ConnectToDevice(owner.PoKeysIndex.Value)) { Error = Translations.Main.PoKeysConnectError; } else { if (!pokeysDevice.SetOutput((byte)(PinId.Value - 1), OutputState)) { Error = Translations.Main.DigitalOutputErrorWrite; } pokeysDevice.DisconnectDevice(); } } }