示例#1
0
        private void HandleComButtons_Click(object sender, EventArgs e)
        {
            Button whichButton = (Button)sender;

            switch (whichButton.Name)
            {
            case "btnConnect":
                HandleConnectButton();
                break;

            case "btnDisconnect":
                Disconnect();
                btnDisconnect.Enabled = false;
                break;

            case "btnRefresh":
                GetComPorts();
                break;

            case "btnClearLB":
                lbHistory.Items.Clear();
                break;

            case "btnReadLogFile":
                DataLogger.ReadLogFile();
                break;

            case "btnClearLog":
                DataLogger.ClearLogFile();
                break;

            case "btnSave2SQL":
                btnSave2SQL.Text      = "PLEASE WAIT...";
                btnSave2SQL.ForeColor = System.Drawing.Color.Red;
                bgThreadSQL.RunWorkerAsync();
                break;

            case "btnDisplaySQLData":
                MyADO.DisplayRecords();
                break;

            case "btnDeleteSQLRecords":
                MyADO.DeleteRecords();
                break;
            }
        }
示例#2
0
 private void bgThreadSQL_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
 {
     //---this background worker will save SQL records
     MyADO.Post2DB();
 }