308 lines
16 KiB
XML
308 lines
16 KiB
XML
<Page x:Class="头罩视野.Views.PageTest"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
mc:Ignorable="d"
|
|
Background="#F0F2F5"
|
|
d:DesignHeight="768" d:DesignWidth="1024"
|
|
Title="PageTest" Loaded="Page_Loaded" Unloaded="Page_Unloaded">
|
|
|
|
<Page.Resources>
|
|
<!-- 全局字体 -->
|
|
<FontFamily x:Key="DefaultFont">Segoe UI, Microsoft YaHei</FontFamily>
|
|
|
|
<!-- 标题样式 -->
|
|
<Style x:Key="MainTitleStyle" TargetType="TextBlock">
|
|
<Setter Property="FontFamily" Value="{StaticResource DefaultFont}"/>
|
|
<Setter Property="FontSize" Value="26"/>
|
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
|
<Setter Property="Foreground" Value="#2C3E50"/>
|
|
<Setter Property="HorizontalAlignment" Value="Center"/>
|
|
<Setter Property="Margin" Value="0,15,0,15"/>
|
|
</Style>
|
|
|
|
<!-- 标签样式 -->
|
|
<Style x:Key="LabelStyle" TargetType="TextBlock">
|
|
<Setter Property="FontFamily" Value="{StaticResource DefaultFont}"/>
|
|
<Setter Property="FontSize" Value="15"/>
|
|
<Setter Property="Foreground" Value="#5D6D7E"/>
|
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
|
<Setter Property="Margin" Value="0,0,12,0"/>
|
|
<Setter Property="Width" Value="110"/>
|
|
</Style>
|
|
|
|
<!-- 单位样式 -->
|
|
<Style x:Key="UnitStyle" TargetType="TextBlock">
|
|
<Setter Property="FontFamily" Value="{StaticResource DefaultFont}"/>
|
|
<Setter Property="FontSize" Value="13"/>
|
|
<Setter Property="Foreground" Value="#7F8C8D"/>
|
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
|
<Setter Property="Margin" Value="8,0,0,0"/>
|
|
<Setter Property="FontStyle" Value="Italic"/>
|
|
</Style>
|
|
|
|
<!-- 文本框样式 -->
|
|
<Style x:Key="TextBoxStyle" TargetType="TextBox">
|
|
<Setter Property="Height" Value="34"/>
|
|
<Setter Property="Width" Value="180"/>
|
|
<Setter Property="FontSize" Value="16"/>
|
|
<Setter Property="TextAlignment" Value="Center"/>
|
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
|
<Setter Property="BorderBrush" Value="#BDC3C7"/>
|
|
<Setter Property="BorderThickness" Value="1"/>
|
|
<Setter Property="Background" Value="#FFFFFF"/>
|
|
<Setter Property="Foreground" Value="#2C3E50"/>
|
|
<Setter Property="Padding" Value="6,2"/>
|
|
<Style.Triggers>
|
|
<Trigger Property="IsFocused" Value="True">
|
|
<Setter Property="BorderBrush" Value="#3498DB"/>
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
<!-- 卡片样式(带阴影) -->
|
|
<Style x:Key="CardStyle" TargetType="Border">
|
|
<Setter Property="Background" Value="#FFFFFF"/>
|
|
<Setter Property="CornerRadius" Value="8"/>
|
|
<Setter Property="Effect">
|
|
<Setter.Value>
|
|
<DropShadowEffect BlurRadius="12" ShadowDepth="2" Opacity="0.1" Color="#000000"/>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<!-- 底部导航按钮样式 -->
|
|
<Style x:Key="TabButtonStyle" TargetType="Button">
|
|
<Setter Property="Background" Value="#2C3E50"/>
|
|
<Setter Property="FontFamily" Value="{StaticResource DefaultFont}"/>
|
|
<Setter Property="FontSize" Value="18"/>
|
|
<Setter Property="Foreground" Value="#ECF0F1"/>
|
|
<Setter Property="Height" Value="52"/>
|
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
|
<Setter Property="BorderBrush" Value="#34495E"/>
|
|
<Setter Property="BorderThickness" Value="0,1,0,0"/>
|
|
<Setter Property="Cursor" Value="Hand"/>
|
|
<Style.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="Background" Value="#34495E"/>
|
|
<Setter Property="Foreground" Value="#FFFFFF"/>
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
<!-- 控制按钮样式 -->
|
|
<Style x:Key="CtrlButtonStyle" TargetType="Button">
|
|
<Setter Property="Height" Value="36"/>
|
|
<Setter Property="Width" Value="110"/>
|
|
<Setter Property="FontSize" Value="15"/>
|
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
|
<Setter Property="Foreground" Value="White"/>
|
|
<Setter Property="Cursor" Value="Hand"/>
|
|
<Setter Property="BorderThickness" Value="0"/>
|
|
<Style.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="Opacity" Value="0.85"/>
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</Page.Resources>
|
|
|
|
<Grid Margin="20,0,20,10">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<!-- 0: 标题 -->
|
|
<RowDefinition Height="Auto"/>
|
|
<!-- 1: 参数区 -->
|
|
<RowDefinition Height="Auto"/>
|
|
<!-- 2: 数据区 -->
|
|
<RowDefinition Height="Auto"/>
|
|
<!-- 3: 控制按钮区 -->
|
|
<RowDefinition Height="*"/>
|
|
<!-- 4: 弹性空间(将导航栏推到底部) -->
|
|
<RowDefinition Height="Auto"/>
|
|
<!-- 5: 底部导航栏 -->
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- 顶部标题栏 -->
|
|
<Grid Grid.Row="0" Margin="0,0,0,10">
|
|
<TextBlock Style="{StaticResource MainTitleStyle}" Text="头罩视野测试系统" HorizontalAlignment="Center"/>
|
|
</Grid>
|
|
|
|
<!-- 第二行:参数显示区(卡片式) -->
|
|
<Border Grid.Row="1" Style="{StaticResource CardStyle}" Padding="20,15" Margin="0,0,0,20">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<!-- 左侧参数组 -->
|
|
<StackPanel Orientation="Horizontal" Grid.Column="0">
|
|
<StackPanel Orientation="Horizontal" Margin="0,0,30,0">
|
|
<TextBlock Text="分辨角度:" Style="{StaticResource LabelStyle}"/>
|
|
<TextBox Name="fbspeed" Text="" Style="{StaticResource TextBoxStyle}" GotFocus="fbspeed_GotFocus"/>
|
|
<TextBlock Text="°" Style="{StaticResource UnitStyle}"/>
|
|
</StackPanel>
|
|
<StackPanel Orientation="Horizontal" Margin="0,0,30,0">
|
|
<TextBlock Text="当前角度:" Style="{StaticResource LabelStyle}"/>
|
|
<TextBox Name="dqangle" Text="" Style="{StaticResource TextBoxStyle}" GotFocus="dqangle_GotFocus"/>
|
|
<TextBlock Text="°" Style="{StaticResource UnitStyle}"/>
|
|
</StackPanel>
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock Text="转动速度:" Style="{StaticResource LabelStyle}"/>
|
|
<TextBox Name="zdangle" Text="" Style="{StaticResource TextBoxStyle}" GotFocus="zdangle_GotFocus"/>
|
|
<TextBlock Text="°/s" Style="{StaticResource UnitStyle}"/>
|
|
</StackPanel>
|
|
</StackPanel>
|
|
|
|
<!-- 右侧:模式切换 + 指示灯 -->
|
|
<StackPanel Grid.Column="3" Orientation="Horizontal" VerticalAlignment="Center">
|
|
<ToggleButton x:Name="tbTest" FontSize="14" Width="100" Height="30"
|
|
Background="#E0E0E0" Margin="0,0,15,0"
|
|
Checked="TbTest_Checked" Unchecked="TbTest_Unchecked">
|
|
<ToggleButton.Template>
|
|
<ControlTemplate TargetType="ToggleButton">
|
|
<Border x:Name="border" CornerRadius="4" Background="{TemplateBinding Background}" BorderThickness="0">
|
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsChecked" Value="True">
|
|
<Setter TargetName="border" Property="Background" Value="#3A6B4B"/>
|
|
<Setter Property="Foreground" Value="White"/>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</ToggleButton.Template>
|
|
空白测试
|
|
</ToggleButton>
|
|
<TextBlock Text="当前模式:" VerticalAlignment="Center" Margin="0,0,8,0" FontSize="14" Foreground="#5D6D7E"/>
|
|
<TextBlock x:Name="当前模式" Text="空白测试" VerticalAlignment="Center" FontSize="14" FontWeight="Bold" Foreground="#3A6B4B"/>
|
|
<StackPanel Orientation="Horizontal" Margin="20,0,0,0">
|
|
<Ellipse x:Name="led0" Width="20" Height="20" Fill="LightGray" Stroke="#BDC3C7" Margin="5"/>
|
|
<Ellipse x:Name="led1" Width="20" Height="20" Fill="LightGray" Stroke="#BDC3C7" Margin="5"/>
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</Grid>
|
|
</Border>
|
|
|
|
<!-- 第三行:视野数据区(两列卡片) -->
|
|
<Grid Grid.Row="2" Margin="0,0,0,20">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<!-- 左眼及综合数据卡片 -->
|
|
<Border Grid.Column="0" Style="{StaticResource CardStyle}" Padding="25,20" Margin="0,0,10,0">
|
|
<StackPanel>
|
|
<StackPanel Orientation="Horizontal" Margin="0,0,0,18">
|
|
<TextBlock Text="左目视野面积:" Style="{StaticResource LabelStyle}" Width="120"/>
|
|
<TextBox Name="zmsyarea" Text="" Style="{StaticResource TextBoxStyle}"/>
|
|
<TextBlock Text="cm²" Style="{StaticResource UnitStyle}"/>
|
|
</StackPanel>
|
|
<StackPanel Orientation="Horizontal" Margin="0,0,0,18">
|
|
<TextBlock Text="双目视野面积:" Style="{StaticResource LabelStyle}" Width="120"/>
|
|
<TextBox Name="smsyarea" Text="" Style="{StaticResource TextBoxStyle}"/>
|
|
<TextBlock Text="cm²" Style="{StaticResource UnitStyle}"/>
|
|
</StackPanel>
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock Text="总视野面积:" Style="{StaticResource LabelStyle}" Width="120"/>
|
|
<TextBox Name="zsyareaNum" Text="" Style="{StaticResource TextBoxStyle}"/>
|
|
<TextBlock Text="cm²" Style="{StaticResource UnitStyle}"/>
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- 右眼及保存率卡片 -->
|
|
<Border Grid.Column="1" Style="{StaticResource CardStyle}" Padding="25,20" Margin="10,0,0,0">
|
|
<StackPanel>
|
|
<StackPanel Orientation="Horizontal" Margin="0,0,0,18">
|
|
<TextBlock Text="右目视野面积:" Style="{StaticResource LabelStyle}" Width="120"/>
|
|
<TextBox Name="ymsyarea" Text="" Style="{StaticResource TextBoxStyle}"/>
|
|
<TextBlock Text="cm²" Style="{StaticResource UnitStyle}"/>
|
|
</StackPanel>
|
|
<StackPanel Orientation="Horizontal" Margin="0,0,0,18">
|
|
<TextBlock Text="下方视野:" Style="{StaticResource LabelStyle}" Width="120"/>
|
|
<TextBox Name="xfsyarea" Text="" Style="{StaticResource TextBoxStyle}"/>
|
|
<TextBlock Text="°" Style="{StaticResource UnitStyle}"/>
|
|
</StackPanel>
|
|
<StackPanel Orientation="Horizontal" Margin="0,0,0,18">
|
|
<TextBlock Text="双目视野保存率:" Style="{StaticResource LabelStyle}" Width="120"/>
|
|
<TextBox Name="sybhl" Text="" Style="{StaticResource TextBoxStyle}"/>
|
|
<TextBlock Text="%" Style="{StaticResource UnitStyle}"/>
|
|
</StackPanel>
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock Text="总视野保存率:" Style="{StaticResource LabelStyle}" Width="120"/>
|
|
<TextBox Name="zsysaveSum" Text="" Style="{StaticResource TextBoxStyle}"/>
|
|
<TextBlock Text="%" Style="{StaticResource UnitStyle}"/>
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</Border>
|
|
</Grid>
|
|
|
|
<!-- 第四行:控制按钮区 -->
|
|
<Grid Grid.Row="3" Margin="0,0,0,20">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- 复位 -->
|
|
<Button Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Content="复位"
|
|
Style="{StaticResource CtrlButtonStyle}" Background="#4A6D8C" Margin="5" Click="Button_Click_Reset"/>
|
|
|
|
<!-- 左眼开 -->
|
|
<Button Grid.Row="0" Name="btnLeft" Grid.Column="1" Content="左眼开"
|
|
Style="{StaticResource CtrlButtonStyle}" Background="#4A6D8C" Margin="5" Click="Button_Click_left"/>
|
|
|
|
<!-- 反转(按下/弹起) -->
|
|
<Button Grid.Row="0" Grid.Column="2" Content="反转"
|
|
Style="{StaticResource CtrlButtonStyle}" Background="#4A6D8C" Margin="5"
|
|
PreviewMouseLeftButtonDown="Button_Click_ResDown" PreviewMouseLeftButtonUp="Button_Click_ResUp"/>
|
|
|
|
<!-- 右眼开 -->
|
|
<Button Grid.Row="1" Name="btnRight" Grid.Column="1" Content="右眼开"
|
|
Style="{StaticResource CtrlButtonStyle}" Background="#4A6D8C" Margin="5" Click="Button_Click_Right"/>
|
|
|
|
<!-- 正转(按下/弹起) -->
|
|
<Button Grid.Row="1" Grid.Column="2" Content="正转"
|
|
Style="{StaticResource CtrlButtonStyle}" Background="#4A6D8C" Margin="5"
|
|
PreviewMouseLeftButtonDown="Button_Click_ForDown" PreviewMouseLeftButtonUp="Button_Click_ForUp"/>
|
|
|
|
<!-- 测试 -->
|
|
<Button Grid.Row="0" Grid.Column="4" Name="ButtonTest" Grid.RowSpan="2" Content="测试"
|
|
Style="{StaticResource CtrlButtonStyle}" Background="#27AE60" Margin="5" Click="Button_Click_Test"/>
|
|
|
|
<!-- 停止 -->
|
|
<Button Grid.Row="0" Grid.Column="5" Grid.RowSpan="2" Content="停止"
|
|
Style="{StaticResource CtrlButtonStyle}" Background="#E74C3C" Margin="5" Click="Button_Click_Stop"/>
|
|
</Grid>
|
|
|
|
<!-- 第五行:弹性空间(占据剩余高度,将底部导航栏推到窗口底部) -->
|
|
<Grid Grid.Row="4" Background="Transparent"/>
|
|
|
|
<!-- 底部导航栏(固定在窗口最底部) -->
|
|
<Grid Grid.Row="5" VerticalAlignment="Bottom">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Button Style="{StaticResource TabButtonStyle}" Grid.Column="0" Content="主页" Click="GoHome"/>
|
|
<Button Style="{StaticResource TabButtonStyle}" Grid.Column="1" Content="测试界面" Click="GoTest"/>
|
|
<Button Style="{StaticResource TabButtonStyle}" Grid.Column="2" Content="记录画面" Click="GoView"/>
|
|
</Grid>
|
|
</Grid>
|
|
</Page> |