页面内容添加
This commit is contained in:
@@ -28,7 +28,7 @@ namespace 头罩视野.Services
|
||||
// 公式:空白 = 标准总面积 - 双目总视野
|
||||
return _standardTotalArea - binocularTotalArea;
|
||||
}
|
||||
|
||||
|
||||
//计算双目视野
|
||||
|
||||
public static double CalculateBinocularArea(
|
||||
|
||||
@@ -18,6 +18,8 @@ namespace 头罩视野
|
||||
//public double BlankArea { get; set; }
|
||||
public double LowerVision { get; set; }
|
||||
public double VisionRetentionRate { get; set; }
|
||||
public double totalVisionArea { get; set; }
|
||||
public double GetVisionRetentionRate { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
</Style>
|
||||
|
||||
<Style x:Key="TextBoxStyle" TargetType="TextBox">
|
||||
<Setter Property="Height" Value="40"/>
|
||||
<Setter Property="Height" Value="35"/>
|
||||
<Setter Property="Width" Value="200"/>
|
||||
<Setter Property="FontSize" Value="18"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
@@ -85,7 +85,7 @@
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<!--<ColumnDefinition Width="Auto"/>-->
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- 测试界面标题 -->
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource MainTitleStyle}" Text="测试界面"
|
||||
@@ -100,9 +100,9 @@
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<!--<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>-->
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Grid.Row="0" Background="#FFFFFF" CornerRadius="10"
|
||||
BorderBrush="#E5E8E8" BorderThickness="1"
|
||||
@@ -183,18 +183,18 @@
|
||||
</Grid>
|
||||
|
||||
<!-- 第三行:视野数据区 -->
|
||||
<Grid Grid.Row="2" Margin="0,0,0,15">
|
||||
<Grid Grid.Row="1" Margin="-2,200,2,41" Grid.RowSpan="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<!--<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>-->
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Grid.Row="0" Grid.Column="0" Background="#FFFFFF" CornerRadius="10"
|
||||
BorderBrush="#E5E8E8" BorderThickness="1"
|
||||
Padding="25,20" Margin="0,0,0,-15" >
|
||||
Padding="25,20" Margin="0,0,447,-32" Grid.ColumnSpan="2" >
|
||||
<StackPanel Cursor="">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,15">
|
||||
<TextBlock Text="左目视野面积:" Style="{StaticResource LabelStyle}" />
|
||||
@@ -213,13 +213,18 @@
|
||||
<TextBox Name="kbsyarea" Text="" Style="{StaticResource TextBoxStyle}"/>
|
||||
<TextBlock Text="cm²" Style="{StaticResource UnitStyle}"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,15,0,0">
|
||||
<TextBlock Text="总视野面积:" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Name="zsyareaNum" Text="" Style="{StaticResource TextBoxStyle}"/>
|
||||
<TextBlock Text="cm²" Style="{StaticResource UnitStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Column="1" Background="#FFFFFF" CornerRadius="10"
|
||||
BorderBrush="#E5E8E8" BorderThickness="1"
|
||||
Padding="25,20" Margin="31,0,19,-15" >
|
||||
Padding="25,20" Margin="422,0,19,-32" >
|
||||
<StackPanel Cursor="">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,15">
|
||||
<TextBlock Text="右目视野面积:" Style="{StaticResource LabelStyle}"/>
|
||||
@@ -238,6 +243,11 @@
|
||||
<TextBox Name="sybhl" Text="" Style="{StaticResource TextBoxStyle}"/>
|
||||
<TextBlock Text="%" Style="{StaticResource UnitStyle}"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,15,0,0">
|
||||
<TextBlock Text="总视野保存率:" Style="{StaticResource LabelStyle}"/>
|
||||
<TextBox Name="zsysaveSum" Text="" Style="{StaticResource TextBoxStyle}"/>
|
||||
<TextBlock Text="%" Style="{StaticResource UnitStyle}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
@@ -259,32 +269,32 @@
|
||||
|
||||
<!-- 复位 -->
|
||||
<Button Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Content="复位" FontSize="18"
|
||||
Width="120" Height="50" Background="#FF87CEFA" Foreground="White" Margin="5" Click="Button_Click_Reset" />
|
||||
Width="120" Height="40" Background="#FF87CEFA" Foreground="White" Margin="5" Click="Button_Click_Reset" />
|
||||
|
||||
<!-- 左眼开 -->
|
||||
<Button Grid.Row="0" Name="btnLeft" Grid.Column="1" Content="左眼开" FontSize="18"
|
||||
Width="120" Height="50" Background="#FF87CEFA" Foreground="White" Margin="5" Click="Button_Click_left" />
|
||||
Width="120" Height="40" Background="#FF87CEFA" Foreground="White" Margin="5" Click="Button_Click_left" />
|
||||
|
||||
<!-- 反转 -->
|
||||
<Button Grid.Row="0" Grid.Column="2" Content="反转" FontSize="18"
|
||||
Width="120" Height="50" Background="#FF87CEFA" Foreground="White" Margin="5" PreviewMouseLeftButtonDown="Button_Click_ResDown"
|
||||
Width="120" Height="40" Background="#FF87CEFA" Foreground="White" Margin="5" PreviewMouseLeftButtonDown="Button_Click_ResDown"
|
||||
PreviewMouseLeftButtonUp="Button_Click_ResUp" />
|
||||
|
||||
<!-- 右眼开 -->
|
||||
<Button Grid.Row="1" Name="btnRight" Grid.Column="1" Content="右眼开" FontSize="18"
|
||||
Width="120" Height="50" Background="#FF87CEFA" Foreground="White" Margin="5" Click="Button_Click_Right" />
|
||||
Width="120" Height="40" Background="#FF87CEFA" Foreground="White" Margin="5" Click="Button_Click_Right" />
|
||||
|
||||
<!-- 正转 -->
|
||||
<Button Grid.Row="1" Grid.Column="2" Content="正转" FontSize="18"
|
||||
Width="120" Height="50" Background="#FF87CEFA" Foreground="White" Margin="5" PreviewMouseLeftButtonDown="Button_Click_ForDown"
|
||||
Width="120" Height="40" Background="#FF87CEFA" Foreground="White" Margin="5" PreviewMouseLeftButtonDown="Button_Click_ForDown"
|
||||
PreviewMouseLeftButtonUp="Button_Click_ForUp" />
|
||||
<!-- 测试 -->
|
||||
<Button Grid.Row="0" Grid.Column="4" Name="ButtonTest" Grid.RowSpan="2" Content="测试" FontSize="18"
|
||||
Width="120" Height="50" Background="LightGray" Foreground="White" Margin="5" Click="Button_Click_Test"/>
|
||||
Width="120" Height="40" Background="LightGray" Foreground="White" Margin="5" Click="Button_Click_Test"/>
|
||||
|
||||
<!-- 停止 -->
|
||||
<Button Grid.Row="0" Grid.Column="5" Grid.RowSpan="2" Content="停止" FontSize="18"
|
||||
Width="120" Height="50" Background="red" Foreground="White" Margin="5" Click="Button_Click_Stop" />
|
||||
Width="120" Height="40" Background="red" Foreground="White" Margin="5" Click="Button_Click_Stop" />
|
||||
</Grid>
|
||||
|
||||
<!-- 底部导航栏 -->
|
||||
|
||||
@@ -206,13 +206,20 @@ namespace 头罩视野.Views
|
||||
{
|
||||
// ✅ 传值调用:把左右眼最终数据传给方法
|
||||
_binocularTotalArea = GetArea.CalculateBinocularArea( _leftFinalData,_rightFinalData, _lightPositions);
|
||||
//= (_leftTotalArea + _rightTotalArea) - congdie;
|
||||
|
||||
// 显示到界面
|
||||
smsyarea.Text =_binocularTotalArea.ToString("0.00");
|
||||
|
||||
// 视野保存率(如果需要)
|
||||
double binocularRateD = GetArea.CalcVisionRate(_binocularTotalArea);
|
||||
sybhl.Text = binocularRateD.ToString("0.0"); // 视野保存率
|
||||
sybhl.Text = binocularRateD.ToString("0.0"); // 左右,双目视野保存率
|
||||
|
||||
|
||||
double zsyareaNumT= (_leftTotalArea + _rightTotalArea) - _binocularTotalArea;
|
||||
zsyareaNum.Text = zsyareaNumT.ToString("0.0");//总视野面积
|
||||
|
||||
double zsysaveSumT= GetArea.CalcVisionRate(zsyareaNumT);
|
||||
zsysaveSum.Text = zsysaveSumT.ToString("0.0");//总视野保存率
|
||||
}
|
||||
|
||||
//if (double.TryParse(smsyarea.Text, out double totalAreaForRate))
|
||||
@@ -385,7 +392,10 @@ namespace 头罩视野.Views
|
||||
RightEyeArea = double.TryParse(ymsyarea.Text, out var r) ? r : 0,
|
||||
BinocularArea = double.TryParse(smsyarea.Text, out var b) ? b : 0,
|
||||
LowerVision = double.TryParse(xfsyarea.Text, out var lv) ? lv : 0,
|
||||
VisionRetentionRate = double.TryParse(sybhl.Text, out var vr) ? vr : 0
|
||||
VisionRetentionRate = double.TryParse(sybhl.Text, out var vr) ? vr : 0,
|
||||
totalVisionArea = double.TryParse(zsyareaNum.Text, out var vrt) ? vrt : 0,
|
||||
GetVisionRetentionRate = double.TryParse(zsysaveSum.Text, out var vrc) ? vrc : 0,
|
||||
|
||||
};
|
||||
|
||||
// ==================== 去重判断 ====================
|
||||
@@ -394,7 +404,9 @@ namespace 头罩视野.Views
|
||||
data.RightEyeArea == _lastRecord.RightEyeArea &&
|
||||
data.BinocularArea == _lastRecord.BinocularArea &&
|
||||
data.LowerVision == _lastRecord.LowerVision &&
|
||||
data.VisionRetentionRate == _lastRecord.VisionRetentionRate)
|
||||
data.VisionRetentionRate == _lastRecord.VisionRetentionRate &&
|
||||
data.totalVisionArea == _lastRecord.totalVisionArea&&
|
||||
data.GetVisionRetentionRate == _lastRecord.GetVisionRetentionRate)
|
||||
{
|
||||
return; // 一样就不添加
|
||||
}
|
||||
@@ -599,6 +611,8 @@ namespace 头罩视野.Views
|
||||
ymsyarea.Text = "0"; // 右目
|
||||
xfsyarea.Text = "0"; // 下方
|
||||
sybhl.Text = "0"; // 视野保存率
|
||||
zsyareaNum.Text = "0";
|
||||
zsysaveSum.Text = "0";
|
||||
}
|
||||
//左开眼
|
||||
private void Button_Click_left(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -151,14 +151,16 @@
|
||||
|
||||
<!-- 表格列(你要的 6 列) -->
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="编号" Binding="{Binding Id}" Width="80" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="编号" Binding="{Binding Id}" Width="70" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="时间" Binding="{Binding Time}" Width="120" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="日期" Binding="{Binding Date}" Width="120" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="左目视野面积" Binding="{Binding LeftEyeArea,StringFormat=F2}" Width="*" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="右目视野面积" Binding="{Binding RightEyeArea,StringFormat=F2}" Width="*" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="双目视野面积" Binding="{Binding BinocularArea,StringFormat=F2}" Width="*" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="下方视野" Binding="{Binding LowerVision,StringFormat=F2}" Width="*" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="视野保存率" Binding="{Binding VisionRetentionRate,StringFormat=F2}" Width="*" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="左目视野面积" Binding="{Binding LeftEyeArea,StringFormat=F2}" Width="130" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="右目视野面积" Binding="{Binding RightEyeArea,StringFormat=F2}" Width="130" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="双目视野面积" Binding="{Binding BinocularArea,StringFormat=F2}" Width="130" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="下方视野" Binding="{Binding LowerVision,StringFormat=F2}" Width="130" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="视野保存率" Binding="{Binding VisionRetentionRate,StringFormat=F2}" Width="130" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="总视野面积" Binding="{Binding totalVisionArea,StringFormat=F2}" Width="130" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="总视野保存率" Binding="{Binding GetVisionRetentionRate,StringFormat=F2}" Width="130" IsReadOnly="True"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
|
||||
Reference in New Issue
Block a user