<UserControl x:Class="MECF.Framework.UI.Client.CenterViews.DataLogs.ProcessHistory.SelectDataView"
             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:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:wfi ="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration" 
             xmlns:wf ="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
             xmlns:toolkit="http://schemas.xceed.com/wpf/xaml/toolkit"
             xmlns:controls="clr-namespace:OpenSEMI.Ctrlib.Controls"
             xmlns:micro="clr-namespace:Caliburn.Micro"
             mc:Ignorable="d"  
             d:DesignHeight="600" d:DesignWidth="1600">
    <Grid Width="1600" Height="600">
        <Border BorderBrush="Gray" BorderThickness="1" Background="White" Padding="10">
            <Border.Effect>
                <DropShadowEffect BlurRadius="5" Color="#3F000000" ShadowDepth="5"/>
            </Border.Effect>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1300" ></ColumnDefinition>
                    <ColumnDefinition ></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="100"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid x:Name="SelectRecipe" Grid.Row="0" Grid.Column="0" Width="1300" >
                    <Grid.RowDefinitions>
                        <RowDefinition Height="40"/>
                        <RowDefinition Height="40"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="70"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="70"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="70"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="70"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="100"/>
                    </Grid.ColumnDefinitions>
                    <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="1" Background="{DynamicResource Table_BG_Title}" Padding="5,1" Height="40" Width="70">
                        <TextBlock Text="Start" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>
                    </Border>
                    <Border Grid.Column="1" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,1,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1">
                        <wfi:WindowsFormsHost Margin="5,0,0,0" FontSize="14" FontFamily="Arial" Width="170" Height="22" VerticalAlignment="Center">
                            <wf:DateTimePicker x:Name="wfTimeFrom" Value="2011-8-1" CustomFormat="yyyy/MM/dd HH:mm:ss" Format="Custom"></wf:DateTimePicker>
                        </wfi:WindowsFormsHost>
                        <!--<toolkit:DateTimePicker  Format="Custom" FontSize="14"
                                                     FormatString="yyyy/MM/dd HH:mm:ss"
                                                     TimeFormat="Custom"
                                                     TimeFormatString="HH:mm:ss"
                                                 AutoCloseCalendar="True" 
                                                     Grid.Row="0" VerticalAlignment="Top" 
                                                     Value="{Binding Path=StartDateTime, Mode=TwoWay}" Height="30" Width="190" />-->
                    </Border>
                    <Border Grid.Column="2" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,1,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1">
                        <TextBlock Text="End" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>
                    </Border>
                    <Border Grid.Column="3" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,1,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1">
                        <wfi:WindowsFormsHost Margin="5,0,0,0" FontSize="14" FontFamily="Arial" Width="170" Height="22" VerticalAlignment="Center">
                            <wf:DateTimePicker x:Name="wfTimeTo" Value="2013-8-1" CustomFormat="yyyy/MM/dd HH:mm:ss" Format="Custom"></wf:DateTimePicker>
                        </wfi:WindowsFormsHost>
                        <!--<toolkit:DateTimePicker  Format="Custom"  FontSize="14" 
                                                     FormatString="yyyy/MM/dd HH:mm:ss"
                                                     TimeFormat="Custom"
                                                     TimeFormatString="HH:mm:ss"
                                                 AutoCloseCalendar="True"
                                                     Grid.Row="0" VerticalAlignment="Top" 
                                                     Value="{Binding Path=EndDateTime, Mode=TwoWay}" Height="30" Width="190" />-->
                    </Border>
                    <Border Grid.Row="1" Grid.Column="0" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,1,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1">
                        <TextBlock Text="Recipe" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0,10"></TextBlock>
                    </Border>
                    <Border Grid.Row="1" Grid.Column="1" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,1,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1">
                        <TextBox Text="{Binding RecipeName}" Width="Auto"></TextBox>
                    </Border>
                    <Border Grid.Row="1" Grid.Column="2" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,1,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1">
                        <TextBlock Text="Chamber" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>
                    </Border>
                    <Border Grid.Row="1" Grid.Column="3" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,1,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1">
                        <toolkit:CheckComboBox x:Name="tbLoadPort" ItemsSource="{Binding SourcePM}" Width="150" FontFamily="Arial" FontSize="14" Height="30" Margin="5,0,0,0"
                                               HorizontalAlignment="Center" 
                                               VerticalAlignment="Center" 
                                               SelectedValue="{Binding SelectedValuePM}" >

                        </toolkit:CheckComboBox>
                    </Border>
                    <!--*********************************************************************-->
                    <Border Grid.Row="1" Grid.Column="4" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,1,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1">
                        <TextBlock Text="LotID" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>
                    </Border>
     
                    <Border Grid.Row="1" Grid.Column="5" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,1,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1">
                        <TextBox Text="{Binding LotID}" Width="Auto"></TextBox>
                    </Border>
        <!-- <Border Grid.Row="1" Grid.Column="5" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,1,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1">
                        <toolkit:CheckComboBox x:Name="tbLoadPort2" ItemsSource="{Binding SourcePM}" Width="150" FontFamily="Arial" FontSize="14" Height="30" Margin="5,0,0,0"
                                               HorizontalAlignment="Center" 
                                               VerticalAlignment="Center" 
                                               SelectedValue="{Binding SelectedValueSLot}" >
                        </toolkit:CheckComboBox>
                    </Border>-->

                    <Border Grid.Row="1" Grid.Column="6" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,1,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1">
                        <TextBlock Text="SLotID" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>
                    </Border>
                    <Border Grid.Row="1" Grid.Column="7" BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,1,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1">
                        <toolkit:CheckComboBox x:Name="tbLoadPort3" ItemsSource="{Binding SourceSLot}" Width="150" FontFamily="Arial" FontSize="14" Height="30" Margin="5,0,0,0"
                                               HorizontalAlignment="Center" 
                                               VerticalAlignment="Center" 
                                               SelectedValue="{Binding SelectedValueSLot}" >
                        </toolkit:CheckComboBox>
                    </Border>
                    <!--*********************************************************************-->
                    <Button Margin="5,0,0,0"  Grid.Row="1"  Grid.Column="8" Content="Search" Width="80" Height="30">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Click">
                                <micro:ActionMessage MethodName="SearchRecipe">
                                </micro:ActionMessage>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </Button>
                </Grid>
                <DataGrid Grid.Row="1" ItemsSource="{Binding Recipes}" CanUserAddRows="False" 
                          CanUserResizeRows="False" CanUserResizeColumns="True" FontFamily="Arial" Margin="0,5,0,0" AutoGenerateColumns="False">
                    <DataGrid.Columns>
                        <DataGridTemplateColumn Width="30">
                            <DataGridTemplateColumn.HeaderTemplate >
                                <DataTemplate>
                                    <CheckBox>
                                        <i:Interaction.Triggers>
                                            <i:EventTrigger EventName="Click">
                                                <micro:ActionMessage MethodName="CheckAllRecipe">
                                                </micro:ActionMessage>
                                            </i:EventTrigger>
                                        </i:Interaction.Triggers>
                                    </CheckBox>
                                </DataTemplate>
                            </DataGridTemplateColumn.HeaderTemplate>
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <CheckBox IsChecked="{Binding Selected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                        <i:Interaction.Triggers>
                                            <i:EventTrigger EventName="Click">
                                                <micro:ActionMessage MethodName="CheckRecipe">
                                                    <micro:Parameter Value="{Binding }"/>
                                                </micro:ActionMessage>
                                            </i:EventTrigger>
                                        </i:Interaction.Triggers>
                                    </CheckBox>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTemplateColumn Header="Recipe" Width="200">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Recipe}" Margin="5,0" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" VerticalAlignment="Center" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>

                        <!-- ************************************************************************************************** -->
                        <DataGridTemplateColumn Header="LotID" Width="120">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding LotID}" Margin="5,0" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" VerticalAlignment="Center" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>

                        <DataGridTemplateColumn Header="SlotID" Width="60">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding SlotID}" Margin="5,0" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" VerticalAlignment="Center" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>

                        <DataGridTemplateColumn Header="CJName" Width="120">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding CjName}" Margin="5,0" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" VerticalAlignment="Center" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>

                        <DataGridTemplateColumn Header="PJName" Width="150">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding PjName}" Margin="5,0" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" VerticalAlignment="Center" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>

                        <!-- ************************************************************************************************** -->
                        <DataGridTemplateColumn Header="Chamber" Width="100">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Chamber}" Margin="5,0" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" VerticalAlignment="Center" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>

                        <DataGridTemplateColumn Header="Start" Width="200">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding StartTime}" Margin="5,0" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" VerticalAlignment="Center" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTemplateColumn Header="End" Width="200">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding EndTime}" Margin="5,0" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" VerticalAlignment="Center" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>

                        <DataGridTemplateColumn Header="Status" Width="100">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Status}" Margin="5,0" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" VerticalAlignment="Center" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                    </DataGrid.Columns>
                </DataGrid>
                <TextBlock Grid.Row="2" Text="Selected Recipe" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" Margin="0,5"></TextBlock>
                <Border Grid.Row="3" BorderBrush="Gray" BorderThickness="1" Background="{DynamicResource Tab_BG}" Padding="10,5">
                    <ListBox Grid.Row="3" ItemsSource="{Binding SelectedRecipes}">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Recipe}" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}"></TextBlock>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Border>

                <!--<StackPanel Orientation="Horizontal" Margin="10,0,0,0" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right">
                    <Button Content="Preset" Width="80" Height="30">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Click">
                                <cal:ActionMessage MethodName="Preset">
                                </cal:ActionMessage>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </Button>
                    <Button Content="UnSelect" Width="80" Height="30" Margin="5,0,0,0">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Click">
                                <cal:ActionMessage MethodName="UnSelect">
                                </cal:ActionMessage>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </Button>
                </StackPanel>-->
                <Border Grid.Row="1" Grid.Column="1" Margin="10,5,0,0" BorderBrush="Gray" BorderThickness="1" Background="{DynamicResource Tab_BG}" Padding="5">
                    <TreeView x:Name="ParameterTreeView" ItemsSource="{Binding ParameterNodes}">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="TreeView.SelectedItemChanged">
                                <micro:ActionMessage MethodName="OnTreeSelectedChanged">
                                    <micro:Parameter Value="{Binding ElementName=ParameterTreeView,Path=SelectedItem}"></micro:Parameter>
                                </micro:ActionMessage>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                        <TreeView.ItemTemplate>
                            <HierarchicalDataTemplate  ItemsSource="{Binding ChildNodes}">
                                <StackPanel Orientation="Horizontal">
                                    <CheckBox IsChecked="{Binding Selected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" >
                                        <i:Interaction.Triggers>
                                            <i:EventTrigger EventName="Click">
                                                <micro:ActionMessage MethodName="ParameterCheck">
                                                    <micro:Parameter Value="{Binding }"/>
                                                </micro:ActionMessage>
                                            </i:EventTrigger>
                                        </i:Interaction.Triggers>
                                    </CheckBox>
                                    <TextBlock Text="{Binding Name}"  />
                                </StackPanel>
                            </HierarchicalDataTemplate>
                        </TreeView.ItemTemplate>
                    </TreeView>
                </Border>
                <TextBlock Grid.Row="2" Grid.Column="1" Margin="10,5,0,5" Text="Selected Parameter" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}"></TextBlock>
                <Border Grid.Row="3" Grid.Column="1" Margin="10,0,0,0" BorderBrush="Gray" BorderThickness="1" Background="{DynamicResource Tab_BG}" Padding="5" Height="100">
                    <ListBox ItemsSource="{Binding SelectedParameters}" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}">
                    </ListBox>
                </Border>

                <StackPanel Grid.Row="4" Grid.ColumnSpan="2" Margin="0,10,0,0" Orientation="Horizontal" HorizontalAlignment="Center">
                    <Button Content="OK" Width="100" Height="30">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Click">
                                <micro:ActionMessage MethodName="OK">
                                </micro:ActionMessage>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </Button>
                    <Button Content="Cancel" Width="100" Height="30" Margin="5,0,0,0">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Click">
                                <micro:ActionMessage MethodName="Cancel">
                                </micro:ActionMessage>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </Button>
                    <Button Content="Export" Width="100" Height="30" Margin="5,0,0,0">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Click">
                                <micro:ActionMessage MethodName="Export">
                                </micro:ActionMessage>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </Button>
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</UserControl>
