Exemplo n.º 1
0
        private void DeviceConnected(bool isConnected)
        {
            if (isConnected)
            {
                var dataflash = m_updater.ReadDataFlash();
                m_connectedDeviceProductId = dataflash.ProductId;
                var deviceName = s_deviceNames.ContainsKey(m_connectedDeviceProductId) ? s_deviceNames[m_connectedDeviceProductId] : "Unknown device";

                UpdateUI(() =>
                {
                    DeviceNameTextBox.Text      = deviceName;
                    HardwareVersionTextBox.Text = dataflash.HardwareVersion.ToString("0.00", CultureInfo.InvariantCulture);
                    FirmwareVersionTextBox.Text = dataflash.FirmwareVersion.ToString("0.00", CultureInfo.InvariantCulture);
                    OkButton.Enabled            = true;
                });
            }
            else
            {
                UpdateUI(() =>
                {
                    DeviceNameTextBox.Clear();
                    HardwareVersionTextBox.Clear();
                    FirmwareVersionTextBox.Clear();
                    OkButton.Enabled = false;
                });
                m_connectedDeviceProductId = null;
            }
        }
Exemplo n.º 2
0
        private void DeviceConnected(bool isConnected)
        {
            if (isConnected)
            {
                var dataflash = m_updater.ReadDataFlash();
                m_connectedDeviceProductId = dataflash.ProductId;
                var deviceName = FirmwareUpdater.GetDeviceName(m_connectedDeviceProductId);

                UpdateUI(() =>
                {
                    DeviceNameTextBox.Text      = deviceName;
                    HardwareVersionTextBox.Text = dataflash.HardwareVersion.ToString("0.00", CultureInfo.InvariantCulture);
                    FirmwareVersionTextBox.Text = dataflash.FirmwareVersion.ToString("0.00", CultureInfo.InvariantCulture);
                    SetUpdaterButtonsState(true);
                });
            }
            else
            {
                UpdateUI(() =>
                {
                    DeviceNameTextBox.Clear();
                    HardwareVersionTextBox.Clear();
                    FirmwareVersionTextBox.Clear();
                    SetUpdaterButtonsState(false);
                });
                m_connectedDeviceProductId = null;
            }
        }