/// <summary> /// 关闭串口 /// </summary> private void CloseChuanKou() { try { if (TextGSM.IsOpen) { TextGSM.Close(); TextGSM = null; } } catch (Exception) {; } }
public void Stop() { try { if (gm.IsOpen) { gm.SmsRecieved -= new EventHandler(gm_SmsRecieved); gm.Close(); } } catch (Exception ex) { Service.ServiceControl.log.Error(DateTime.Now + ex.ToString()); } }
private void button2_Click(object sender, EventArgs e) { if (gm.IsOpen) { try { gm.Close(); label3.Text = "断开成功"; label3.ForeColor = Color.Red; } catch { label3.Text = "断开失败"; label3.ForeColor = Color.Red; } } }
public void Stop() { gm.Close(); }