private void OnDoWork(object sender, DoWorkEventArgs e) { //Asynchronous call from the worker with each tick of the timer //Tell the gateway to go read the latest data on this background thread //Then marshall back to the main thread DataSet ds = ActiveGateway.GetData(); if (ds != null && ds.Tables["DataTable"] != null && ds.Tables["DataTable"].Rows.Count > 0) { ds.Tables["DataTable"].Rows[0]["OnDoWorkThreadId"] = Thread.CurrentThread.ManagedThreadId.ToString(); } e.Result = ds; }
private void OnStopGateway(object sender, EventArgs e) { this.btnStart.Enabled = true; this.btnStop.Enabled = false; ActiveGateway.Stop(); }
private void OnRefresh(object sender, EventArgs e) { ActiveGateway.Refresh(); }