Merge branch 'master' of http://192.168.0.12:13000/sc/SunlightAggregationTerminal
This commit is contained in:
commit
ee00cfd25f
6 files changed
+209
-36
No files matched your search
+14
-9
@@ -69,11 +69,11 @@ namespace SunlightAggregationTerminal.Class
|
||||
#region Tcp客户端使用Received异步委托接收数据
|
||||
tcpClient.Received = (client, e) =>
|
||||
{
|
||||
//从服务器收到信息。但是一般byteBlock和requestInfo会根据适配器呈现不同的值。
|
||||
var mes = e.Memory.Span.ToString(Encoding.UTF8);
|
||||
//从服务器收到信息。但是一般byteBlock和requestInfo会根据适配器呈现不同的值。
|
||||
var mes = e.Memory.Span.ToString(Encoding.UTF8);
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
var data = JsonSerializer.Deserialize<Dictionary<string, object>>(mes);
|
||||
|
||||
if (data != null)
|
||||
@@ -95,7 +95,11 @@ namespace SunlightAggregationTerminal.Class
|
||||
}
|
||||
|
||||
|
||||
if (data.TryGetValue("Notification", out val) && val != null)//信息接受
|
||||
if (data.TryGetValue("Query", out val) && val != null)//查询接受
|
||||
{
|
||||
QueryPage.Query_data(val.ToString()!);
|
||||
}
|
||||
if (data.TryGetValue("Notification", out val) && val != null)//信息通知接受
|
||||
{
|
||||
var dataNotification = JsonSerializer.Deserialize<Dictionary<string, object>>(val.ToString()!);
|
||||
|
||||
@@ -126,20 +130,21 @@ namespace SunlightAggregationTerminal.Class
|
||||
_Title + "','" + _Content + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "','" + _Type + "');");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception) { }
|
||||
|
||||
|
||||
return EasyTask.CompletedTask;
|
||||
};
|
||||
#endregion
|
||||
|
||||
try
|
||||
{
|
||||
await tcpClient.SetupAsync(new TouchSocketConfig()
|
||||
.SetRemoteIPHost(ip));
|
||||
await tcpClient.SetupAsync(new TouchSocketConfig()
|
||||
.SetRemoteIPHost(ip));
|
||||
await tcpClient.ConnectAsync();//调用连接,当连接不成功时,会抛出异常。
|
||||
} catch (Exception)
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
await Application.Current!.Windows[0].Page!.DisplayAlertAsync("错误", "不合法的访问地址", "是");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user