private void btnTcpConnect_Click(object sender, EventArgs e) { if (txtIP.Text.Trim() == string.Empty || txtPort.Text.Trim() == string.Empty) { MessageBox.Show("Inputs are incomplete"); return; } try { switch (activePanel) { case ActivePanel.PanelEMG: emg.TCPConnect(txtIP.Text.Trim(), int.Parse(txtPort.Text.Trim())); pnlEMG.BackColor = Color.FromArgb(46, 125, 50); SetActivePanel(PanelEMG); break; case ActivePanel.PanelRFID: rfid.TCPConnect(txtIP.Text.Trim(), int.Parse(txtPort.Text.Trim())); pnlEMG.BackColor = Color.FromArgb(46, 125, 50); SetActivePanel(PanelRFID); break; case ActivePanel.PanelGlove: glove.TCPConnect(txtIP.Text.Trim(), int.Parse(txtPort.Text.Trim())); pnlGLOVE.BackColor = Color.FromArgb(46, 125, 50); SetActivePanel(PanelGLOVE); break; case ActivePanel.PanelHand: hand.TCPConnect(txtIP.Text.Trim(), int.Parse(txtPort.Text.Trim())); pnlHAND.BackColor = Color.FromArgb(46, 125, 50); SetActivePanel(PanelHAND); break; default: break; } } catch (Exception ex) { MessageBox.Show(ex.GetBaseException().ToString()); } }
private void button11_Click(object sender, EventArgs e) { eMG.TCPConnect("127.0.0.1", 1234); eMG.StartReceiveMessage(); eMG.ReceiveMessageHandler += EMG_ReceiveMessageHandler; }