This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
using Sunny.UI;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using TabletTester2025.Services;
|
using TabletTester2025.Services;
|
||||||
|
using static OfficeOpenXml.ExcelErrorValue;
|
||||||
|
|
||||||
namespace 片剂四用仪.Views
|
namespace 片剂四用仪.Views
|
||||||
{
|
{
|
||||||
@@ -99,16 +101,21 @@ namespace 片剂四用仪.Views
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (float.TryParse(tb.Text, out float val))
|
if (double.TryParse(tb.Text, out double val))
|
||||||
{
|
{
|
||||||
byte[] bytes = BitConverter.GetBytes(val);
|
byte[] bytes = BitConverter.GetBytes(val);
|
||||||
ushort[] regs = new ushort[2];
|
ushort[] regs = new ushort[2];
|
||||||
regs[0] = (ushort)(BitConverter.ToUInt16(bytes, 2));
|
regs[0] = (ushort)(BitConverter.ToUInt16(bytes, 2));
|
||||||
regs[1] = (ushort)(BitConverter.ToUInt16(bytes, 0));
|
regs[1] = (ushort)(BitConverter.ToUInt16(bytes, 0));
|
||||||
|
|
||||||
|
if (UIInputDialog.ShowInputDoubleDialog(ref val, UIStyle.Inherited, 3, desc: "请输入值", showMask: false))
|
||||||
|
{
|
||||||
|
|
||||||
await _plc.WriteRegisterAsync((ushort)m.Address, (ushort)val);
|
await _plc.WriteRegisterAsync((ushort)m.Address, (ushort)val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch { }
|
catch { }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.7" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.7" />
|
||||||
<PackageReference Include="NModbus4.NetCore" Version="4.0.0" />
|
<PackageReference Include="NModbus4.NetCore" Version="4.0.0" />
|
||||||
<PackageReference Include="OxyPlot.Wpf" Version="2.2.0" />
|
<PackageReference Include="OxyPlot.Wpf" Version="2.2.0" />
|
||||||
|
<PackageReference Include="SunnyUI" Version="3.9.7" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user