2026-03-30 17:09:29 +09:00

223 lines
13 KiB
XML

<UserControl x:Class="VisionCommonUI.CamDeviceSettingView"
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"
xmlns:local="clr-namespace:VisionCommonUI"
xmlns:visionCommon="clr-namespace:VisionCommon;assembly=VisionCommon"
xmlns:view="clr-namespace:Aurora.View;assembly=Aurora"
x:Name="camDeviceSettingView"
mc:Ignorable="d"
IsVisibleChanged="UserControl_IsVisibleChanged">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<view:SharedResourceDictionary Source="pack://application:,,,/VisionCommonUI;component/Styles/VisionResources.xaml"/>
</ResourceDictionary.MergedDictionaries>
<view:EnumToBoolConverter x:Key="enumToBoolConverter"/>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition Height="170"/>
<RowDefinition Height="110"/>
<RowDefinition Height="100"/>
<RowDefinition Height="5"/>
<RowDefinition Height="70"/>
</Grid.RowDefinitions>
<!--Flip-->
<GroupBox Grid.Row="0" Margin="10">
<GroupBox.Header>
<TextBlock Style="{StaticResource styleTextBlockSubTitleSmall_Orange}">
<Run Text="{Binding [Flip], Source={StaticResource langTokens}, Mode=OneWay}"/>
</TextBlock>
</GroupBox.Header>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="90"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<ToggleButton Grid.Column="0" Style="{StaticResource StToggleButtonLed}" Background="Transparent" BorderBrush="Transparent"
Checked="Checked_ImageFlip_None"
IsChecked="{Binding Path=CamConfig.FlipAndRotation.ImageFlip,
Converter={StaticResource enumToBoolConverter}, ConverterParameter={x:Static visionCommon:eImageFlip.None}}">
<TextBlock Style="{StaticResource stylePatternComboBoxTextBlock}">
<Run Text="None"/>
</TextBlock>
</ToggleButton>
<ToggleButton Grid.Column="1" Style="{StaticResource StToggleButtonLed}" Background="Transparent" BorderBrush="Transparent"
Checked="Checked_ImageFlip_LeftToRight"
IsChecked="{Binding Path=CamConfig.FlipAndRotation.ImageFlip,
Converter={StaticResource enumToBoolConverter}, ConverterParameter={x:Static visionCommon:eImageFlip.LeftToRight}}">
<TextBlock Style="{StaticResource stylePatternComboBoxTextBlock}">
<Run Text="LeftToRight"/>
</TextBlock>
</ToggleButton>
<ToggleButton Grid.Column="2" Style="{StaticResource StToggleButtonLed}" Background="Transparent" BorderBrush="Transparent"
Checked="Checked_ImageFlip_TopToBottom"
IsChecked="{Binding Path=CamConfig.FlipAndRotation.ImageFlip,
Converter={StaticResource enumToBoolConverter}, ConverterParameter={x:Static visionCommon:eImageFlip.TopToBottom}}">
<TextBlock Style="{StaticResource stylePatternComboBoxTextBlock}">
<Run Text="TopToBottom"/>
</TextBlock>
</ToggleButton>
</Grid>
</GroupBox>
<!--Rotation & Offset-->
<GroupBox Grid.Row="1" Margin="10">
<GroupBox.Header>
<TextBlock Style="{StaticResource styleTextBlockSubTitleSmall_Orange}">
<Run Text="{Binding [Rotation], Source={StaticResource langTokens}, Mode=OneWay}"/>
<Run Text="[deg]"/>
</TextBlock>
</GroupBox.Header>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="68"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<ToggleButton Grid.Column="0" Style="{StaticResource StToggleButtonLed}" Background="Transparent" BorderBrush="Transparent"
Checked="Checked_ImageRotation_0"
IsChecked="{Binding Path=CamConfig.FlipAndRotation.ImageRotation,
Converter={StaticResource enumToBoolConverter}, ConverterParameter={x:Static visionCommon:eImageRotation.None}}">
<TextBlock Style="{StaticResource stylePatternComboBoxTextBlock}">
<Run Text="0"/>
</TextBlock>
</ToggleButton>
<ToggleButton Grid.Column="1" Style="{StaticResource StToggleButtonLed}" Background="Transparent" BorderBrush="Transparent"
Checked="Checked_ImageRotation_90"
IsChecked="{Binding Path=CamConfig.FlipAndRotation.ImageRotation,
Converter={StaticResource enumToBoolConverter}, ConverterParameter={x:Static visionCommon:eImageRotation.CW_DEG_90}}">
<TextBlock Style="{StaticResource stylePatternComboBoxTextBlock}">
<Run Text="90"/>
</TextBlock>
</ToggleButton>
<ToggleButton Grid.Column="2" Style="{StaticResource StToggleButtonLed}" Background="Transparent" BorderBrush="Transparent"
Checked="Checked_ImageRotation_180"
IsChecked="{Binding Path=CamConfig.FlipAndRotation.ImageRotation,
Converter={StaticResource enumToBoolConverter}, ConverterParameter={x:Static visionCommon:eImageRotation.CW_DEG_180}}">
<TextBlock Style="{StaticResource stylePatternComboBoxTextBlock}">
<Run Text="180"/>
</TextBlock>
</ToggleButton>
<ToggleButton Grid.Column="3" Style="{StaticResource StToggleButtonLed}" Background="Transparent" BorderBrush="Transparent"
Checked="Checked_ImageRotation_270"
IsChecked="{Binding Path=CamConfig.FlipAndRotation.ImageRotation,
Converter={StaticResource enumToBoolConverter}, ConverterParameter={x:Static visionCommon:eImageRotation.CW_DEG_270}}">
<TextBlock Style="{StaticResource stylePatternComboBoxTextBlock}">
<Run Text="270"/>
</TextBlock>
</ToggleButton>
</Grid>
<Grid Grid.Row="1">
<local:UCContentSlider Margin="5,-10,5,10"
MinValue="-10" MaxValue="10" TickFrequency="1" Step="0.001" SliderChangedEvent="SliderChangedEvent_ImageRotationOffset"
KeyValue="{Binding ElementName=camDeviceSettingView, Path=DataContext.CamConfig.FlipAndRotation.ImageRotationOffset}">
<TextBlock Style="{StaticResource stylePatternSliderTextBlock}" Margin="3,0,0,0" FontSize="11">
<Run Text="{Binding [Rotation], Source={StaticResource langTokens}, Mode=OneWay}"/>
<Run Text="{Binding [Offset], Source={StaticResource langTokens}, Mode=OneWay}"/>
</TextBlock>
</local:UCContentSlider>
</Grid>
</Grid>
</GroupBox>
<!--Exposure Time-->
<GroupBox Grid.Row="2" Margin="10">
<GroupBox.Header>
<TextBlock Style="{StaticResource styleTextBlockSubTitleSmall_Orange}">
<Run Text="{Binding [ExposureTime], Source={StaticResource langTokens}, Mode=OneWay}"/>
<Run Text="[ms]"/>
</TextBlock>
</GroupBox.Header>
<local:UCContentSlider Margin="5,-10,5,10"
MinValue="0" MaxValue="100" TickFrequency="5" Step="1" SliderChangedEvent="SliderChangedEvent_ExposureTime"
KeyValue="{Binding ElementName=camDeviceSettingView, Path=DataContext.CamConfig.ExposureTime_Ms}">
<!--<TextBlock Style="{StaticResource stylePatternSliderTextBlock}">
<Run Text="{Binding [ExposureTime], Source={StaticResource langTokens}, Mode=OneWay}"/>
</TextBlock>-->
</local:UCContentSlider>
</GroupBox>
<!--Child Image Buffer-->
<GroupBox Grid.Row="3" Margin="10">
<GroupBox.Header>
<TextBlock Style="{StaticResource styleTextBlockSubTitleSmall_Orange}">
<Run Text="{Binding [ChildImageBuffer], Source={StaticResource langTokens}, Mode=OneWay}"/>
</TextBlock>
</GroupBox.Header>
<StackPanel Margin="0,0,-7,0" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Style="{StaticResource styleBtnPatternSetting}"
Command="{Binding CMD_EditChildImage}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Image Style="{StaticResource stylePatternButtonImage}"
Source="pack://application:,,,/VisionCommonUI;component/Icons/ColorIcons/img_edit.png"/>
<TextBlock Style="{StaticResource stylePatternButtonTextBlock}">
<Run Text="{Binding [Edit], Source={StaticResource langTokens}, Mode=OneWay}"/>
</TextBlock>
</StackPanel>
</Button>
</StackPanel>
</GroupBox>
<Separator Grid.Row="4"/>
<!--Buttons-->
<StackPanel Grid.Row="5" Margin="13,10,13,10" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Style="{StaticResource styleBtnPatternSetting}"
Command="{Binding CMD_Reload}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Image Style="{StaticResource stylePatternButtonImage}"
Source="pack://application:,,,/VisionCommonUI;component/Icons/ColorIcons/img_loading_arrow.png"/>
<TextBlock Style="{StaticResource stylePatternButtonTextBlock}">
<Run Text="{Binding [Reload], Source={StaticResource langTokens}, Mode=OneWay}"/>
</TextBlock>
</StackPanel>
</Button>
<Button Style="{StaticResource styleBtnPatternSetting}"
Command="{Binding CMD_Save}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Image Style="{StaticResource stylePatternButtonImage}"
Source="pack://application:,,,/VisionCommonUI;component/Icons/ColorIcons/img_ok.png"/>
<TextBlock Style="{StaticResource stylePatternButtonTextBlock}">
<Run Text="{Binding [Save], Source={StaticResource langTokens}, Mode=OneWay}"/>
</TextBlock>
</StackPanel>
</Button>
<Button Style="{StaticResource styleBtnPatternSetting}"
Command="{Binding CMD_Close}"
CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Image Style="{StaticResource stylePatternButtonImage}"
Source="pack://application:,,,/VisionCommonUI;component/Icons/ColorIcons/img_cancel.png"/>
<TextBlock Style="{StaticResource stylePatternButtonTextBlock}">
<Run Text="{Binding [Close], Source={StaticResource langTokens}, Mode=OneWay}"/>
</TextBlock>
</StackPanel>
</Button>
</StackPanel>
</Grid>
</UserControl>