<Page x:Class="FLY.Thick.FilmCasting.UI.PgBoltMap"
      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:FLY.Thick.FilmCasting.UI" xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
      mc:Ignorable="d" 
      d:DesignHeight="900" 
      d:DesignWidth="1024"
      Background="#E6E6E6"
      Title="PgBoltMap">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/FLY.Thick.FilmCasting.UI;component/Themes/Styles.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Converter/Dictionary_MyConv.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>

    </Page.Resources>
    <Grid d:DataContext="{d:DesignInstance Type=local:PgBoltMapVm}">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Grid x:Name="grid_initparam" DataContext="{Binding InitParamService}"/>
        <StackPanel Orientation="Horizontal" Background="{StaticResource Brushes.TitleBar.Background}" >
            <Button Style="{StaticResource Styles.TitleBar.BackButton2}" Command="BrowseBack"/>
            <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                <TextBlock Style="{StaticResource Styles.TitleBar.Text}"  Text="分区设定"/>
            </StackPanel>

        </StackPanel>
        <ScrollViewer CanContentScroll="False" PanningMode="Both" Grid.Row="1"  >
            <StackPanel>
                <Border Style="{StaticResource Styles.Card.Border}" >
                    <StackPanel>
                        <TextBlock Style="{StaticResource Styles.Card.Title}" Text="分区表" />

                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>

                            <WrapPanel Orientation="Horizontal">
                                <StackPanel Margin="{StaticResource ControlMargin}">
                                    <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="螺丝宽度" />
                                    <StackPanel Orientation="Horizontal">
                                        <TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding BoltWidth,StringFormat={}{0:F1}}" />
                                        <TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="mm"/>
                                    </StackPanel>
                                </StackPanel>
                                <StackPanel Margin="{StaticResource ControlMargin}">
                                    <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="螺丝数量" />
                                    <StackPanel Orientation="Horizontal">
                                        <TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding BoltCnt}" />
                                        <TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="个"/>
                                    </StackPanel>
                                </StackPanel>
                                <StackPanel Margin="{StaticResource ControlMargin}" >
                                    <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="与机架方向相反" />
                                    <ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" HorizontalAlignment="Left" IsChecked="{Binding IsReversed}"/>
                                </StackPanel>
                                <StackPanel Margin="{StaticResource ControlMargin}" >
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="膜中心位置" />
                                        <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Comment}"  >
                                            机架中心=<Run Text="{Binding MidMmOfGage}"/>mm
                                        </TextBlock>
                                    </StackPanel>

                                    <StackPanel Orientation="Horizontal">
                                        <TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding MidMm}"  />
                                        <TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="mm" />
                                        <TextBlock Style="{StaticResource Styles.Text.FieldContent.Separator}" />
                                        
                                        <TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" >
                                            当前=<Run Text="{Binding MidMmOfFilm}"/>mm
                                        </TextBlock>
                                    </StackPanel>
                                </StackPanel>
                            </WrapPanel>
                        </Grid>




                    </StackPanel>

                </Border>
                <Border Style="{StaticResource Styles.Card.Border}" >
                    <StackPanel>
                        <TextBlock Style="{StaticResource Styles.Card.Title}"  >
                            产品: <Run Text="{Binding PName,Mode=OneWay}"/>
                        </TextBlock>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>

                            <WrapPanel Orientation="Horizontal">
                                <StackPanel Margin="{StaticResource ControlMargin}" >
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable.Row2}" Text="开始无效螺丝数" />
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding LeftEmptyBolts}"  />
                                        <TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="个" />
                                    </StackPanel>
                                </StackPanel>
                                <StackPanel Margin="{StaticResource ControlMargin}" >
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable.Row2}" Text="结束无效螺丝数" />
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding RightEmptyBolts}"  />
                                        <TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="个" />
                                    </StackPanel>
                                </StackPanel>
                                <StackPanel Margin="{StaticResource ControlMargin}" >
                                    <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="收缩率" />
                                    <StackPanel Orientation="Horizontal">
                                        <TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding UniformShrinkPercent,Converter={StaticResource percentconv}}"/>
                                        <TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="%" />
                                    </StackPanel>
                                </StackPanel>
                            </WrapPanel>
                        </Grid>




                    </StackPanel>

                </Border>
                <Border Style="{StaticResource Styles.Card.Border}" >
                    <StackPanel>
                        <TextBlock Style="{StaticResource Styles.Card.Title}" Text="其它" />

                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>

                            <WrapPanel Orientation="Horizontal">
                                <StackPanel Margin="{StaticResource ControlMargin}" >
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="平滑" />
                                        <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Comment}" Text="均值滤波;&#13; =0只有自己; =1左右加自己一共3个" />
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding Smooth}"  />
                                        <TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="cm" />
                                    </StackPanel>
                                </StackPanel>
                            </WrapPanel>
                        </Grid>




                    </StackPanel>

                </Border>
            </StackPanel>
        </ScrollViewer>
        <Button Style="{StaticResource Styles.Button.Apply}" VerticalAlignment="Bottom" Margin="10" 
                    Command="{Binding ApplyCmd}"/>
    </Grid>
</Page>
