2026-03-11 16:42:31 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
|
|
|
|
|
|
|
namespace PLCDataMonitor
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class HomePage : UserControl
|
|
|
|
|
|
{
|
|
|
|
|
|
// 定义事件用于与主窗口通信
|
|
|
|
|
|
public event EventHandler<string> ConnectButtonClicked;
|
|
|
|
|
|
|
|
|
|
|
|
public HomePage()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-11 19:11:06 +08:00
|
|
|
|
|
|
|
|
|
|
// 定义暂停/继续事件
|
|
|
|
|
|
public event EventHandler PauseRequested;
|
|
|
|
|
|
public event EventHandler ResumeRequested;
|
|
|
|
|
|
|
|
|
|
|
|
private void PauseButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
PauseRequested?.Invoke(this, EventArgs.Empty);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void ResumeButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
ResumeRequested?.Invoke(this, EventArgs.Empty);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-21 11:15:47 +08:00
|
|
|
|
public void UpdateAlarms(string alarmMessage)
|
|
|
|
|
|
{
|
2026-03-23 17:31:25 +08:00
|
|
|
|
|
|
|
|
|
|
Dispatcher.Invoke(() => // 更新滚动报警控件的文本
|
|
|
|
|
|
AlarmScrollingCtrl.Text = alarmMessage);
|
2026-03-21 11:15:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-11 16:42:31 +08:00
|
|
|
|
// 更新数据显示
|
|
|
|
|
|
public void UpdateData(string pressure1, string pressure2, string friction1, string friction2, int count1, int count2, string t1, string t2, string Distince)
|
|
|
|
|
|
{
|
|
|
|
|
|
TbStation1Pressure.Text = pressure1;
|
|
|
|
|
|
TbStation2Pressure.Text = pressure2;
|
|
|
|
|
|
TbFriction1.Text = friction1;
|
|
|
|
|
|
TbFriction2.Text = friction2;
|
|
|
|
|
|
txtcount1.Text = count1.ToString();
|
|
|
|
|
|
txtcount2.Text = count2.ToString();
|
|
|
|
|
|
|
|
|
|
|
|
txtT1.Text = t1;
|
|
|
|
|
|
txtT2.Text = t2;
|
|
|
|
|
|
txtDistince.Text = Distince;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|