Fixed Clear Line issue
This commit is contained in:
@@ -21,6 +21,9 @@ public interface ISerialPortService
|
||||
/// Each line is prefixed with "> " (sent) or "< " (received).</summary>
|
||||
IReadOnlyList<string> GetLines();
|
||||
|
||||
/// <summary>Clears the line buffer.</summary>
|
||||
void ClearLines();
|
||||
|
||||
/// <summary>Fired on the SerialPort receive thread when new lines arrive.</summary>
|
||||
event Action? DataReceived;
|
||||
}
|
||||
|
||||
@@ -97,6 +97,12 @@ public sealed class SerialPortService : ISerialPortService, IDisposable
|
||||
return _lines.ToList();
|
||||
}
|
||||
|
||||
public void ClearLines()
|
||||
{
|
||||
lock (_lock)
|
||||
_lines.Clear();
|
||||
}
|
||||
|
||||
private void OnDataReceived(object sender, SerialDataReceivedEventArgs e)
|
||||
{
|
||||
SerialPort? port;
|
||||
|
||||
Reference in New Issue
Block a user