This commit is contained in:
2026-04-21 13:36:09 +08:00
parent 68959ce119
commit 54c92d9644
11 changed files with 81 additions and 523 deletions

View File

@@ -45,6 +45,18 @@ namespace 头罩视野.Views
testTimer.Interval = TimeSpan.FromMilliseconds(500); // 500ms = 0.5秒
testTimer.Tick += Timer_Tick;
//// 判断连接
if (!ModbusHelper.IsConnected)
{
MessageBox.Show("未连接");
return;
}
// 获取客户端
var client = ModbusHelper.TcpClient;
}
//复位btn
@@ -346,6 +358,8 @@ namespace 头罩视野.Views
_timer.Start();
ma = new Function(_modbusMaster);
c = new DataChange();
}
}
}

View File

@@ -85,10 +85,20 @@ namespace 头罩视野.Views
private void Page_Loaded(object sender, RoutedEventArgs e)
{
//进入页面是否要保留原来的数据????,
// 判断连接
if (!ModbusHelper.IsConnected)
{
MessageBox.Show("未连接");
return;
}
// 获取客户端
var client = ModbusHelper.TcpClient;
//进入页面是否要保留原来的数据????,
RecordDataGrid.ItemsSource = null;
RecordDataGrid.ItemsSource = TestDataStore.Records;
}
private void GoHome(object s, RoutedEventArgs e) => NavigationService.Content = null;

View File

@@ -31,6 +31,17 @@ namespace 头罩视野.Views
InitializeComponent();
_timer = InitDispatcherTimer();
// 判断连接
if (!ModbusHelper.IsConnected)
{
MessageBox.Show("未连接");
return;
}
// 获取客户端
var client = ModbusHelper.TcpClient;
}
//复位btn
private void Button_Click_Reset(object sender, RoutedEventArgs e)
@@ -251,6 +262,8 @@ namespace 头罩视野.Views
private void Page_Loaded(object sender, RoutedEventArgs e)
{
_timer.Start();
ma = new Function(_modbusMaster);