页面逻辑

This commit is contained in:
2026-05-13 11:27:47 +08:00
parent 5056adf38d
commit aa37ab04c7
3 changed files with 63 additions and 13 deletions

View File

@@ -0,0 +1,10 @@
{
"runtimeOptions": {
"tfm": "net10.0",
"framework": {
"name": "Microsoft.WindowsDesktop.App",
"version": "10.0.7"
},
"rollForward": "latestMinor"
}
}

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using static OfficeOpenXml.ExcelErrorValue;
namespace
{
@@ -66,6 +67,9 @@ namespace 头罩视野
public static double zsymjValue { get; set; }
public static double kbsmsyArea { get; set; }
public static string LampValueLeft { get; set; } = "左眼开";
public static string LampValueRight { get; set; } = "右眼开";
}
}
}

View File

@@ -157,15 +157,7 @@ namespace 头罩视野.Views
_isTesting = true;
ButtonTest.Content = "测试中...";
// 2. 清空累加值
//_leftTotalArea = 0;
//_rightTotalArea = 0;
//_binocularTotalArea = 0;
//maxBottomViewAngle = 0;
// 初始化全部设为0
//_leftFinalData = Enumerable.Repeat(0, 240).ToList();
//_rightFinalData = Enumerable.Repeat(0, 240).ToList();
// 面积也清空
@@ -207,7 +199,10 @@ namespace 头罩视野.Views
// 计算视野保存率(双目)根据左右目视野不同,算不同的值
if (_leftFinalData != null && _leftFinalData.Count > 0 && _rightFinalData != null && _rightFinalData.Count > 0)
if (_leftFinalData != null &&
_leftFinalData.Count > 0
&& _rightFinalData != null
&& _rightFinalData.Count > 0&& _leftTotalArea!=0&& _rightTotalArea!=0)
{
// ✅ 传值调用:把左右眼最终数据传给方法
@@ -664,6 +659,17 @@ namespace 头罩视野.Views
//btnRight.Content = "右眼开";
//LedOff(led1);
//LedOff(led0);
//// 2. 清空累加值
_leftTotalArea = 0;
_rightTotalArea = 0;
_binocularTotalArea = 0;
maxBottomViewAngle = 0;
//初始化全部设为0
_leftFinalData = Enumerable.Repeat(0, 240).ToList();
_rightFinalData = Enumerable.Repeat(0, 240).ToList();
DataList.Clear();
ma.BtnClickFunction(Function.ButtonType., 90);
zmsyarea.Text = "0"; // 左目
smsyarea.Text = "0"; // 双目
@@ -698,7 +704,7 @@ namespace 头罩视野.Views
LedOff(led0);
}
ma.BtnClickFunction(Function.ButtonType., 0);
//LedOn(led0);
GlobalData.LampValueLeft = btnLeft.Content.ToString();
}
//右开眼
private void Button_Click_Right(object sender, RoutedEventArgs e)
@@ -725,7 +731,7 @@ namespace 头罩视野.Views
}
ma.BtnClickFunction(Function.ButtonType., 1);
//LedOn(led1);
GlobalData.LampValueLeft = btnLeft.Content.ToString();
}
//反转
@@ -786,8 +792,36 @@ namespace 头罩视野.Views
}
private void GoRecord(object s, RoutedEventArgs e) => NavigationService.Content = new Views.RecordDate();
private void GoView(object s, RoutedEventArgs e) => NavigationService.Content = new Views.RecordPage();
//初始化数据
private async Task InitAllDataAsync()
{
private void Page_Loaded(object sender, RoutedEventArgs e)
//System.Diagnostics.Debug.WriteLine($"数据加载了啊 ");
// 从全局数据读取当前模式
string mode = GlobalData.CurrentMode;
if (mode == "试样测试")
{
TbTest_Unchecked(null, null);
}
else if(mode == "空白测试")
{
TbTest_Checked(null, null);
}
string lightStatusL = GlobalData.LampValueLeft;
string lightStatusR = GlobalData.LampValueRight;
if (lightStatusL == "左眼关")
{
Button_Click_left(null, null);
System.Diagnostics.Debug.WriteLine($"数据加载了啊222");
}
if (lightStatusR == "右眼关")
{
System.Diagnostics.Debug.WriteLine($"数据加载了啊111 ");
Button_Click_Right(null, null);
}
}
private async void Page_Loaded(object sender, RoutedEventArgs e)
{
@@ -801,6 +835,8 @@ namespace 头罩视野.Views
//ymsyarea.Text = "7.00"; // 右目
//xfsyarea.Text = "8.00"; // 下方
//sybhl.Text = "9.00"; // 视野保存率
await InitAllDataAsync();
}
private void Page_Unloaded(object sender, RoutedEventArgs e)
{