private void btnReadVFDVals_Click(object sender, EventArgs e)
        {
            if (!bwrkReadVFDVals.IsBusy)
            {
                // Reset all progress flags and start the VFD parameter setting read thread
                ProgressArgs.ClearVFDReadVals();    // Initialize the progress flags for a VFD read
                ProgressArgs.Mode_Sel     = ProgressEventArgs.VFDReadMode;
                ProgressArgs.VFDRead_Stat = 0x01;
                bwrkReadVFDVals.RunWorkerAsync();   // Start the separate thread for reading the current VFD parameter settings

                // Create the progress reporting form object and show it.
                frmProgReport frmVFDReadProg = new frmProgReport("VFD Read Parameter:", "Data Read Progress", "Cancel VFD Read");
                frmVFDReadProg.ProgressCancelUpdated += new frmProgReport.ProgressCancelHandler(Progress_Cancel_Clicked);
                ProgressEvent += frmVFDReadProg.ProgressReceived;

                // Set the progress form display location at the center of the main form.
                int x = (this.DesktopBounds.X + (this.Width / 2)) - (frmVFDReadProg.DesktopBounds.Width / 2);
                int y = (this.DesktopBounds.Y + (this.Height / 2)) - (frmVFDReadProg.DesktopBounds.Height / 2);
                frmVFDReadProg.SetDesktopLocation(x, y);

                // Show the form
                frmVFDReadProg.Show();

                btnReadVFDVals.Enabled = false; // disable the Read VFD button while a read is in progress.
            }
        }
        private void btnWriteDefValFile_Click(object sender, EventArgs e)
        {
            if ((ParamDefValFile != null) && !bwrkWriteDefValFile.IsBusy)
            {
                // Reset all progress flags and start the list file read thread
                ProgressArgs.ClearWriteListVals();
                ProgressArgs.Mode_Sel       = ProgressEventArgs.ListWriteMode;
                ProgressArgs.ListWrite_Stat = 0x01;
                bwrkWriteDefValFile.RunWorkerAsync();

                // Create the progress reporting form object and show it.
                frmProgReport frmListFileWrite = new frmProgReport("", "Data Write Progress:", "Cancel Data Write");
                frmListFileWrite.ProgressCancelUpdated += new frmProgReport.ProgressCancelHandler(Progress_Cancel_Clicked);
                ProgressEvent += frmListFileWrite.ProgressReceived;

                // Set the progress form display location at the center of the main form.
                int x = (this.DesktopBounds.X + (this.Width / 2)) - (frmListFileWrite.DesktopBounds.Width / 2);
                int y = (this.DesktopBounds.Y + (this.Height / 2)) - (frmListFileWrite.DesktopBounds.Height / 2);
                frmListFileWrite.SetDesktopLocation(x, y);

                // Show the form
                frmListFileWrite.Show();

                btnWriteDefValList.Enabled = false;
            }
        }
        private void btnParamListRead_Click(object sender, EventArgs e)
        {
            if (!bwrkReadParamListFile.IsBusy)
            {
                // Clear all existing rows in the datagridview
                dgvV1000ParamView.Rows.Clear();

                // Reset all progress flags and start the list file read thread
                ProgressArgs.ClearListReadVals();
                ProgressArgs.Mode_Sel      = ProgressEventArgs.ListReadMode;
                ProgressArgs.ListRead_Stat = 0x01;
                bwrkReadParamListFile.RunWorkerAsync();

                // Create the progress reporting form object and show it.
                frmProgReport frmListFileRead = new frmProgReport("", "Data Read Progress:", "Cancel Data Read");
                frmListFileRead.ProgressCancelUpdated += new frmProgReport.ProgressCancelHandler(Progress_Cancel_Clicked);
                ProgressEvent += frmListFileRead.ProgressReceived;

                // Set the progress form display location at the center of the main form.
                int x = (this.DesktopBounds.X + (this.Width / 2)) - (frmListFileRead.DesktopBounds.Width / 2);
                int y = (this.DesktopBounds.Y + (this.Height / 2)) - (frmListFileRead.DesktopBounds.Height / 2);
                frmListFileRead.SetDesktopLocation(x, y);

                // Show the form
                frmListFileRead.Show();

                btnReadParamList.Enabled = false;
            }
        }