Files
XplorePlane/XplorePlane/Views/Setting/CameraSettingsWindow.xaml
T
2026-04-29 14:06:42 +08:00

151 lines
8.3 KiB
XML

<Window x:Class="XplorePlane.Views.CameraSettingsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="相机参数设置"
Width="340" Height="440"
WindowStartupLocation="CenterOwner"
ResizeMode="NoResize" ShowInTaskbar="False"
Background="#F5F5F5" FontFamily="Microsoft YaHei UI">
<Window.Resources>
<Style x:Key="CardStyle" TargetType="Border">
<Setter Property="Background" Value="White" />
<Setter Property="BorderBrush" Value="#E8E8E8" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="8" />
<Setter Property="Padding" Value="12,10" />
<Setter Property="Margin" Value="0,0,0,8" />
</Style>
<Style x:Key="ParamLabel" TargetType="TextBlock">
<Setter Property="FontSize" Value="11" />
<Setter Property="Foreground" Value="#555" />
<Setter Property="Margin" Value="0,0,0,3" />
</Style>
<Style TargetType="TextBox">
<Setter Property="BorderBrush" Value="#D0D0D0" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Padding" Value="4,3" />
<Setter Property="FontSize" Value="11.5" />
<Style.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="4" />
</Style>
</Style.Resources>
</Style>
</Window.Resources>
<StackPanel Margin="12">
<!-- 曝光和增益 -->
<Border Style="{StaticResource CardStyle}">
<StackPanel>
<TextBlock Text="曝光时间 (µs)" Style="{StaticResource ParamLabel}" />
<DockPanel Margin="0,0,0,8">
<TextBox DockPanel.Dock="Right" Width="65"
Text="{Binding ExposureTime, UpdateSourceTrigger=PropertyChanged}"
VerticalContentAlignment="Center" Margin="6,0,0,0" />
<Slider Minimum="10" Maximum="1000000" Value="{Binding ExposureTime}"
VerticalAlignment="Center" />
</DockPanel>
<TextBlock Text="增益" Style="{StaticResource ParamLabel}" />
<DockPanel>
<TextBox DockPanel.Dock="Right" Width="65"
Text="{Binding GainValue, UpdateSourceTrigger=PropertyChanged}"
VerticalContentAlignment="Center" Margin="6,0,0,0" />
<Slider Minimum="0" Maximum="24" Value="{Binding GainValue}"
SmallChange="0.1" LargeChange="1" VerticalAlignment="Center" />
</DockPanel>
</StackPanel>
</Border>
<!-- 分辨率 -->
<Border Style="{StaticResource CardStyle}">
<StackPanel>
<TextBlock Text="图像宽度 (px)" Style="{StaticResource ParamLabel}" />
<DockPanel Margin="0,0,0,8">
<TextBox DockPanel.Dock="Right" Width="65"
Text="{Binding ImageWidth, UpdateSourceTrigger=PropertyChanged}"
VerticalContentAlignment="Center" Margin="6,0,0,0" />
<Slider Minimum="64" Maximum="8192" Value="{Binding ImageWidth}"
SmallChange="1" LargeChange="100" VerticalAlignment="Center" />
</DockPanel>
<TextBlock Text="图像高度 (px)" Style="{StaticResource ParamLabel}" />
<DockPanel>
<TextBox DockPanel.Dock="Right" Width="65"
Text="{Binding ImageHeight, UpdateSourceTrigger=PropertyChanged}"
VerticalContentAlignment="Center" Margin="6,0,0,0" />
<Slider Minimum="64" Maximum="8192" Value="{Binding ImageHeight}"
SmallChange="1" LargeChange="100" VerticalAlignment="Center" />
</DockPanel>
</StackPanel>
</Border>
<!-- 像素格式 -->
<Border Style="{StaticResource CardStyle}">
<StackPanel>
<TextBlock Text="像素格式" Style="{StaticResource ParamLabel}" />
<ComboBox SelectedItem="{Binding SelectedPixelFormat}"
ItemsSource="{Binding PixelFormatOptions}"
Height="28" FontSize="11.5" VerticalContentAlignment="Center" />
</StackPanel>
</Border>
<!-- 操作按钮 -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,4,0,0">
<Button Content="应用设置" Padding="20,6" FontSize="12" Cursor="Hand" Click="ApplyAll_Click">
<Button.Style>
<Style TargetType="Button">
<Setter Property="Background" Value="#005FB8" />
<Setter Property="Foreground" Value="White" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="Bd" Background="{TemplateBinding Background}"
CornerRadius="6" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Bd" Property="Background" Value="#1A6FC4" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="Bd" Property="Background" Value="#004C99" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Button.Style>
</Button>
<Button Content="读取参数" Padding="20,6" FontSize="12" Cursor="Hand" Margin="8,0,0,0"
Command="{Binding RefreshCameraParamsCommand}">
<Button.Style>
<Style TargetType="Button">
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="#333" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="Bd" Background="{TemplateBinding Background}"
BorderBrush="#E0E0E0" BorderThickness="1"
CornerRadius="6" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Bd" Property="Background" Value="#EAF2FB" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="Bd" Property="Background" Value="#CCE8FF" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Button.Style>
</Button>
</StackPanel>
</StackPanel>
</Window>