This commit is contained in:
GukSang.Jin
2026-03-16 19:58:18 +08:00
parent 88a65233a7
commit 4acf0c7d14
7 changed files with 47 additions and 9 deletions

View File

@@ -29,6 +29,17 @@ namespace 自救器呼吸器综合检验仪
_readTimer = InitDispatcherTimer();
}
private void EnsureWindowedLayout()
{
WindowState = WindowState.Normal;
Width = 1024;
Height = 600;
Rect workArea = SystemParameters.WorkArea;
Left = workArea.Left + (workArea.Width - Width) / 2;
Top = workArea.Top + (workArea.Height - Height) / 2;
}
private DispatcherTimer InitDispatcherTimer()
{
var timer = new DispatcherTimer
@@ -446,6 +457,8 @@ _modbusMaster?.ReadHoldingRegisters(1, 290, 2)
private void Window_Loaded(object sender, RoutedEventArgs e)
{
EnsureWindowedLayout();
string plcIp = "192.168.1.10";
bool initSuccess = Data.ModbusResourceManager.Instance.Init(plcIp, 502);
if (!initSuccess)