<UserControl x:Class="MainShell.Recipe.View.WaferTeachView"
             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:mw="http://www.maxwell-gp.com/"
             xmlns:conv="clr-namespace:MainShell.Converter"
             xmlns:common="clr-namespace:MainShell.Common"
             mc:Ignorable="d"
            >
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <Border Margin="0,0,8,0">
            <ContentControl Content="{Binding CameraAxisViewModel}" />
        </Border>

        <ScrollViewer Grid.Column="1"
                      VerticalScrollBarVisibility="Auto"
                      HorizontalScrollBarVisibility="Disabled">
            <Grid Margin="4">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>

                <GroupBox Header="模版制作"
                          Style="{StaticResource ProcessWideCardGroupBoxStyle}">
                    <StackPanel Orientation="Horizontal"
                                Margin="0,4,0,0">
                        <Button Content="视觉参数设置"
                                    Click="{mw:Action OpenVisionParameterSetting}"
                                    Style="{StaticResource VisionButtonStyle}"
                                    mw:View.ActionTarget="{Binding }"
                                    Width="105"
                                    Height="40"
                                    Margin="0,0,10,0"/>
                        <Button Content="Mark模版"
                                    Click="{mw:Action MakeTemplate}"
                                    mw:View.ActionTarget="{Binding }"
                                    Style="{StaticResource TemplateButtonStyle}"
                                    Width="105"
                                    Height="40"/>
                    </StackPanel>
                </GroupBox>
                <Grid Grid.Row="1" DataContext="{Binding WaferRecipe.ScanSettings}">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <GroupBox Grid.Row="0"
                                  Header="参数示教"
                                  Style="{StaticResource ProcessWideCardGroupBoxStyle}"
                                  Margin="0,0,0,10">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <Label Grid.Row="0" Grid.Column="0"  Content="起始X" Style="{StaticResource ProcessLabelStyle}"/>
                            <mw:NumberBox Grid.Row="0" Grid.Column="1"
                                              Width="Auto"
                                              MinWidth="120"
                                              Style="{StaticResource ProcessLargeNumberBoxStyle}"
                                              Value="{Binding StartPointX, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                              mw:NumericKeypadAttach.IsEnabled="True"/>

                            <Label Grid.Row="0" Grid.Column="2" Content="起始Y" Style="{StaticResource ProcessLabelStyle}"/>
                            <mw:NumberBox Grid.Row="0" Grid.Column="3"
                                              Width="Auto"
                                              MinWidth="120"
                                              Style="{StaticResource ProcessLargeNumberBoxStyle}"
                                              Value="{Binding StartPointY, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                              mw:NumericKeypadAttach.IsEnabled="True"/>

                            <StackPanel Grid.Row="1"
                                            Grid.ColumnSpan="4"
                                            Margin="0,12,0,0"
                                            HorizontalAlignment="Center"
                                            Orientation="Horizontal">
                                <Button Content="示教"
                                            Click="{mw:Action TeachStartPoint}"
                                            mw:View.ActionTarget="{Binding DataContext, RelativeSource={RelativeSource AncestorType=UserControl}}"
                                            Style="{StaticResource TeachButtonStyle}"
                                            Margin="0,0,10,0"/>
                                <Button Content="移动到"
                                            Click="{mw:Action MoveToStartPoint}"
                                            mw:View.ActionTarget="{Binding DataContext, RelativeSource={RelativeSource AncestorType=UserControl}}"
                                            Style="{StaticResource AxisMoveButtonStyle}"
                                         />
                            </StackPanel>
                        </Grid>
                    </GroupBox>

                    <GroupBox Grid.Row="1"
                                  Header="扫描参数"
                                  Style="{StaticResource ProcessWideCardGroupBoxStyle}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>

                            <Label Grid.Row="0" Grid.Column="0"  Content="X扫描方向" Style="{StaticResource ProcessLabelStyle}"/>
                            <ComboBox Grid.Row="0" Grid.Column="1"
                                          Width="Auto"
                                          MinWidth="100"
                                          Style="{StaticResource ProcessLargeComboBoxStyle}"
                                          SelectedValue="{Binding ScanDirectionX, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                          SelectedValuePath="Value"
                                          DisplayMemberPath="Description"
                                          ItemsSource="{conv:EnumBindingSourceExtension UseDescription=True, EnumType={x:Type common:TransPathDirection}}"/>

                            <Label Grid.Row="0" Grid.Column="2" Content="Y扫描方向" Style="{StaticResource ProcessLabelStyle}"/>
                            <ComboBox Grid.Row="0" Grid.Column="3"
                                          Width="Auto"
                                          MinWidth="100"
                                          Style="{StaticResource ProcessLargeComboBoxStyle}"
                                          SelectedValue="{Binding ScanDirectionY, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                          SelectedValuePath="Value"
                                          DisplayMemberPath="Description"
                                          ItemsSource="{conv:EnumBindingSourceExtension UseDescription=True, EnumType={x:Type common:TransPathDirection}}"/>

                            <Label Grid.Row="1" Grid.Column="0" Content="X重叠率" Style="{StaticResource ProcessLabelStyle}"/>
                            <mw:NumberBox Grid.Row="1" Grid.Column="1"
                                              Width="Auto"
                                              MinWidth="100"
                                              Style="{StaticResource ProcessLargeNumberBoxStyle}"
                                              Value="{Binding OverlapRateX, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                              mw:NumericKeypadAttach.IsEnabled="True"/>

                            <Label Grid.Row="1" Grid.Column="2" Content="Y重叠率" Style="{StaticResource ProcessLabelStyle}"/>
                            <mw:NumberBox Grid.Row="1" Grid.Column="3"
                                              Width="Auto"
                                              MinWidth="100"
                                              Style="{StaticResource ProcessLargeNumberBoxStyle}"
                                              Value="{Binding OverlapRateY, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                              mw:NumericKeypadAttach.IsEnabled="True"/>

                            <Label Grid.Row="2" Grid.Column="0" Content="偏移(mm)" Style="{StaticResource ProcessLabelStyle}"/>
                            <mw:NumberBox Grid.Row="2" Grid.Column="1"
                                              Width="Auto"
                                              MinWidth="100"
                                              Style="{StaticResource ProcessLargeNumberBoxStyle}"
                                              Value="{Binding SoftLimitOffsetMm, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                              mw:NumericKeypadAttach.IsEnabled="True"/>

                            <Label Grid.Row="2" Grid.Column="2" Content="处理数量" Style="{StaticResource ProcessLabelStyle}"/>
                            <mw:IntNumberBox Grid.Row="2" Grid.Column="3"
                                                 Width="Auto"
                                                 MinWidth="100"
                                                 Style="{StaticResource ProcessLargeIntNumberBoxStyle}"
                                                 Value="{Binding ConsumerCount, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                 mw:NumericKeypadAttach.IsEnabled="True"/>

                            <Label Grid.Row="3" Grid.Column="0" Content="处理线程数" Style="{StaticResource ProcessLabelStyle}"/>
                            <mw:IntNumberBox Grid.Row="3" Grid.Column="1"
                                                 Width="Auto"
                                                 MinWidth="100"
                                                 Style="{StaticResource ProcessLargeIntNumberBoxStyle}"
                                                 Value="{Binding FrameChannelCapacity, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                 mw:NumericKeypadAttach.IsEnabled="True"/>
                        </Grid>
                    </GroupBox>
                </Grid>
            </Grid>
        </ScrollViewer>
    </Grid>
</UserControl>
