<UserControl x:Class="Aucma.Core.DoorFoam.Views.RealTimePageView"
             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:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
             xmlns:local="clr-namespace:Aucma.Core.DoorFoam.Views"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800">
    <UserControl.Resources>
        <Style x:Key="DataGridTextColumnCenterSytle" TargetType="{x:Type TextBlock}">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="HorizontalAlignment" Value="Center"/>
            <Setter Property="FontSize" Value="20"/>
        </Style>

        <Style TargetType="DataGrid">
            <!--网格线颜色-->
            <Setter Property="CanUserResizeColumns" Value="false"/>
            <Setter Property="Background" Value="#1152AC" />
            <Setter Property="BorderBrush" Value="#4285DE" />
            <Setter Property="HorizontalGridLinesBrush">
                <Setter.Value>
                    <SolidColorBrush Color="#4285DE"/>
                </Setter.Value>
            </Setter>
            <Setter Property="VerticalGridLinesBrush">
                <Setter.Value>
                    <SolidColorBrush Color="#1152AC"/>
                </Setter.Value>
            </Setter>
        </Style>
        <!--列头标题栏样式-->
        <Style TargetType="DataGridColumnHeader">
            <!--<Setter Property="HorizontalContentAlignment" Value="Center"/>
          <Setter Property="VerticalContentAlignment" Value="Center"/>-->
            <!--<Setter Property="Background" Value="#dddddd"/>
          <Setter Property="Foreground" Value="Black"/>-->
            <!--<Setter Property="BorderThickness" Value="1" />-->
            <Setter Property="HorizontalContentAlignment" Value="Center" />
            <Setter Property="BorderBrush" Value="#4285DE" />
            <Setter Property="Height" Value="40"/>
            <Setter Property="FontSize" Value="18"/>
            <Setter Property="Background" Value="#4285DE"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="FontFamily" Value="Microsoft YaHei"/>
        </Style>

        <!--单元格样式-->
        <Style TargetType="DataGridCell">
            <Setter Property="FocusVisualStyle" Value="{x:Null}" />
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="BorderBrush" Value="#4285DE" />
            <Setter Property="Height" Value="40"/>
            <Setter Property="FontSize" Value="18"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type DataGridCell}">
                        <Grid Background="{TemplateBinding Background}" >
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="IsSelected" Value="True">
                    <Setter Property="Background" Value="#4285DE"/>
                    <Setter Property="Foreground" Value="White"/>
                </Trigger>
                <DataTrigger Binding="{Binding ExecuteStatus}" Value="2">
                    <Setter Property="Background" Value="Green" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </UserControl.Resources>
    <Grid Margin="0 15 0 0">
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <!--扫描信息-->
        <Border Grid.Row="0" Grid.Column="0" BorderBrush="#0288d1" BorderThickness="1" CornerRadius="5" Background="Transparent" Margin="3,1,5,5">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="1*"/>
                    <RowDefinition Height="9*"/>
                </Grid.RowDefinitions>

                <Border Grid.Row="0" BorderBrush="#0288d1" BorderThickness="0,0,0,1" CornerRadius="0" Background="#1157b9" Margin="1,1,3,5" >
                    <TextBlock Text="实时监控" FontSize="20" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                </Border>

                <!--扫描信息-->
                <Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,1,3,5">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="0.5*"/>
                            <ColumnDefinition Width="6*"/>
                            <ColumnDefinition Width="0.5*"/>
                        </Grid.ColumnDefinitions>
                        <Border Grid.Column="0"  BorderThickness="0" Background="Transparent" CornerRadius="5" >

                        </Border>

                        <Border Grid.Column="1"  BorderThickness="0" Background="Transparent" CornerRadius="5" Margin="0,10,0,0">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="166*"/>
                                    <RowDefinition Height="7*"/>
                                </Grid.RowDefinitions>
                                <ListBox x:Name="listBox" ItemsSource="{Binding LogInfoListBox}" Foreground="White" Background="Transparent" BorderBrush="Transparent" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden" Grid.RowSpan="2"/>
                            </Grid>
                        </Border>
                    </Grid>
                </Border>
            </Grid>
        </Border>

        <!--箱体队列-->
        <Border Grid.Row="0" Grid.Column="1" BorderBrush="#0288d1" BorderThickness="1" CornerRadius="5" Background="#1157b9" Margin="3,1,3,5">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="1*"/>
                    <RowDefinition Height="9*"/>
                </Grid.RowDefinitions>
                <Border Grid.Row="0" BorderBrush="#0288d1" BorderThickness="0,0,0,1" CornerRadius="0" Background="Transparent" Margin="1,1,1,5" >
                    <TextBlock Text="箱体队列" FontSize="20" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                </Border>

                <!--小时产量-->
                <Border x:Name="HeightHelperPanel" Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Background="Transparent" >
                    <DataGrid Grid.Row="0" ItemsSource="{Binding PlanInfoDataGrid}" Background="#00000000" 
                             ColumnHeaderHeight="35"   Height="{Binding Path=ActualHeight, ElementName=ScanPanel}" 
                            RowHeight="50" AutoGenerateColumns="False" RowHeaderWidth="0"  FontSize="20"
                            GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Auto" 
                            ScrollViewer.VerticalScrollBarVisibility="Auto"  BorderThickness="0" CanUserAddRows="False" SelectionMode="Single" IsReadOnly="True"
                            Foreground="White" >
                        <!--修改选中字体颜色-->
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding ObjId}"  Header="  编号" Width="*"  ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}"/>
                            <DataGridTextColumn Binding="{Binding MaterialName}" Header="箱型" Width="*" ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}"/>
                            <DataGridTextColumn Binding="{Binding ScanTime,StringFormat=\{0:MM月dd日 HH:mm:ss\}}" Header="匹配时间" Width="*" ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}" />
                            <!--<DataGridTextColumn Binding="{Binding MaterialName}" Header="物料名称" Width="2*" ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}" />-->
                        </DataGrid.Columns>
                    </DataGrid>
                </Border>
            </Grid>
        </Border>

        <!--扫描记录-->
        <Border Grid.Row="1" Grid.ColumnSpan="2"  BorderBrush="#0288d1" BorderThickness="1" CornerRadius="5" Background="Transparent" Margin="3,1,3,5">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="1*"/>
                    <RowDefinition Height="9*"/>
                </Grid.RowDefinitions>
                <Border Grid.Row="0" BorderBrush="#0288d1" BorderThickness="0,0,0,1" CornerRadius="0" Background="#1157b9" Margin="1,1,5,5" >
                    <TextBlock Text="型号统计" FontSize="20" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                </Border>
                <!--型号统计-->
                <Border x:Name="ScanPanel" Grid.Row="1" Grid.Column="0" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="6*"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <UniformGrid Grid.Row="0">
                            <lvc:CartesianChart Series="{Binding ModelStatistics, UpdateSourceTrigger=PropertyChanged}" DisableAnimations="True">
                                <lvc:CartesianChart.AxisX>
                                    <lvc:Axis Labels="{Binding MaterialNameList}" FontSize="15">
                                        <lvc:Axis.Separator>
                                            <lvc:Separator Visibility="Hidden" StrokeThickness="1.5" StrokeDashArray="0" Stroke="#404F56" >
                                            </lvc:Separator>
                                        </lvc:Axis.Separator>
                                    </lvc:Axis>
                                </lvc:CartesianChart.AxisX>
                                <lvc:CartesianChart.AxisY>
                                    <lvc:Axis FontSize="15" MinValue="0" MaxValue="50">
                                        <lvc:Axis.Separator>
                                            <lvc:Separator Visibility="Hidden" StrokeThickness="1" StrokeDashArray="3"  Stroke="#404F56" >
                                            </lvc:Separator>
                                        </lvc:Axis.Separator>
                                    </lvc:Axis>
                                </lvc:CartesianChart.AxisY>
                            </lvc:CartesianChart>
                        </UniformGrid>

                    </Grid>
                </Border>
            </Grid>
        </Border>

    </Grid>
</UserControl>