91 lines
2.9 KiB
C#
91 lines
2.9 KiB
C#
using Sunny.UI;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Text;
|
||
using System.Windows;
|
||
using System.Windows.Controls;
|
||
using System.Windows.Data;
|
||
using System.Windows.Documents;
|
||
using System.Windows.Input;
|
||
using System.Windows.Media;
|
||
using System.Windows.Media.Imaging;
|
||
using System.Windows.Navigation;
|
||
using System.Windows.Shapes;
|
||
|
||
namespace 头罩视野.Views
|
||
{
|
||
/// <summary>
|
||
/// RecordDate.xaml 的交互逻辑
|
||
/// </summary>
|
||
///
|
||
public class VisionData
|
||
{
|
||
public int Id { get; set; }
|
||
public string Time { get; set; } = string.Empty;
|
||
public string Date { get; set; } = string.Empty;
|
||
public double ChOne { get; set; }
|
||
public double ChTwo { get; set; }
|
||
public double ChThree { get; set; }
|
||
public double ChFour { get; set; }
|
||
public double ChFive { get; set; }
|
||
public double ChSix { get; set; }
|
||
public double ChSeven { get; set; }
|
||
public double ChEight { get; set; }
|
||
}
|
||
public partial class RecordDate : Page
|
||
|
||
{
|
||
public RecordDate()
|
||
{
|
||
InitializeComponent();
|
||
CreateTableData(); // 生成表格
|
||
}
|
||
|
||
// 核心:生成表格数据
|
||
private void CreateTableData()
|
||
{
|
||
// 新建列表
|
||
List<VisionData> list = new List<VisionData>();
|
||
|
||
// 添加测试数据(可循环添加多条)
|
||
list.Add(new VisionData
|
||
{
|
||
Id = 1,
|
||
Time = "10:25:30",
|
||
Date = "2025-12-25",
|
||
ChOne = 66,
|
||
ChTwo = 12,
|
||
ChThree = 67,
|
||
ChFour = 89,
|
||
ChFive = 94,
|
||
ChSix = 87,
|
||
ChSeven = 21,
|
||
ChEight = 55,
|
||
});
|
||
|
||
// 验证:输出列表数据条数(运行后看控制台,确认有2条)
|
||
Console.WriteLine($"数据条数:{list.Count}");
|
||
Console.WriteLine($"数据条数:1111");
|
||
|
||
// ########### 加这行调试输出 ###########
|
||
Console.WriteLine("Hello, World!");
|
||
System.Diagnostics.Debug.WriteLine("页面加载了!112222222");
|
||
|
||
// ####################################
|
||
// 绑定到 DataGrid 显示
|
||
dataGrid1.ItemsSource = list;
|
||
}
|
||
private void btnBack_Click(object sender, RoutedEventArgs e)
|
||
{
|
||
|
||
NavigationService.Content = null;
|
||
}
|
||
private void GoHome(object s, RoutedEventArgs e) => NavigationService.Content = null;
|
||
private void GoTest(object s, RoutedEventArgs e) => NavigationService.Content = new Views.PageTest();
|
||
private void GoRecord(object s, RoutedEventArgs e) => NavigationService.Content = new Views.RecordDate();
|
||
private void GoView(object s, RoutedEventArgs e) => NavigationService.Content = new Views.RecordPage();
|
||
|
||
//NavigationService.Navigate(new Views.RecordDate()); 页面相互跳转
|
||
}
|
||
}
|