private void BtnReadTh_Click(object sender, EventArgs e) { toolStripStatusLabel.Text = "data reading..."; ShowProgressDelegate showProgress = new ShowProgressDelegate(ShowProgress); ws2300bg ws = new ws2300bg(this, showProgress, new object[] { ws2300, config, "T_IN,T_OUT,DEW,H_IN,H_OUT,WIND,W_CHILL,PRESS" }); Thread t = new Thread(new ThreadStart(ws.RunProcess)); t.IsBackground = true; //make them a daemon - prevent thread callback issues btnInTmp.Enabled = false; btnMinMax.Enabled = false; btnRead.Enabled = false; btnReset.Enabled = false; btnReadTh.Enabled = false; btnHistorySave.Enabled = false; t.Start(); }
private void Historybg(int new_records, int interval, int lastlog_record, DateTime time_lastrecord_tm, double pressure_term) { toolStripStatusLabel.Text = "data reading..."; ShowProgressDelegate showProgress = new ShowProgressDelegate(ShowProgress); ws2300bg ws = new ws2300bg(this, showProgress, new object[] { ws2300, config, "HISTORY" }); ws.NewRecords = new_records; ws.Interval = interval; ws.LastLogRecord = lastlog_record; ws.LastRecordDateTime = time_lastrecord_tm; ws.PressureTerm = pressure_term; Thread t = new Thread(new ThreadStart(ws.RunProcess)); t.IsBackground = true; //make them a daemon - prevent thread callback issues btnInTmp.Enabled = false; btnMinMax.Enabled = false; btnRead.Enabled = false; btnReset.Enabled = false; btnReadTh.Enabled = false; btnHistorySave.Enabled = false; t.Start(); }