private void btnOnekeyTest_Click(object sender, EventArgs e) { int i, k; FSystemID = 0; FChlAddr = 161; string sOutBSTR; int n1, nRet; Thread myThread = new Thread(ThreadMethod); starttime.Text = System.DateTime.Now.ToString(); //if (start == true) btnOnekeyTest.Enabled = false; btnExit.Enabled = true; runtime_i = 0; runtime.Text = "0:0"; //myThread.Start(); //start = true; stop_thread = false; test_string = true; second_count = 0; loop_count = 0; output_ampare = 0; runtime_hour = 0; { stop_thread = false; start = false; FTXObjCtrl.LoadObj(); // float temp = Convert.ToSingle(textBox1.Text); for (i = 0; i < 5; i++) { FTXObjCtrl.OpenLAN(Device_Ip[i], 7000, 1); for (k = 0; k < 12; k++) { FTXObjCtrl.SetProtect(FSsystemID[i], FChladdr[k], 1, 20F); FTXObjCtrl.SetProtect(FSsystemID[i], FChladdr[k], 3, 150F); FTXObjCtrl.SetFunctionMode(FSsystemID[i], FChladdr[k], 0); FTXObjCtrl.SetInput(FSsystemID[i], FChladdr[k], 1); //FTXObjCtrl.SetCCValue(FSsystemID[i], FChladdr[k], Convert.ToSingle(ampere.Text)); } FTXObjCtrl.Close(); } myThread.Start(); } }
private void button1_Click(object sender, EventArgs e) { int i, k; start = true; stop_thread = true; for (i = 0; i < 5; i++) { FTXObjCtrl.OpenLAN(Device_Ip[i], 7000, 1); for (k = 0; k < 12; k++) { FTXObjCtrl.SetInput(FSsystemID[i], FChladdr[k], 0); } FTXObjCtrl.Close(); } btnExit.Enabled = false; btnOnekeyTest.Enabled = true; second_count = 0; FTXObjCtrl.FreeObj(); //FTXObjCtrl.FreeObj(); }