2026-01-26 18:56:53 +09:00

227 lines
14 KiB
XML

<UserControl x:Class="CogUI.BrightnessSettingView"
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:behavior="http://schemas.microsoft.com/xaml/behaviors"
xmlns:aurora="clr-namespace:Aurora.View;assembly=Aurora"
xmlns:visionCommonUI="clr-namespace:VisionCommonUI;assembly=VisionCommonUI"
xmlns:local="clr-namespace:CogUI"
x:Name="brightnessSettingView"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=local:BrightnessSettingViewModel}"
Width="520" Height="580">
<UserControl.Resources>
<ResourceDictionary>
<aurora:BoolConverter
x:Key="boolInverter"
FalseValue="True"
TrueValue="False"/>
<aurora:BoolToVisibilityConverter
x:Key="visibilityConverter"
True="Visible"
False="Collapsed"/>
<aurora:BoolToVisibilityConverter
x:Key="visibilityInverter"
True="Collapsed"
False="Visible"/>
<Style TargetType="{x:Type GroupBox}" BasedOn="{StaticResource AVDefaultGB}" />
</ResourceDictionary>
</UserControl.Resources>
<behavior:Interaction.Triggers>
<behavior:PropertyChangedTrigger Binding="{Binding IsVisible, ElementName=brightnessSettingView}">
<behavior:InvokeCommandAction
Command="{Binding CMD_VisibleChanged}"
CommandParameter="{Binding IsVisible, ElementName=brightnessSettingView}"/>
</behavior:PropertyChangedTrigger>
</behavior:Interaction.Triggers>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition Height="1.5*"/>
<RowDefinition Height="100"/>
<RowDefinition Height="100"/>
<RowDefinition Height="5"/>
<RowDefinition Height="70"/>
</Grid.RowDefinitions>
<visionCommonUI:PatternInfoView Grid.Row="0" IsEnabled="{Binding ElementName=brightnessSettingView, Path=DataContext.IsPatternRegistered}"
IsActivated="{Binding ElementName=brightnessSettingView, Path=DataContext.PatternInfo.IsActivated}"
Description="{Binding ElementName=brightnessSettingView, Path=DataContext.PatternInfo.Description}"/>
<GroupBox Grid.Row="1" Margin="5" IsEnabled="{Binding ElementName=brightnessSettingView, Path=DataContext.IsPatternRegistered}">
<GroupBox.Header>
<TextBlock Style="{StaticResource styleTextBlockSubTitleSmall_Orange}">
<Run Text="{Binding [Find], Source={StaticResource langTokens}, Mode=OneWay}"/>
<Run Text="{Binding [Parameter], Source={StaticResource langTokens}, Mode=OneWay}"/>
</TextBlock>
</GroupBox.Header>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<visionCommonUI:UCContentSlider Grid.Row="0" Margin="5"
TickFrequency="1"
MinValue="0"
MaxValue="255"
KeyValue="{Binding ElementName=brightnessSettingView, Path=DataContext.RunParam.BrightnessParamExt.AvgLow}">
<TextBlock Style="{StaticResource stylePatternSliderTextBlock}">
<Run Text="{Binding [Avg], Source={StaticResource langTokens}, Mode=OneWay}"/>
<Run Text="{Binding [Low], Source={StaticResource langTokens}, Mode=OneWay}"/>
</TextBlock>
</visionCommonUI:UCContentSlider>
<visionCommonUI:UCContentSlider Grid.Row="1" Margin="5"
TickFrequency="1"
MinValue="0"
MaxValue="255"
KeyValue="{Binding ElementName=brightnessSettingView, Path=DataContext.RunParam.BrightnessParamExt.AvgHigh}">
<TextBlock Style="{StaticResource stylePatternSliderTextBlock}">
<Run Text="{Binding [Avg], Source={StaticResource langTokens}, Mode=OneWay}"/>
<Run Text="{Binding [High], Source={StaticResource langTokens}, Mode=OneWay}"/>
</TextBlock>
</visionCommonUI:UCContentSlider>
</Grid>
</GroupBox>
<GroupBox Grid.Row="2" Margin="5" IsEnabled="{Binding ElementName=brightnessSettingView, Path=DataContext.IsPatternRegistered}">
<GroupBox.Header>
<TextBlock Style="{StaticResource styleTextBlockSubTitleSmall_Orange}">
<Run Text="{Binding [Setting], Source={StaticResource langTokens}, Mode=OneWay}"/>
<Run Text="{Binding [Control], Source={StaticResource langTokens}, Mode=OneWay}"/>
</TextBlock>
</GroupBox.Header>
<Grid Margin="0, 10">
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Grid.Row="0" Grid.Column="0"
Style="{StaticResource styleBtnPatternSetting}"
Visibility="{Binding IsSubPattern, Converter={StaticResource visibilityInverter}}"
Command="{Binding CMD_SetLight}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Image Style="{StaticResource stylePatternButtonImage}"
Source="pack://application:,,,/VisionCommonUI;component/Icons/ColorIcons/img_light.png"/>
<TextBlock Style="{StaticResource stylePatternButtonTextBlock}">
<Run Text="{Binding [Light], Source={StaticResource langTokens}, Mode=OneWay}"/>
</TextBlock>
</StackPanel>
</Button>
<Button Grid.Row="0" Grid.Column="1"
Style="{StaticResource styleBtnPatternSetting}"
Command="{Binding CMD_SetPreProc}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Image Style="{StaticResource stylePatternButtonImage}"
Source="pack://application:,,,/VisionCommonUI;component/Icons/ColorIcons/img_filtering.png"/>
<TextBlock Style="{StaticResource stylePatternButtonTextBlock}">
<Run Text="{Binding [Pre], Source={StaticResource langTokens}, Mode=OneWay}"/>
<Run Text="{Binding [Proc], Source={StaticResource langTokens}, Mode=OneWay}"/>
</TextBlock>
</StackPanel>
</Button>
<Button Grid.Row="0" Grid.Column="2"
Style="{StaticResource styleBtnPatternSetting}"
Command="{Binding CMD_SetFindROI}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Image Style="{StaticResource stylePatternButtonImage}"
Source="pack://application:,,,/VisionCommonUI;component/Icons/ColorIcons/img_find_roi.png"/>
<TextBlock Style="{StaticResource stylePatternButtonTextBlock}">
<Run Text="{Binding [Find], Source={StaticResource langTokens}, Mode=OneWay}"/>
<Run Text="{Binding [ROI], Source={StaticResource langTokens}, Mode=OneWay}"/>
</TextBlock>
</StackPanel>
</Button>
<Button Grid.Row="0" Grid.Column="3"
Style="{StaticResource styleBtnPatternSetting}"
Command="{Binding CMD_FindPattern}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Image Style="{StaticResource stylePatternButtonImage}"
Source="pack://application:,,,/VisionCommonUI;component/Icons/ColorIcons/img_magnifying_glass.png"/>
<TextBlock Style="{StaticResource stylePatternButtonTextBlock}">
<Run Text="{Binding [Test], Source={StaticResource langTokens}, Mode=OneWay}"/>
<Run Text="{Binding [Find], Source={StaticResource langTokens}, Mode=OneWay}"/>
</TextBlock>
</StackPanel>
</Button>
</Grid>
</GroupBox>
<visionCommonUI:FixtureSettingView Grid.Row="3" IsEnabled="{Binding ElementName=brightnessSettingView, Path=DataContext.IsPatternRegistered}"
Enabled="{Binding ElementName=brightnessSettingView, Path=DataContext.PatternInfo.FixtureSetting.Enabled}"
ItemsSource="{Binding ElementName=brightnessSettingView, Path=DataContext.FixturePatterns}"
SelectedItem="{Binding ElementName=brightnessSettingView, Path=DataContext.PatternInfo.FixtureSetting.Pattern1}"/>
<Separator Grid.Row="4"/>
<StackPanel Grid.Row="5" Margin="15, 10" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Style="{StaticResource styleBtnPatternSetting}"
Visibility="{Binding IsSubPattern, Converter={StaticResource visibilityConverter}}"
IsEnabled="{Binding IsPatternRegistered, Converter={StaticResource boolInverter}}"
Command="{Binding CMD_Create}"
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_register.png"/>
<TextBlock Style="{StaticResource stylePatternButtonTextBlock}"
Text="{Binding [Register], Source={StaticResource langTokens}, Mode=OneWay}"/>
</StackPanel>
</Button>
<Button Style="{StaticResource styleBtnPatternSetting}"
IsEnabled="{Binding IsPatternRegistered}"
Command="{Binding CMD_Save}"
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_ok.png"/>
<TextBlock Style="{StaticResource stylePatternButtonTextBlock}"
Text="{Binding [Save], Source={StaticResource langTokens}, Mode=OneWay}"/>
</StackPanel>
</Button>
<Button Style="{StaticResource styleBtnPatternSetting}"
Visibility="{Binding IsSubPattern, Converter={StaticResource visibilityConverter}}"
IsEnabled="{Binding IsPatternRegistered}"
Command="{Binding CMD_Delete}"
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_bin.png"/>
<TextBlock Style="{StaticResource stylePatternButtonTextBlock}"
Text="{Binding [Delete], Source={StaticResource langTokens}, Mode=OneWay}"/>
</StackPanel>
</Button>
<Button Style="{StaticResource styleBtnPatternSetting}"
Command="{Binding CMD_Cancel}"
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}"
Text="{Binding [Close], Source={StaticResource langTokens}, Mode=OneWay}"/>
</StackPanel>
</Button>
</StackPanel>
</Grid>
</UserControl>