页面代码逻辑调整

This commit is contained in:
2026-04-21 10:35:43 +08:00
parent e021559ca9
commit 993f75f292
3 changed files with 41 additions and 5 deletions

View File

@@ -20,9 +20,6 @@ using 头罩视野.Services;
using .Services.Data;
namespace .Views
{
/// <summary>
/// PageTest.xaml 的交互逻辑
/// </summary>
public partial class PageTest : Page
{
@@ -31,16 +28,19 @@ namespace 头罩视野.Views
DispatcherTimer _timer;
DataChange c = new DataChange();
Function ma;
//// 定时采集用
private DispatcherTimer testTimer;
// 保存上一条数据(用于去重)
private TestDataStore.TestRecord _lastRecord;
public PageTest()
{
InitializeComponent();
_timer = InitDispatcherTimer();
// 2. 初始化定时器500毫秒 执行一次
testTimer = new DispatcherTimer();
testTimer.Interval = TimeSpan.FromMilliseconds(500); // 500ms = 0.5秒
testTimer.Tick += Timer_Tick;
@@ -121,7 +121,6 @@ namespace 头罩视野.Views
{
testTimer?.Stop();
}
//停止btn
private void Button_Click_Stop(object sender, RoutedEventArgs e)
{

View File

@@ -85,7 +85,7 @@ namespace 头罩视野.Views
private void Page_Loaded(object sender, RoutedEventArgs e)
{
//进入页面是否要保留原来的数据????,
RecordDataGrid.ItemsSource = null;
RecordDataGrid.ItemsSource = TestDataStore.Records;