Ejemplo n.º 1
0
        private void clearEepromButton_Click(object sender, EventArgs e)
        {
            if (!InvokeRequired)
            {
                clearEepromButton.Enabled = false;

                if (_usb.AreDevicesAvailable())
                {
                    var error = 0;
                    if (mcuBox.Text == "")
                    {
                        _printer.Print("Please select a microcontroller", MessageType.Error);
                        error++;
                    }
                    if (error == 0)
                    {
                        _flasher.ClearEeprom(mcuBox.Text);
                    }
                }
                else
                {
                    _printer.Print("There are no devices available", MessageType.Error);
                }

                clearEepromButton.Enabled = true;
            }
            else
            {
                Invoke(new Action <object, EventArgs>(clearEepromButton_Click), sender, e);
            }
        }
Ejemplo n.º 2
0
        private void ClearEepromButton_Click(object sender, EventArgs e)
        {
            if (!InvokeRequired)
            {
                if (_usb.AreDevicesAvailable())
                {
                    if (mcuBox.SelectedIndex >= 0)
                    {
                        if (!windowState.AutoFlashEnabled)
                        {
                            Invoke(new Action(DisableUI));
                        }

                        _flasher.ClearEeprom((string)mcuBox.SelectedValue);

                        if (!windowState.AutoFlashEnabled)
                        {
                            Invoke(new Action(EnableUI));
                        }
                    }
                    else
                    {
                        _printer.Print("Please select a microcontroller", MessageType.Error);
                    }
                }
                else
                {
                    _printer.Print("There are no devices available", MessageType.Error);
                }
            }
            else
            {
                Invoke(new Action <object, EventArgs>(ClearEepromButton_Click), sender, e);
            }
        }