<UserControl x:Class="ProximaAnalizer.Views.RecipeStepNavi"
             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:ProximaAnalizer.Views"
             xmlns:prism="http://prismlibrary.com/"
             prism:ViewModelLocator.AutoWireViewModel="True"
             mc:Ignorable="d" 
             xmlns:c="clr-namespace:UICommon;assembly=UICommon"
             d:DesignHeight="450" d:DesignWidth="800">
    <UserControl.Resources>
        <ResourceDictionary Source="/UICommon;component/Resources.xaml"/>
    </UserControl.Resources>
    <Grid Background="{StaticResource BackgroundColor}">
        <Grid Margin="8">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="8"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid Panel.ZIndex="1" Grid.RowSpan="3" Background="#90ffffff" Visibility="{Binding Masking}">
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="8"/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <StackPanel Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Center">
                    <Image Source="{StaticResource Icon_Search}" Width="200"></Image>
                    <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20">查询配方步法...</TextBlock>
                </StackPanel>
            </Grid>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="12"/>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="12"/>
                    <ColumnDefinition Width="auto"/>
                </Grid.ColumnDefinitions>
                <GroupBox Header="根据日期查询" HorizontalAlignment="Left" VerticalAlignment="Center" BorderBrush="{StaticResource DarkBorderColor}">
                    <StackPanel Orientation="Horizontal">
                        <DatePicker Width="160" Margin="8" VerticalAlignment="Center" HorizontalAlignment="Center" SelectedDate="{Binding SelectedTime}"/>
                        <Button Margin="4" Height="24" Style="{StaticResource FunctionButton}" Command="{Binding DayOperatorCommand}" CommandParameter="-">-</Button>
                        <Button Margin="4" Height="24" Style="{StaticResource FunctionButton}" Command="{Binding DayOperatorCommand}" CommandParameter="+">+</Button>
                    </StackPanel>
                </GroupBox>

                <!--<TextBlock Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center">或</TextBlock>

                <GroupBox Grid.Column="4" Header="根据名称查询" HorizontalAlignment="Left" VerticalAlignment="Center" BorderBrush="{StaticResource DarkBorderColor}">
                    <StackPanel Orientation="Horizontal" >
                        <TextBox x:Name="NameBox" Width="140" Height="24" Margin="8" VerticalContentAlignment="Center" Padding="4,0"></TextBox>
                        <Button Margin="8" Width="60" Height="24" Style="{StaticResource FunctionButton}"
                            Command="{Binding NameSearchCommand}"
                            CommandParameter="{Binding ElementName=NameBox, Path=Text}">查询</Button>
                    </StackPanel>
                </GroupBox>-->
            </Grid>

            <GroupBox Grid.Row="2" Header="工艺历史记录" BorderBrush="{StaticResource DarkBorderColor}">
                <Grid Margin="8">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="8"/>
                        <RowDefinition Height="auto"/>
                    </Grid.RowDefinitions>
                    <ScrollViewer>
                        <ItemsControl ItemsSource="{Binding ProcessData}" TextElement.FontSize="14">
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <Border Margin="4" BorderBrush="Black" BorderThickness="0.5">
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="auto"/>
                                                <ColumnDefinition Width="24"/>
                                                <ColumnDefinition Width="*"/>
                                                <ColumnDefinition Width="24"/>
                                                <ColumnDefinition Width="auto" MinWidth="100"/>
                                                <ColumnDefinition Width="24"/>
                                                <ColumnDefinition Width="auto" MinWidth="100"/>
                                                <ColumnDefinition Width="24"/>
                                                <ColumnDefinition Width="auto"/>
                                                <ColumnDefinition Width="12"/>
                                                <ColumnDefinition Width="auto"/>
                                                <ColumnDefinition Width="12"/>
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition/>
                                                <RowDefinition/>
                                            </Grid.RowDefinitions>

                                            <Border Background="{StaticResource LightNormalColor}">
                                                <Grid Margin="4,2">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="60"/>
                                                        <ColumnDefinition Width="4"/>
                                                        <ColumnDefinition/>
                                                    </Grid.ColumnDefinitions>
                                                    <TextBlock VerticalAlignment="Center">开始时间</TextBlock>
                                                    <TextBlock Grid.Column="2" Text="{Binding Process_Begin_Time, StringFormat=yyyy-MM-dd HH:mm:ss}"/>
                                                </Grid>
                                            </Border>

                                            <Border Grid.Row="1" Background="{StaticResource LightWarningColor}">
                                                <Grid Margin="4,2">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="60"/>
                                                        <ColumnDefinition Width="4"/>
                                                        <ColumnDefinition/>
                                                    </Grid.ColumnDefinitions>
                                                    <TextBlock VerticalAlignment="Center">结束时间</TextBlock>
                                                    <TextBlock Grid.Column="2" Text="{Binding Process_End_Time, StringFormat=yyyy-MM-dd HH:mm:ss}"/>
                                                </Grid>
                                            </Border>

                                            <TextBlock Grid.Column="2" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Left">配方名称</TextBlock>
                                            <TextBlock Grid.Column="2" Grid.Row="2" Grid.RowSpan="2" VerticalAlignment="Center" HorizontalAlignment="Left" Text="{Binding Recipe_Name}"/>

                                            <!--<TextBlock Grid.Column="4" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center">配方种类</TextBlock>
                                            <TextBlock Grid.Column="4" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding Recipe_Type}"/>-->

                                            <TextBlock Grid.Column="6" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center">执行状态</TextBlock>
                                            <TextBlock Grid.Column="6" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding Process_Status}"/>

                                            <Button Grid.Column="8" Grid.RowSpan="2" Margin="0,4" Width="80" Style="{StaticResource FunctionButton}"
                                        Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:RecipeStepNavi}, Path=DataContext.NaviCommand}"
                                        CommandParameter="{Binding}">数据分析</Button>

                                            <Button Grid.Column="10" Grid.RowSpan="2" Margin="0,4" Width="80" Style="{StaticResource FunctionButton}"
                                        Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:RecipeStepNavi}, Path=DataContext.HistoryCommand}"
                                        CommandParameter="{Binding}">历史追溯</Button>
                                        </Grid>
                                    </Border>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
          
                        </ItemsControl>
                    </ScrollViewer>

                </Grid>
            </GroupBox>
        </Grid>
    </Grid>
</UserControl>
