private void button2_Click(object sender, EventArgs e) { if (radioSerial.Checked == true) { send_str("reset\r"); } else if (radioNet.Checked == true) { IPAddress ip; try { ip = IPAddress.Parse(txtIP.Text); } catch (Exception) { MessageBox.Show("IP地址设置有误!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); txtIP.Focus(); return; } Cursor.Current = Cursors.WaitCursor; Application.DoEvents(); try { TFTPClient tftp = new TFTPClient(txtIP.Text); tftp.sendNetCmd("reset"); //MessageBox.Show("PUT finished"); } catch (TFTPClient.TFTPException tx) { MessageBox.Show("Exception in PUT: " + tx.ErrorMessage); Cursor.Current = Cursors.Default; } Cursor.Current = Cursors.Default; Application.DoEvents(); } }