<UserControl x:Class="MainShell.ParaSetting.View.DeviceSafetyView"
             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/"
             mc:Ignorable="d"
             d:DesignHeight="900"
             d:DesignWidth="1200">
    <UserControl.Resources>
        <ResourceDictionary>
            <Style x:Key="DeviceSafetyLabelStyle" TargetType="Label" BasedOn="{StaticResource ProcessLabelStyle}">
                <Setter Property="Width" Value="168"/>
            </Style>

            <Style x:Key="DeviceSafetyWideLabelStyle" TargetType="Label" BasedOn="{StaticResource ProcessLabelStyle}">
                <Setter Property="Width" Value="210"/>
            </Style>

            <Style x:Key="DeviceSafetyCompactLabelStyle" TargetType="Label" BasedOn="{StaticResource ProcessLabelStyle}">
                <Setter Property="Width" Value="150"/>
            </Style>

            <Style x:Key="DeviceSafetyNumberBoxStyle" TargetType="{x:Type mw:NumberBox}" BasedOn="{StaticResource ProcessNumberBoxStyle}">
                <Setter Property="Margin" Value="8,0,0,0"/>
            </Style>

            <Style x:Key="DeviceSafetyLargeNumberBoxStyle" TargetType="{x:Type mw:NumberBox}" BasedOn="{StaticResource ProcessLargeNumberBoxStyle}">
                <Setter Property="Margin" Value="8,0,0,0"/>
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid Background="{StaticResource ProcessPageBackgroundBrush}">
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <ScrollViewer Grid.Row="0"
                      Margin="4,4,4,0"
                      VerticalScrollBarVisibility="Auto"
                      HorizontalScrollBarVisibility="Disabled"
                      Padding="0,0,4,0">
            <StackPanel Margin="0,0,0,4">
                <GroupBox Header="安全干涉设置" Style="{StaticResource ProcessWideCardGroupBoxStyle}">
                    <WrapPanel>
                        <StackPanel Width="302" Margin="0,0,18,0">
                            <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                <Label Style="{StaticResource DeviceSafetyLabelStyle}" Content="Z1环内最低安全高度:"/>
                                <mw:NumberBox Style="{StaticResource DeviceSafetyNumberBoxStyle}" Value="{Binding SafeParaSysItem.Z1InRingSafeHeight}" DecimalPlaces="4" mw:NumericKeypadAttach.IsEnabled="True" ShowUpDownButton="True" Maximum="10000" Minimum="-10000" Increment="0.5"/>
                            </StackPanel>
                            <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                <Label Style="{StaticResource DeviceSafetyLabelStyle}" Content="Z1通用安全高度:"/>
                                <mw:NumberBox Style="{StaticResource DeviceSafetyNumberBoxStyle}" Value="{Binding SafeParaSysItem.Z1GeneralSafeHeight}" DecimalPlaces="4" mw:NumericKeypadAttach.IsEnabled="True" ShowUpDownButton="True" Maximum="10000" Minimum="-10000" Increment="0.5"/>
                            </StackPanel>
                            <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                <Label Style="{StaticResource DeviceSafetyLabelStyle}" Content="Z5通用安全高度:"/>
                                <mw:NumberBox Style="{StaticResource DeviceSafetyNumberBoxStyle}" Value="{Binding SafeParaSysItem.Z5GeneralSafeHeight}" DecimalPlaces="4" mw:NumericKeypadAttach.IsEnabled="True" ShowUpDownButton="True" Maximum="10000" Minimum="-10000" Increment="0.5"/>
                            </StackPanel>
                            <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                <Label Style="{StaticResource DeviceSafetyLabelStyle}" Content="Z4环外最低安全高度:"/>
                                <mw:NumberBox Style="{StaticResource DeviceSafetyNumberBoxStyle}" Value="{Binding SafeParaSysItem.Z4OutRingSafeHeight}" DecimalPlaces="4" mw:NumericKeypadAttach.IsEnabled="True" ShowUpDownButton="True" Maximum="10000" Minimum="-10000" Increment="0.5"/>
                            </StackPanel>
                            <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                <Label Style="{StaticResource DeviceSafetyLabelStyle}" Content="刺晶头对刀安全高度:"/>
                                <mw:NumberBox Style="{StaticResource DeviceSafetyNumberBoxStyle}" Value="{Binding SafeParaSysItem.NeedleCalibSafeHeight}" DecimalPlaces="4" mw:NumericKeypadAttach.IsEnabled="True" ShowUpDownButton="True" Maximum="10000" Minimum="-10000" Increment="0.5"/>
                            </StackPanel>
                        </StackPanel>

                        <StackPanel Width="302" Margin="0,0,18,0">
                            <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                <Label Style="{StaticResource DeviceSafetyLabelStyle}" Content="Z1环上最低安全高度:"/>
                                <mw:NumberBox Style="{StaticResource DeviceSafetyNumberBoxStyle}" Value="{Binding SafeParaSysItem.Z1OnRingSafeHeight}" DecimalPlaces="4" mw:NumericKeypadAttach.IsEnabled="True" ShowUpDownButton="True" Maximum="10000" Minimum="-10000" Increment="0.5"/>
                            </StackPanel>
                            <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                <Label Style="{StaticResource DeviceSafetyLabelStyle}" Content="Z3通用安全高度:"/>
                                <mw:NumberBox Style="{StaticResource DeviceSafetyNumberBoxStyle}" Value="{Binding SafeParaSysItem.Z3GeneralSafeHeight}" DecimalPlaces="4" mw:NumericKeypadAttach.IsEnabled="True" ShowUpDownButton="True" Maximum="10000" Minimum="-10000" Increment="0.5"/>
                            </StackPanel>
                            <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                <Label Style="{StaticResource DeviceSafetyLabelStyle}" Content="Z6通用安全高度:"/>
                                <mw:NumberBox Style="{StaticResource DeviceSafetyNumberBoxStyle}" Value="{Binding SafeParaSysItem.Z6GeneralSafeHeight}" DecimalPlaces="4" mw:NumericKeypadAttach.IsEnabled="True" ShowUpDownButton="True" Maximum="10000" Minimum="-10000" Increment="0.5"/>
                            </StackPanel>
                            <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                <Label Style="{StaticResource DeviceSafetyLabelStyle}" Content="Z5环外最低安全高度:"/>
                                <mw:NumberBox Style="{StaticResource DeviceSafetyNumberBoxStyle}" Value="{Binding SafeParaSysItem.Z5OutRingSafeHeight}" DecimalPlaces="4" mw:NumericKeypadAttach.IsEnabled="True" ShowUpDownButton="True" Maximum="10000" Minimum="-10000" Increment="0.5"/>
                            </StackPanel>
                        </StackPanel>

                        <StackPanel Width="302">
                            <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                <Label Style="{StaticResource DeviceSafetyLabelStyle}" Content="Z1环外最低安全高度:"/>
                                <mw:NumberBox Style="{StaticResource DeviceSafetyNumberBoxStyle}" Value="{Binding SafeParaSysItem.Z1OutRingSafeHeight}" DecimalPlaces="4" mw:NumericKeypadAttach.IsEnabled="True" ShowUpDownButton="True" Maximum="10000" Minimum="-10000" Increment="0.5"/>
                            </StackPanel>
                            <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                <Label Style="{StaticResource DeviceSafetyLabelStyle}" Content="Z4通用安全高度:"/>
                                <mw:NumberBox Style="{StaticResource DeviceSafetyNumberBoxStyle}" Value="{Binding SafeParaSysItem.Z4GeneralSafeHeight}" DecimalPlaces="4" mw:NumericKeypadAttach.IsEnabled="True" ShowUpDownButton="True" Maximum="10000" Minimum="-10000" Increment="0.5"/>
                            </StackPanel>
                            <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                <Label Style="{StaticResource DeviceSafetyLabelStyle}" Content="Z3环外最低安全高度:"/>
                                <mw:NumberBox Style="{StaticResource DeviceSafetyNumberBoxStyle}" Value="{Binding SafeParaSysItem.Z3OutRingSafeHeight}" DecimalPlaces="4" mw:NumericKeypadAttach.IsEnabled="True" ShowUpDownButton="True" Maximum="10000" Minimum="-10000" Increment="0.5"/>
                            </StackPanel>
                            <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                <Label Style="{StaticResource DeviceSafetyLabelStyle}" Content="Z6环外最低安全高度:"/>
                                <mw:NumberBox Style="{StaticResource DeviceSafetyNumberBoxStyle}" Value="{Binding SafeParaSysItem.Z6OutRingSafeHeight}" DecimalPlaces="4" mw:NumericKeypadAttach.IsEnabled="True" ShowUpDownButton="True" Maximum="10000" Minimum="-10000" Increment="0.5"/>
                            </StackPanel>
                        </StackPanel>
                    </WrapPanel>
                </GroupBox>

                <GroupBox Header="基准与范围设置" Style="{StaticResource ProcessWideCardGroupBoxStyle}">
                    <WrapPanel>
                        <StackPanel Width="392" Margin="0,0,18,0">
                            <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                <Label Style="{StaticResource DeviceSafetyWideLabelStyle}" Content="刺晶头基准 X1-X3最大值:"/>
                                <mw:NumberBox Style="{StaticResource DeviceSafetyLargeNumberBoxStyle}" Value="{Binding SafeParaSysItem.NeedleReferenceX1X3Max}" DecimalPlaces="4" mw:NumericKeypadAttach.IsEnabled="True" ShowUpDownButton="True" Maximum="10000" Minimum="-10000" Increment="0.5"/>
                            </StackPanel>
                            <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                <Label Style="{StaticResource DeviceSafetyWideLabelStyle}" Content="刺晶头基准 X1-X3最小值:"/>
                                <mw:NumberBox Style="{StaticResource DeviceSafetyLargeNumberBoxStyle}" Value="{Binding SafeParaSysItem.NeedleReferenceX1X3Min}" DecimalPlaces="4" mw:NumericKeypadAttach.IsEnabled="True" ShowUpDownButton="True" Maximum="10000" Minimum="-10000" Increment="0.5"/>
                            </StackPanel>
                        </StackPanel>

                        <StackPanel Width="392">
                            <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                <Label Style="{StaticResource DeviceSafetyWideLabelStyle}" Content="定位光源基准 X1-X3最大值:"/>
                                <mw:NumberBox Style="{StaticResource DeviceSafetyLargeNumberBoxStyle}" Value="{Binding SafeParaSysItem.PositionLightReferenceX1X3Max}" DecimalPlaces="4" mw:NumericKeypadAttach.IsEnabled="True" ShowUpDownButton="True" Maximum="10000" Minimum="-10000" Increment="0.5"/>
                            </StackPanel>
                            <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                <Label Style="{StaticResource DeviceSafetyWideLabelStyle}" Content="定位光源基准 X1-X3最小值:"/>
                                <mw:NumberBox Style="{StaticResource DeviceSafetyLargeNumberBoxStyle}" Value="{Binding SafeParaSysItem.PositionLightReferenceX1X3Min}" DecimalPlaces="4" mw:NumericKeypadAttach.IsEnabled="True" ShowUpDownButton="True" Maximum="10000" Minimum="-10000" Increment="0.5"/>
                            </StackPanel>
                        </StackPanel>
                    </WrapPanel>
                </GroupBox>

                <WrapPanel>
                    <GroupBox Header="大视野光源设置" Style="{StaticResource ProcessCardGroupBoxStyle}" Width="430" Margin="0,0,18,18">
                        <StackPanel>
                            <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                <Label Style="{StaticResource DeviceSafetyCompactLabelStyle}" Content="X2-X3最大值:"/>
                                <mw:NumberBox Style="{StaticResource DeviceSafetyNumberBoxStyle}" Value="{Binding SafeParaSysItem.WideFieldLightX2X3Max}" DecimalPlaces="4" mw:NumericKeypadAttach.IsEnabled="True" ShowUpDownButton="True" Maximum="10000" Minimum="-10000" Increment="0.5"/>
                            </StackPanel>
                            <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                <Label Style="{StaticResource DeviceSafetyCompactLabelStyle}" Content="X2-X3最小值:"/>
                                <mw:NumberBox Style="{StaticResource DeviceSafetyNumberBoxStyle}" Value="{Binding SafeParaSysItem.WideFieldLightX2X3Min}" DecimalPlaces="4" mw:NumericKeypadAttach.IsEnabled="True" ShowUpDownButton="True" Maximum="10000" Minimum="-10000" Increment="0.5"/>
                            </StackPanel>
                        </StackPanel>
                    </GroupBox>

                    <GroupBox Header="半径设置" Style="{StaticResource ProcessCardGroupBoxStyle}" Width="430" Margin="0,0,0,18">
                        <StackPanel>
                            <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                <Label Style="{StaticResource DeviceSafetyCompactLabelStyle}" Content="WS内环半径:"/>
                                <mw:NumberBox Style="{StaticResource DeviceSafetyNumberBoxStyle}" Value="{Binding SafeParaSysItem.WsInnerRingRadius}" DecimalPlaces="4" mw:NumericKeypadAttach.IsEnabled="True" ShowUpDownButton="True" Maximum="10000" Minimum="-10000" Increment="0.5"/>
                            </StackPanel>
                            <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                                <Label Style="{StaticResource DeviceSafetyCompactLabelStyle}" Content="刺晶头半径:"/>
                                <mw:NumberBox Style="{StaticResource DeviceSafetyNumberBoxStyle}" Value="{Binding SafeParaSysItem.NeedleRadius}" DecimalPlaces="4" mw:NumericKeypadAttach.IsEnabled="True" ShowUpDownButton="True" Maximum="10000" Minimum="-10000" Increment="0.5"/>
                            </StackPanel>
                        </StackPanel>
                    </GroupBox>
                </WrapPanel>
            </StackPanel>
        </ScrollViewer>

        <Grid Grid.Row="1" Margin="4,8,4,4">
            <Button Content="{DynamicResource Save}" Style="{StaticResource SaveButtonStyle}" HorizontalAlignment="Right"/>
        </Grid>
    </Grid>
</UserControl>
