|
|
|
@ -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>(ComboBox_SelectChanged);
|
|
|
|
|
GPOSelectionChangedCommand = new RelayCommand<ComboBox>(GPOComboBox_SelectChanged);
|
|
|
|
|
TextChangedCommand = new RelayCommand<ScrollViewer>(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)
|
|
|
|
|