<UserControl x:Class="MainShell.DeviceMaintance.View.LaserCompensationView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:mw="http://www.maxwell-gp.com/"
             mc:Ignorable="d"
             d:DesignHeight="560"
             d:DesignWidth="900">
    <UserControl.Resources>
        <ResourceDictionary>
            <Style TargetType="Label" BasedOn="{StaticResource {x:Type Label}}">
                <Setter Property="VerticalAlignment" Value="Center"/>
                <Setter Property="HorizontalAlignment" Value="Right"/>
                <Setter Property="Margin" Value="8,0,8,0"/>
                <Setter Property="Foreground" Value="{StaticResource ProcessBodyForegroundBrush}"/>
                <Setter Property="FontWeight" Value="SemiBold"/>
            </Style>

            <Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
                <Setter Property="Foreground" Value="{StaticResource ProcessBodyForegroundBrush}"/>
            </Style>

            <Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
                <Setter Property="Width" Value="110"/>
                <Setter Property="Height" Value="32"/>
                <Setter Property="Margin" Value="8,0,0,0"/>
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>

    <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
        <Grid Background="{StaticResource ProcessPageBackgroundBrush}" Margin="8">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <GroupBox  Grid.Row="0" Header="{DynamicResource LaserCompensationParameters}" Style="{StaticResource ProcessWideCardGroupBoxStyle}">
            <Grid Margin="4">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="280"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="280"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="280"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>

                <Label Grid.Row="0" Grid.Column="0" Content="{DynamicResource AxisName}"/>
                <ComboBox Grid.Row="0" Grid.Column="1"
                          Style="{StaticResource ProcessLargeComboBoxStyle}"
                        
                          ItemsSource="{Binding AxisNames}"
                          SelectedItem="{Binding SelectedAxisName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>

                <Label Grid.Row="0" Grid.Column="2" Content="{DynamicResource LaserCompensationStartPosition}"/>
                <mw:NumberBox Grid.Row="0" Grid.Column="3"
                              Style="{StaticResource ProcessLargeNumberBoxStyle}"
                            
                              Value="{Binding Setting.StartPos, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                              DecimalPlaces="4"
                              mw:NumericKeypadAttach.IsEnabled="True"
                              ShowUpDownButton="True"/>

                <Label Grid.Row="0" Grid.Column="4" Content="{DynamicResource LaserCompensationStepDistance}"/>
                <mw:NumberBox Grid.Row="0" Grid.Column="5"
                              Style="{StaticResource ProcessLargeNumberBoxStyle}"
                             
                              Value="{Binding Setting.Steps, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                              DecimalPlaces="4"
                              mw:NumericKeypadAttach.IsEnabled="True"
                              ShowUpDownButton="True"/>

                <Label Grid.Row="1" Grid.Column="0" Content="{DynamicResource LaserCompensationStepCount}"/>
                <mw:IntNumberBox Grid.Row="1" Grid.Column="1"
                                 Style="{StaticResource ProcessLargeIntNumberBoxStyle}"
                               
                                 Value="{Binding Setting.StepsCount, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                 mw:NumericKeypadAttach.IsEnabled="True"
                                 ShowUpDownButton="True"/>

                <Label Grid.Row="1" Grid.Column="2" Content="{DynamicResource LaserCompensationJumpPosition}"/>
                <mw:NumberBox Grid.Row="1" Grid.Column="3"
                              Style="{StaticResource ProcessLargeNumberBoxStyle}"
                             
                              Value="{Binding Setting.JumpPos, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                              DecimalPlaces="4"
                              mw:NumericKeypadAttach.IsEnabled="True"
                              ShowUpDownButton="True"/>

                <Label Grid.Row="1" Grid.Column="4" Content="{DynamicResource LaserCompensationCycleCount}"/>
                <mw:IntNumberBox Grid.Row="1" Grid.Column="5"
                                 Style="{StaticResource ProcessLargeIntNumberBoxStyle}"
                               
                                 Value="{Binding Setting.WorkCount, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                 mw:NumericKeypadAttach.IsEnabled="True"
                                 ShowUpDownButton="True"/>

                <Label Grid.Row="2" Grid.Column="0" Content="{DynamicResource Speed}"/>
                <mw:NumberBox Grid.Row="2" Grid.Column="1"
                              Style="{StaticResource ProcessLargeNumberBoxStyle}"
                             
                              Value="{Binding Setting.Speed, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                              DecimalPlaces="4"
                              mw:NumericKeypadAttach.IsEnabled="True"
                              ShowUpDownButton="True"/>

                <Label Grid.Row="2" Grid.Column="2" Content="{DynamicResource LaserCompensationDelaySeconds}"/>
                <mw:NumberBox Grid.Row="2" Grid.Column="3"
                              Style="{StaticResource ProcessLargeNumberBoxStyle}"
                             
                              Value="{Binding Setting.DwellTime, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                              DecimalPlaces="3"
                              mw:NumericKeypadAttach.IsEnabled="True"
                              ShowUpDownButton="True"/>

                <Button Grid.Row="2" Grid.Column="5" Content="{DynamicResource Save}" Click="{mw:Action Save}" HorizontalAlignment="Left"/>
            </Grid>
        </GroupBox>

        <GroupBox Grid.Row="1" Header="{DynamicResource LaserCompensationExecutionControl}" Style="{StaticResource ProcessWideCardGroupBoxStyle}" Margin="0,12,0,0">
            <Grid Margin="4">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <Button Content="{DynamicResource Start}" IsEnabled="{Binding UiEnable}" Click="{mw:Action StartAsync}"/>
                <Button Grid.Column="1" Content="{DynamicResource Stop}" IsEnabled="{Binding IsRunning}" Click="{mw:Action Stop}"/>

                <TextBlock Grid.Column="2"
                           VerticalAlignment="Center"
                           Text="{DynamicResource LaserCompensationTrajectoryOrder}"
                           Margin="18,0,0,0"/>
            </Grid>
        </GroupBox>

        <GroupBox Grid.Row="2" Header="{DynamicResource LaserCompensationExecutionStatus}" Style="{StaticResource ProcessWideCardGroupBoxStyle}" Margin="0,12,0,0">
            <Grid Margin="4">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="120"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="120"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="160"/>
                </Grid.ColumnDefinitions>

                <Label Grid.Column="0" Content="{DynamicResource LaserCompensationCurrentCycle}"/>
                <TextBlock Grid.Column="1" VerticalAlignment="Center" Text="{Binding CurrentLoopIndex}"/>
                <Label Grid.Column="2" Content="{DynamicResource LaserCompensationCurrentPoint}"/>
                <TextBlock Grid.Column="3" VerticalAlignment="Center" Text="{Binding CurrentPointIndex}"/>
                <Label Grid.Column="4" Content="{DynamicResource LaserCompensationCurrentTarget}"/>
                <TextBlock Grid.Column="5" VerticalAlignment="Center" Text="{Binding CurrentTargetPosition, StringFormat=F4}"/>
            </Grid>
        </GroupBox>

        <GroupBox Grid.Row="3" Header="{DynamicResource Description}" Style="{StaticResource ProcessWideCardGroupBoxStyle}" Margin="0,12,0,0">
            <StackPanel Margin="4">
                <TextBlock TextWrapping="Wrap"
                           Text="{DynamicResource LaserCompensationDescriptionPrimary}"/>
                <TextBlock Margin="0,8,0,0"
                           TextWrapping="Wrap"
                           Text="{DynamicResource LaserCompensationDescriptionSecondary}"/>
            </StackPanel>
        </GroupBox>
        </Grid>
    </ScrollViewer>
</UserControl>
