LokiProgrammer.ActionForm.worker_RunWorkerCompleted C# (CSharp) Method

worker_RunWorkerCompleted() private method

private worker_RunWorkerCompleted ( object sender, RunWorkerCompletedEventArgs e ) : void
sender object
e System.ComponentModel.RunWorkerCompletedEventArgs
return void
        void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Cancelled)
            {
                MessageBox.Show("Operation Cancelled", "Bootloader Operation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            } else if (e.Error != null)
            {
                if (e.Error is InvalidRowException)
                {
                    MessageBox.Show("Attempted to write to an invalid location in flash. Check to make sure this firmware was built against the correct bootloader version.", "Bootloader Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (e.Error is CommunicationsError)
                {
                    MessageBox.Show("A communications error was encountered while talking to the bootloader. Try restarting the device and trying again.", "Bootloader Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show("Error occurred communicating with bootloader: " + e.Error.ToString(), "Bootloader Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                success = true;
            }
            worker = null;
            this.Close();
        }