public void UpdateStatus() { if (owner == null) { return; } if (!PinId.HasValue) { Error = null; } else if (!owner.PoKeysIndex.HasValue) { Error = null; } else { PoKeysDevice poKeysDevice = PoKeysEnumerator.Singleton.PoKeysDevice; if (!poKeysDevice.ConnectToDevice(owner.PoKeysIndex.Value)) { Error = Translations.Main.PoKeysConnectError; } else { byte pinFunction = 0; if (!poKeysDevice.GetPinData((byte)(PinId.Value - 1), ref pinFunction)) { Error = Translations.Main.DigitalOutputErrorGetIOType; } else { if ((pinFunction & 0x4) == 0) { Error = Translations.Main.DigitalOutputErrorBadIOType; } else { Error = null; } } poKeysDevice.DisconnectDevice(); } } WriteOutputState(); }