mirror of
https://gitee.com/ThingsGateway/ThingsGateway.git
synced 2025-10-20 18:51:28 +08:00
代码清理
This commit is contained in:
2
Admin
2
Admin
Submodule Admin updated: 22af559418...273310cba0
@@ -1,8 +1,8 @@
|
||||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<PluginVersion>9.0.2.63</PluginVersion>
|
||||
<ProPluginVersion>9.0.2.82</ProPluginVersion>
|
||||
<PluginVersion>9.0.2.64</PluginVersion>
|
||||
<ProPluginVersion>9.0.2.83</ProPluginVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
@@ -102,7 +102,7 @@ public abstract class VariableObject
|
||||
throw new ArgumentException("Can only access properties");
|
||||
}
|
||||
// 从字典中获取与属性对应的变量信息
|
||||
if (!this.VariableRuntimePropertyDict.TryGetValue(memberExpression.Member.Name, out var variable))
|
||||
if (!VariableRuntimePropertyDict.TryGetValue(memberExpression.Member.Name, out var variable))
|
||||
{
|
||||
throw new KeyNotFoundException($"Variable for {memberExpression.Member.Name} not found.");
|
||||
}
|
||||
|
@@ -116,19 +116,19 @@ public class ChannelData
|
||||
switch (channelData.ChannelType)
|
||||
{
|
||||
case ChannelTypeEnum.TcpClient:
|
||||
channelData.Channel =await channelData.TouchSocketConfig.GetTcpClientWithIPHostAsync(channelData.RemoteUrl, channelData.BindUrl).ConfigureAwait(false);
|
||||
channelData.Channel = await channelData.TouchSocketConfig.GetTcpClientWithIPHostAsync(channelData.RemoteUrl, channelData.BindUrl).ConfigureAwait(false);
|
||||
break;
|
||||
|
||||
case ChannelTypeEnum.TcpService:
|
||||
channelData.Channel =await channelData.TouchSocketConfig.GetTcpServiceWithBindIPHostAsync(channelData.BindUrl).ConfigureAwait(false);
|
||||
channelData.Channel = await channelData.TouchSocketConfig.GetTcpServiceWithBindIPHostAsync(channelData.BindUrl).ConfigureAwait(false);
|
||||
break;
|
||||
|
||||
case ChannelTypeEnum.SerialPort:
|
||||
channelData.Channel =await channelData.TouchSocketConfig.GetSerialPortWithOptionAsync(channelData.Map<SerialPortOption>()).ConfigureAwait(false);
|
||||
channelData.Channel = await channelData.TouchSocketConfig.GetSerialPortWithOptionAsync(channelData.Map<SerialPortOption>()).ConfigureAwait(false);
|
||||
break;
|
||||
|
||||
case ChannelTypeEnum.UdpSession:
|
||||
channelData.Channel =await channelData.TouchSocketConfig.GetUdpSessionWithIPHostAsync(channelData.RemoteUrl, channelData.BindUrl).ConfigureAwait(false);
|
||||
channelData.Channel = await channelData.TouchSocketConfig.GetUdpSessionWithIPHostAsync(channelData.RemoteUrl, channelData.BindUrl).ConfigureAwait(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -21,5 +21,5 @@ public interface IDtu : ITcpService
|
||||
/// <summary>
|
||||
/// 默认Dtu注册包,utf-8字符串
|
||||
/// </summary>
|
||||
public string DtuId { get; set; }
|
||||
public string DtuId { get; set; }
|
||||
}
|
||||
|
@@ -118,7 +118,7 @@ public class SerialPortChannel : SerialPortClient, IClientChannel
|
||||
/// <inheritdoc/>
|
||||
public override string? ToString()
|
||||
{
|
||||
var port = this.Config?.GetValue(SerialPortConfigExtension.SerialPortOptionProperty);
|
||||
var port = Config?.GetValue(SerialPortConfigExtension.SerialPortOptionProperty);
|
||||
if (port != null)
|
||||
return $"{port.PortName}[{port.BaudRate},{port.DataBits},{port.StopBits},{port.Parity}]";
|
||||
return base.ToString();
|
||||
|
@@ -22,7 +22,7 @@ public class TcpClientChannel : TcpClient, IClientChannel
|
||||
{
|
||||
WaitHandlePool.MaxSign = ushort.MaxValue;
|
||||
}
|
||||
public int MaxSign { get => WaitHandlePool.MaxSign; set => WaitHandlePool.MaxSign = value; }
|
||||
public int MaxSign { get => WaitHandlePool.MaxSign; set => WaitHandlePool.MaxSign = value; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public ChannelReceivedEventHandler ChannelReceived { get; set; } = new();
|
||||
|
@@ -62,7 +62,7 @@ public abstract class BusinessBaseWithCacheIntervalAlarmModel<VarModel, DevModel
|
||||
GlobalData.DeviceStatusChangeEvent -= DeviceStatusChange;
|
||||
|
||||
// 根据业务属性的缓存是否为间隔上传来决定事件绑定
|
||||
if (_businessPropertyWithCacheInterval.BusinessUpdateEnum!= BusinessUpdateEnum.Interval)
|
||||
if (_businessPropertyWithCacheInterval.BusinessUpdateEnum != BusinessUpdateEnum.Interval)
|
||||
{
|
||||
// 绑定全局数据的事件
|
||||
GlobalData.DeviceStatusChangeEvent += DeviceStatusChange;
|
||||
|
@@ -66,11 +66,11 @@ public abstract class BusinessBaseWithCacheIntervalDeviceModel<VarModel, DevMode
|
||||
GlobalData.DeviceStatusChangeEvent -= DeviceStatusChange;
|
||||
|
||||
// 如果不是间隔上传,则订阅全局变量值改变事件和设备状态改变事件,并触发一次事件处理
|
||||
if (_businessPropertyWithCacheInterval.BusinessUpdateEnum!= BusinessUpdateEnum.Interval)
|
||||
if (_businessPropertyWithCacheInterval.BusinessUpdateEnum != BusinessUpdateEnum.Interval)
|
||||
{
|
||||
GlobalData.DeviceStatusChangeEvent += DeviceStatusChange;
|
||||
GlobalData.VariableValueChangeEvent += VariableValueChange;
|
||||
|
||||
|
||||
}
|
||||
CollectDevices.ForEach(a =>
|
||||
{
|
||||
@@ -134,7 +134,7 @@ public abstract class BusinessBaseWithCacheIntervalDeviceModel<VarModel, DevMode
|
||||
}
|
||||
|
||||
// 如果是间隔上传,根据定时器触发事件上传设备和变量信息
|
||||
if (_businessPropertyWithCacheInterval.BusinessUpdateEnum!= BusinessUpdateEnum.Change)
|
||||
if (_businessPropertyWithCacheInterval.BusinessUpdateEnum != BusinessUpdateEnum.Change)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@@ -60,10 +60,10 @@ public abstract class BusinessBaseWithCacheIntervalVariableModel<T> : BusinessBa
|
||||
|
||||
// 注册变量值变化事件处理程序
|
||||
GlobalData.VariableValueChangeEvent -= VariableValueChange;
|
||||
if (_businessPropertyWithCacheInterval.BusinessUpdateEnum!= BusinessUpdateEnum.Interval)
|
||||
if (_businessPropertyWithCacheInterval.BusinessUpdateEnum != BusinessUpdateEnum.Interval)
|
||||
{
|
||||
GlobalData.VariableValueChangeEvent += VariableValueChange;
|
||||
|
||||
|
||||
}
|
||||
// 触发一次变量值变化事件
|
||||
CurrentDevice.VariableRunTimes.ForEach(a =>
|
||||
|
@@ -81,7 +81,7 @@ public interface IVariableService
|
||||
/// <summary>
|
||||
/// 创建n个modbus变量
|
||||
/// </summary>
|
||||
Task InsertTestDataAsync(int variableCount, int deviceCount,string slaveUrl="127.0.0.1:502");
|
||||
Task InsertTestDataAsync(int variableCount, int deviceCount, string slaveUrl = "127.0.0.1:502");
|
||||
|
||||
/// <summary>
|
||||
/// 表格查询
|
||||
|
@@ -318,7 +318,7 @@ public partial class VariablePage : IDisposable
|
||||
{
|
||||
await Task.Run(async () =>
|
||||
{
|
||||
await VariableService.InsertTestDataAsync(TestVariableCount,TestDeviceCount, SlaveUrl);
|
||||
await VariableService.InsertTestDataAsync(TestVariableCount, TestDeviceCount, SlaveUrl);
|
||||
await InvokeAsync(async () =>
|
||||
{
|
||||
await ToastService.Default();
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>7.2.0.93</Version>
|
||||
<Version>7.2.0.94</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
Reference in New Issue
Block a user