/// <summary> /// 关闭串口 /// </summary> public void Close() { if (null != _port) { _port.Close(); _port = null; } }
private void Window_Closed(object sender, EventArgs e) { try { _serialPort?.Close(); } catch (Exception ex) { Console.WriteLine("串口关闭失败:" + ex.Message); } }
public static void SendStringToCustomerDisplay(string displayLine1, string displayLine2, GodSerialPort serialPort) { serialPort.ClearScreen(); serialPort.SetCursorToLine(Line.One); serialPort.WriteAsciiString(displayLine1); serialPort.SetCursorToLine(Line.Two); serialPort.WriteAsciiString(displayLine2); serialPort.Close(); }
public void Dispose() { myPort.Close(); }
public void Close() { port.Close(); }
private void receiveWindow_Closed(object sender, EventArgs e) { _serialPort.Close(); }
/// <summary> /// 关闭串口通讯 /// </summary> internal void Close() { _port?.Close(); }