private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (xd != null) { xd.Close(); xd = null; } }
private void buttonDisConnect_Click(object sender, EventArgs e) { if (xd != null) { xd.Close(); xd = null; } }
private void buttonConnect_Click(object sender, EventArgs e) { xd = new XdTcpHelper(); xd.OnConnected += xd_OnConnected; xd.OnDisConnected += xd_OnDisConnected; xd.OnReceiveData += xd_OnReceiveData; xd.Open(textBoxIP.Text, int.Parse(textBoxPort.Text)); xd.OnReceiveLogin += xd_OnReceiveLogin; xd.OnReceiveGetDevChargeInfo += xd_OnReceiveGetDevChargeInfo; xd.OnReceiveGetDevVersion += xd_OnReceiveGetDevVersion; xd.OnReceiveNoteDevChargeStatus += xd_OnReceiveNoteDevChargeStatus; xd.OnReceiveNoteDevStatus += xd_OnReceiveNoteDevStatus; xd.OnReceiveSubscribrDevChargeStatus += xd_OnReceiveSubscribrDevChargeStatus; xd.OnReceiveSubscribrDevStatus += xd_OnReceiveSubscribrDevStatus; }