From b78ebb19d3f872afe600344e2434ccb37ef13a0b Mon Sep 17 00:00:00 2001 From: zhangxy Date: Wed, 9 Jul 2025 10:20:47 +0800 Subject: [PATCH] =?UTF-8?q?1.infotext=E6=BB=91=E5=9D=97=E6=B0=B8=E8=BF=9C?= =?UTF-8?q?=E5=9C=A8=E6=9C=80=E4=B8=8B=E6=96=B9=202.textblock=E6=94=B9?= =?UTF-8?q?=E4=B8=BAtextbox=EF=BC=8C=E8=8E=B7=E5=BE=97textchanged=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=203.=E7=BB=99textbox=E6=B7=BB=E5=8A=A0isReadOnly?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=204.=E4=B8=8B=E6=8B=89=E6=A1=86=E6=AF=8F?= =?UTF-8?q?=E6=AC=A1=E9=80=89=E6=8B=A9=E5=90=8E=E5=8E=BB=E9=99=A4=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E9=A1=B9=EF=BC=8C=E9=98=B2=E6=AD=A2=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E9=87=8D=E5=A4=8D=E9=80=89=E9=A1=B9=EF=BC=8C?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E6=97=A0=E6=B3=95=E8=A7=A6=E5=8F=91SelectedC?= =?UTF-8?q?hanged?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SocketExample/TCPWindowV2.xaml | 15 ++++++++++++--- SocketExample/TCPWindowV2.xaml.cs | 12 ++++++++++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/SocketExample/TCPWindowV2.xaml b/SocketExample/TCPWindowV2.xaml index dd22c63..19fc781 100644 --- a/SocketExample/TCPWindowV2.xaml +++ b/SocketExample/TCPWindowV2.xaml @@ -97,9 +97,18 @@ - - - + + + + + + + + + diff --git a/SocketExample/TCPWindowV2.xaml.cs b/SocketExample/TCPWindowV2.xaml.cs index b212029..76c47b4 100644 --- a/SocketExample/TCPWindowV2.xaml.cs +++ b/SocketExample/TCPWindowV2.xaml.cs @@ -44,6 +44,7 @@ namespace SocketExample int port; TcpClient client; public string option;//命令选项 + public ICommand TextChangedCommand { get; } public ICommand SelectionChangedCommand { get; } public ICommand GPOSelectionChangedCommand { get; } @@ -168,6 +169,7 @@ namespace SocketExample getpowercomn = new LinkCommand(Button_GetPower); SelectionChangedCommand = new RelayCommand(ComboBox_SelectChanged); GPOSelectionChangedCommand = new RelayCommand(GPOComboBox_SelectChanged); + TextChangedCommand = new RelayCommand(TextBlock_SelectChanged); try { @@ -475,7 +477,7 @@ namespace SocketExample Thread GPIOthread = new Thread(new ThreadStart(delegate () { byte[] data = strToToHexByte("AA 55 00 81 81 0D"); client.Send(data); Thread.Sleep(3000); })); - //GPIOthread.Start(); + GPIOthread.Start(); return EasyTask.CompletedTask; } #endregion @@ -651,6 +653,11 @@ namespace SocketExample Infotext = string.Empty;//清空信息框 } + void TextBlock_SelectChanged(ScrollViewer scrollViewer) + { + scrollViewer.ScrollToVerticalOffset(scrollViewer.ExtentHeight); + } + void ComboBox_SelectChanged(ComboBox sender) { string comboxname = sender.Name; @@ -719,7 +726,7 @@ namespace SocketExample } if (sender.SelectedItem?.ToString() == "高") Order += "01 "; - else + else if(sender.SelectedItem?.ToString() == "低") Order += "00 "; Order += "00 00 "; Order += Convert.ToString(GetXor(strToToHexByte(Order), 2), 16) + " 0D"; @@ -728,6 +735,7 @@ namespace SocketExample client.Send(data); data = strToToHexByte("AA 55 00 81 81 0D");//获取GPIO状态 client.Send(data); + sender.SelectedIndex = -1; //SaveCommand(); } catch (Exception ex)