private void UploadButton_Click(object sender, EventArgs e)
        {
            if (!ValidateConnectionStatus())
            {
                return;
            }

            m_worker.RunWorkerAsync(new AsyncProcessWrapper(worker =>
            {
                try
                {
                    var dataflashCopy = new byte[m_simple.Data.Length];
                    Buffer.BlockCopy(m_simple.Data, 0, dataflashCopy, 0, m_simple.Data.Length);

                    UpdateUI(() => SaveWorkspaceToDataflash(m_dataflash));

                    m_manager.Write(m_dataflash, dataflashCopy);
                    m_usbConnector.WriteDataflash(new SimpleDataflash {
                        Data = dataflashCopy
                    }, worker);
                }
                catch (Exception ex)
                {
                    s_logger.Warn(ex);
                    InfoBox.Show(GetErrorMessage("uploading settings"));
                }
            }));
        }
        private void UpdateFirmwareAsyncWorker(BackgroundWorker worker, byte[] firmware)
        {
            var isSuccess = false;

            try
            {
                UpdateUI(() => UpdateStatusLabel.Text = @"Reading dataflash...");
                var dataflash = m_connector.ReadDataflash(worker);
                if (dataflash.LoadFromLdrom == false && dataflash.FirmwareVersion > 0)
                {
                    dataflash.LoadFromLdrom = true;
                    UpdateUI(() => UpdateStatusLabel.Text = @"Writing dataflash...");
                    m_connector.WriteDataflash(dataflash, worker);
                    m_connector.RestartDevice();
                    UpdateUI(() => UpdateStatusLabel.Text = @"Waiting for device after reset...");
                    Thread.Sleep(2000);
                }
                UpdateUI(() => UpdateStatusLabel.Text = @"Uploading firmware...");
                m_connector.WriteFirmware(firmware, worker);

                UpdateUI(() =>
                {
                    UpdateStatusLabel.Text = string.Empty;
                    worker.ReportProgress(0);
                });
                isSuccess = true;

                Thread.Sleep(500);
            }
            catch (Exception ex)
            {
                InfoBox.Show("An exception occured during firmware update.\n" + ex.Message);
            }
            finally
            {
                if (isSuccess)
                {
                    InfoBox.Show("Firmware successfully updated.");
                }
            }
        }