private void btnDisconnect_Click(object sender, EventArgs e) { R2k.deviceDisconnect(); R2k.deviceUnInit(); labelVersion.Text = ""; btnConnect.Enabled = true; btnDisconnect.Enabled = false; btnStartReadData.Enabled = false; btnStopReadData.Enabled = false; bConnected = false; }
// 委托执行的连接函数,成功后修改标志并停止定时器 private void ConnectDevice(byte[] ip, int CommPort, uint PortOrBaudRate) { if (0 != R2k.deviceInit(ip, CommPort, PortOrBaudRate)) { labelVersion.Text = rm.GetString("strMsgInitFailure"); return; } if (0 != R2k.deviceConnect()) { return; } byte[] version = new byte[32]; R2k.GetDevVersion(version); labelVersion.Text = "Version:" + Encoding.Default.GetString(version); btnConnect.Enabled = false; btnDisconnect.Enabled = true; btnStartReadData.Enabled = true; bConnected = true; timerConnect.Stop();// 连接成功,结束定时器 }
private void btnStart_Click(object sender, EventArgs e) { R2k.BeginMultiInv(f); btnStopReadData.Enabled = true; btnStartReadData.Enabled = false; }
private void btnStop_Click(object sender, EventArgs e) { R2k.StopInv(); btnStartReadData.Enabled = true; btnStopReadData.Enabled = false; }
private void btnInvokeOnce_Click(object sender, EventArgs e) { R2k.BeginOnceInv(f); }