From b280965699c1008312d7141dc1026db5d9d057b7 Mon Sep 17 00:00:00 2001 From: zhangxy Date: Tue, 24 Jun 2025 17:11:41 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=8E=BB=E6=8E=89=E6=97=A0=E7=94=A8=E7=9A=84?= =?UTF-8?q?stream.close=202.=E5=8A=9F=E7=8E=87=E4=BF=9D=E7=95=99=E4=B8=A4?= =?UTF-8?q?=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SocketExample/TCPWindowV2.xaml.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SocketExample/TCPWindowV2.xaml.cs b/SocketExample/TCPWindowV2.xaml.cs index e6ff33d..a3695a9 100644 --- a/SocketExample/TCPWindowV2.xaml.cs +++ b/SocketExample/TCPWindowV2.xaml.cs @@ -290,8 +290,8 @@ namespace SocketExample string tempWritestate = ""; for (int n = 0;n < (Convert.ToInt32(dataLength,16)/5);n++) { - tempReadstate += $"A{n+1}:{Convert.ToInt32(readStateString.Substring(12+10*n,4),16).ToString()} "; - tempWritestate += $"A{n + 1}:{Convert.ToInt32(readStateString.Substring(16 + 10 * n, 4), 16).ToString()} "; + tempReadstate += $"A{n+1} : {(Convert.ToInt32(readStateString.Substring(12+10*n,4),16)/100).ToString()} "; + tempWritestate += $"A{n + 1} : {(Convert.ToInt32(readStateString.Substring(16 + 10 * n, 4), 16) / 100).ToString()} "; } ReadPowerState = tempReadstate; WritePowerState = tempWritestate; @@ -440,7 +440,7 @@ namespace SocketExample //连接事件 client.Connected += onConnected; //断连事件 - client.Closed = (client, e) => { Infotext += "已断开!\n"; StateColour = "Red"; LinkState = "未连接"; streamWriter.Close(); return EasyTask.CompletedTask; }; + client.Closed = (client, e) => { Infotext += "已断开!\n"; StateColour = "Red"; LinkState = "未连接"; return EasyTask.CompletedTask; }; //接收事件 client.Received += onRecieved;