public bool Open1() { string s = null; if (SMSPort.IsOpen == false) { try { SMSPort.Open(); SMSPort.Write("AT\r\n"); Thread.Sleep(100); s = SMSPort.ReadExisting(); if (s.Contains("OK")) { SMSPort.Write("AT+CFUN=1\r\n"); ReadThread.Start(); return(true); } else { if (SMSPort.IsOpen) { SMSPort.Close(); } return(false); } } catch (Exception ex) { //MessageBox.Show(ex.ToString()); return(false); } } return(true); }
public void Open() { if (SMSPort.IsOpen == false) { try { SMSPort.Open(); SMSPort.Write("AT+CFUN=1\r\n"); ReadThread.Start(); } catch (Exception ex) { //MessageBox.Show(ex.ToString()); } } }