From 5142b68300e78e788094ea3203d4701c715ff32d Mon Sep 17 00:00:00 2001 From: xyy <544939200@qq.com> Date: Fri, 15 May 2026 16:13:45 +0800 Subject: [PATCH] --- Views/ShowData.xaml.cs | 11 +++++++++-- 片剂四用仪.csproj | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Views/ShowData.xaml.cs b/Views/ShowData.xaml.cs index 6ee800a..a570ef1 100644 --- a/Views/ShowData.xaml.cs +++ b/Views/ShowData.xaml.cs @@ -1,10 +1,12 @@ using Microsoft.Win32; +using Sunny.UI; using System; using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using TabletTester2025.Services; +using static OfficeOpenXml.ExcelErrorValue; namespace 片剂四用仪.Views { @@ -99,13 +101,18 @@ namespace 片剂四用仪.Views } else { - if (float.TryParse(tb.Text, out float val)) + if (double.TryParse(tb.Text, out double val)) { byte[] bytes = BitConverter.GetBytes(val); ushort[] regs = new ushort[2]; regs[0] = (ushort)(BitConverter.ToUInt16(bytes, 2)); regs[1] = (ushort)(BitConverter.ToUInt16(bytes, 0)); - await _plc.WriteRegisterAsync((ushort)m.Address, (ushort)val); + + if (UIInputDialog.ShowInputDoubleDialog(ref val, UIStyle.Inherited, 3, desc: "请输入值", showMask: false)) + { + + await _plc.WriteRegisterAsync((ushort)m.Address, (ushort)val); + } } } } diff --git a/片剂四用仪.csproj b/片剂四用仪.csproj index 181dd67..2e559c3 100644 --- a/片剂四用仪.csproj +++ b/片剂四用仪.csproj @@ -17,6 +17,7 @@ +