Exemple #1
0
        private void ReadControllerData(SerialPort serialPort, int controllerIndex)
        {
            if (controllerIndex < controllerItems.Count())
            {
                controllerToRead = controllerItems[controllerToReadIndex];

                SerialPortHelper.ReadAllData(serialPort, controllerToRead.GroupId, controllerToRead.AddressId);
            }
        }
Exemple #2
0
        private void ReadSelectedComData(int groupId, int addressId)
        {
            // 设置解析代理
            SerialPortHelper.ParseReData = (recData) =>
            {
                currentControllerItem.ParseDataToControllerItem(recData);

                Invoke(refreshSettingDisplay);
            };

            // 读取控制器所有设置数据
            SerialPortHelper.ReadAllData(serialPort, groupId, addressId);

            if (currentControllerItem.PowerState)
            {
                powerButton.BackgroundImage = Properties.Resources.powerOn;
            }
            else
            {
                powerButton.BackgroundImage = Properties.Resources.powerOff;
            }
        }