private void button2_Click(object sender, EventArgs e) { if (_Reader != null) { _Reader.Close(); } _Reader = null; }
private void button1_Click(object sender, EventArgs e) { if (_Reader != null) { _Reader.Close(); } int port = 0; if (int.TryParse(textBox1.Text, out port)) { _Reader = new IDR210Reader(port); bool open = _Reader.Open(); MessageBox.Show("打开" + (open ? "成功" : "失败")); } }