private void PFPanel_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (m_cancelPending)
            {
                return;              // had a call before - so just die now
            }
            // don't record minimized, maximized forms
            if (this.WindowState == FormWindowState.Normal)
            {
                AppSettings.Instance.FormLocation = this.Location;
            }
            AppSettings.Instance.UseKeyboard = cbxKBon.Checked;
            string s = "";

            foreach (var cl in cbxJoystick.CheckedItems)
            {
                s += cl.ToString( ) + " ";
            }
            AppSettings.Instance.JoystickUsed = s;
            AppSettings.Instance.ReportEvents = cbxReport.Checked;
            AppSettings.Instance.Save( );

            if (BGW_Hid.IsBusy)
            {
                BGW_Hid.CancelAsync( );
                m_cancelPending = true;
                e.Cancel        = true; // will close if we finished the worker
            }
        }
 private void btStopService_Click(object sender, EventArgs e)
 {
     btStopService.Enabled = false;
     BGW_Hid.CancelAsync( );
 }