Exemplo n.º 1
0
        protected override void writeOutputState()
        {
            if (string.IsNullOrEmpty(Error) && owner != null && owner.PokeysIndex.HasValue && MatrixLed != null && Row.HasValue && Column.HasValue)
            {
                PoKeysDevice_DLL.PoKeysDevice poKeysDevice = PoKeysEnumerator.Singleton.PoKeysDevice;

                if (!poKeysDevice.ConnectToDevice(owner.PokeysIndex.Value))
                {
                    Error = Translations.Main.PokeysConnectError;
                }
                else
                {
                    if (!MatrixLed.SetPixel((byte)(Row.Value - 1), (byte)(Column.Value - 1), OutputState))
                    {
                        Error = Translations.Main.MatrixLedErrorWrite;
                    }

                    poKeysDevice.DisconnectDevice();
                }
            }
        }
Exemplo n.º 2
0
        public void updateStatus()
        {
            if (owner == null)
            {
                return;
            }

            if (MatrixLed == null || !Row.HasValue || !Column.HasValue)
            {
                Error = null;
            }
            else if (!owner.PokeysIndex.HasValue)
            {
                Error = null;
            }
            else
            {
                PoKeysDevice_DLL.PoKeysDevice poKeysDevice = PoKeysEnumerator.Singleton.PoKeysDevice;

                if (!poKeysDevice.ConnectToDevice(owner.PokeysIndex.Value))
                {
                    Error = Translations.Main.PokeysConnectError;
                }
                else
                {
                    if (!MatrixLed.IsPixelEnabled((byte)(Row.Value - 1), (byte)(Column.Value - 1)))
                    {
                        Error = string.Format(Translations.Main.MatrixLedPixelErrorNotEnabled, Row, Column);
                    }
                    else
                    {
                        Error = null;
                    }

                    poKeysDevice.DisconnectDevice();
                }
            }

            writeOutputState();
        }