private void button1_Click(object sender, EventArgs e) { OPCRaW.connOPcserver("localhost", "KEPware.KEPServerEx.V4"); OPCRaW.OPCServerADDgroup("one", "Channel1.Device1.123"); gonext = false; timer1.Enabled = true; }
private void disconn() { kill = true; ///停止后台线程触发 while (backgroundWorker1.IsBusy) { //backgroundWorker1.CancelAsync(); Thread.Sleep(3000); } ///等待线程处理完成 OPCRaW.DisConnectOPCServerOfBCNetS7(); ///执行服务器断开操作 kill = false; }
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { return; if (kill == true) { OPCRaW.DisConnectOPCServerOfBCNetS7(); ///执行服务器断开操作 textBox1.Text = "---"; textBox2.Text = "---"; textBox3.Text = "---"; textBox4.Text = "---"; textBox5.Text = "---"; textBox6.Text = "---"; textBox7.Text = "---"; this.Cursor = Cursors.Default; kill = false; } }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { OPCRaW.ReadRunTimeData(ref a, ref qua, ref reserved, ref time, ref type, ref hclient, ref hashcode); gonext = false; }
private void treadtest() { OPCRaW.ReadRunTimeData(ref a, ref qua, ref reserved, ref time, ref type, ref hclient, ref hashcode); gonext = false; }