diff --git a/UserClass/AsyncSerialPortClient.cs b/UserClass/AsyncSerialPortClient.cs index c55bc77..db1fdbf 100644 --- a/UserClass/AsyncSerialPortClient.cs +++ b/UserClass/AsyncSerialPortClient.cs @@ -262,6 +262,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass return EasyTask.CompletedTask; ; }; await portclient.SetupAsync(new TouchSocketConfig() + .SetMaxBufferSize(1024 * 1024 * 100) .SetSerialPortOption(new SerialPortOption() { BaudRate = BAUD,//波特率 @@ -274,7 +275,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass .ConfigurePlugins(a => { //a.Add(); - })); + } + )); try { await portclient.ConnectAsync(); diff --git a/UserClass/AsyncTcpClient.cs b/UserClass/AsyncTcpClient.cs index f7cb617..645011b 100644 --- a/UserClass/AsyncTcpClient.cs +++ b/UserClass/AsyncTcpClient.cs @@ -383,38 +383,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass //载入配置 await tcpClient.SetupAsync(new TouchSocketConfig() - .SetMaxBufferSize(1024*1024) - .SetMinBufferSize(1024*64) + .SetMaxBufferSize(1024* 1024*100) + .SetMinBufferSize(1024*1024) .SetRemoteIPHost(ip + ":" + port) .ConfigurePlugins(a => { - //触发型重连 - // a.UseTcpReconnection(); //使用Polling轮询连接插件 a.UseTcpReconnection() .UsePolling(TimeSpan.FromSeconds(5)); }) .ConfigureContainer(a => { - // a.AddConsoleLogger();//添加一个日志注入 - })); - // Result result = await - await tcpClient.TryConnectAsync(); - // return result.IsSuccess; - /* try - { - await tcpClient.ConnectAsync();//调用连接,当连接不成功时,会抛出异常。 - return true; - } - catch - { - return false; - }*/ - } + } + )); - + await tcpClient.TryConnectAsync(); + } } } diff --git a/View/MachinesView.xaml.cs b/View/MachinesView.xaml.cs index 12f6370..e758f8f 100644 --- a/View/MachinesView.xaml.cs +++ b/View/MachinesView.xaml.cs @@ -99,7 +99,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View } private void ListViewItem_LOG(object sender, MouseButtonEventArgs e) { - if (LOG_ > 3) { LOG_ = 0; } + if (LOG_ >= 3) { LOG_ = 0; } else { LOG_++; } @@ -108,29 +108,33 @@ namespace SunlightCentralizedControlManagement_SCCM_.View SYS_GRID.Visibility = Visibility.Collapsed; SET_GRID.Visibility = Visibility.Collapsed; view = 3; - + LOG_dataTable.Clear(); Dictionary dat_859 =new Dictionary(); if (LOG_ == 0) { + MAC_name.Text = machine+ "(SERVER)"; dat_859.Add("INSTRUCTION", "SERVER"); dat_859.Add("TIME_S", DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd HH:mm:ss")); dat_859.Add("TIME_E", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")); } else if (LOG_ == 1) { + MAC_name.Text = machine + "(OperationLog)"; dat_859.Add("INSTRUCTION", "OperationLog"); dat_859.Add("TIME_S", DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd HH:mm:ss")); dat_859.Add("TIME_E", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")); } else if (LOG_ == 2) { + MAC_name.Text = machine + "(IOLog)"; dat_859.Add("INSTRUCTION", "IOLog"); dat_859.Add("TIME_S", DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd HH:mm:ss")); dat_859.Add("TIME_E", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")); } else { + MAC_name.Text = machine + "(ERRLog)"; dat_859.Add("INSTRUCTION", "ERRLog"); dat_859.Add("TIME_S", DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd HH:mm:ss")); dat_859.Add("TIME_E", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));