void DoWriteFlash()
        {
            try
            {
                startTime         = DateTime.Now;
                errcnt            = 0;
                timerTime.Enabled = true;
                button2.BeginInvoke((MethodInvoker) delegate() { button2.Text = "!Abort!"; });
                label_errors.BeginInvoke((MethodInvoker) delegate()
                {
                    label_errors.Text = "Errors: 0";
                });
                prog.Connect();
                label_fuses.BeginInvoke((MethodInvoker) delegate() { label_fuses.Text = String.Format("Hfuse: 0x{0:X2} Lfuse: 0x{1:X2} Lock: 0x{2:X2}", prog.hfuse, prog.lfuse, prog.lockb); });

                if (flash != null)
                {
                    prog.WriteFlash(flash);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(null, ex.Message, "Fatal error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                prog.Disconnect();
                timerTime_Tick(this, new EventArgs());
                timerTime.Enabled = false;
                progressBar.BeginInvoke((MethodInvoker) delegate() { progressBar.Value = 100; });
                button2.BeginInvoke((MethodInvoker) delegate() { button2.Text = "Start"; });
            }
        }