<!--
/*
** Job Arranger Manager
** Copyright (C) 2012 FitechForce, Inc. All Rights Reserved.
** Copyright (C) 2013 Daiwa Institute of Research Business Innovation Ltd. All Rights Reserved.
** Copyright (C) 2021 Daiwa Institute of Research Ltd. All Rights Reserved.
**
** Licensed to the Apache Software Foundation (ASF) under one or more
** contributor license agreements. See the NOTICE file distributed with
** this work for additional information regarding copyright ownership.
** The ASF licenses this file to you under the Apache License, Version 2.0
** (the "License"); you may not use this file except in compliance with
** the License. You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
**
**/
-->
    <UserControl x:Class="jp.co.ftf.jobcontroller.JobController.Form.ScheduleEdit.Container"
             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:src="clr-namespace:jp.co.ftf.jobcontroller.JobController"
             FontFamily="Meiryo" FontSize="11">
    <UserControl.Resources>
        <src:BootTimeConverter x:Key="BootTimeConverter"/>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot"  Background="WhiteSmoke" ShowGridLines="False" Margin="0,0,5,0" >
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="20"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="1*"/>
        </Grid.ColumnDefinitions>
        <TextBlock DockPanel.Dock="Left" Margin="5,10,0,0" Text="{x:Static src:Properties.Resources.boot_time_label_text}" Width="Auto" Grid.Row="0" Grid.Column="0"/>
        <TextBlock DockPanel.Dock="Left" Margin="5,10,0,0" Text="{x:Static src:Properties.Resources.jobnet_label_text}" Width="Auto" Grid.Row="0" Grid.Column="1"/>

        <DataGrid Name="dgCalendarBootTime" AutoGenerateColumns="False" Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="White"
                  BorderBrush="Black" GridLinesVisibility="None" RowHeight="20" CanUserAddRows="False"
                  SelectionMode="Extended" RowHeaderWidth="0" IsReadOnly="False" HeadersVisibility="All"
                  SelectionChanged="select_deleteCalendar" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Margin="0,0,0,40"
                  GotFocus="dgCalendar_GotFocus" LostFocus="dgCalendar_LostFocus" LostKeyboardFocus="dgCalendar_LostKeyboardFocus"
                  CellEditEnding="DataGrid_CellEditEnded" MouseUp="dgCalendar_MouseUp"
                  KeyboardNavigation.TabNavigation="Once" ColumnWidth="*">
            <DataGrid.Resources>
                <SolidColorBrush x:Key="SelectionColorKeyCalendar" Color="DarkGray"/>
                <SolidColorBrush x:Key="SelectionColorKeyCalendarText" Color="Black"/>
                <Style TargetType="DataGridRow">
                    <Style.Resources>
                        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="{Binding Source={StaticResource SelectionColorKeyCalendar}, Path=Color}"/>
                        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="{Binding Source={StaticResource SelectionColorKeyCalendarText}, Path=Color}"/>
                    </Style.Resources>
                </Style>
            </DataGrid.Resources>
            <DataGrid.Columns>
                <DataGridTextColumn Header="{x:Static src:Properties.Resources.object_id_col_head_text}" CellStyle="{StaticResource IDDataListCellStyle}" Binding="{Binding Path=calendar_id}" Width="Auto" IsReadOnly="True" />
                <DataGridTextColumn Header="{x:Static src:Properties.Resources.object_name_col_head_text}" Binding="{Binding Path=object_name}" Width="*" IsReadOnly="True">
                    <DataGridTextColumn.CellStyle>
                        <Style TargetType="{x:Type DataGridCell}">
                            <Setter Property="VerticalAlignment" Value="Stretch"/>
                            <Setter Property="VerticalContentAlignment" Value="Center"/>
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type DataGridCell}">
                                        <Border BorderBrush="{TemplateBinding BorderBrush}" VerticalAlignment="{TemplateBinding VerticalAlignment}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding  VerticalContentAlignment}"/>
                                        </Border>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="KeyboardNavigation.IsTabStop" Value="False"></Setter>
                        </Style>
                    </DataGridTextColumn.CellStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Header="{x:Static src:Properties.Resources.boot_time_col_head_text}" Width="Auto" IsReadOnly="False" >
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="TextBlock">
                            <Setter Property="TextWrapping" Value="Wrap" />
                            <Setter Property="Text" Value="{Binding Path=boot_time, Converter={StaticResource BootTimeConverter}}" />
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                    <DataGridTextColumn.EditingElementStyle>
                        <Style TargetType="TextBox">
                            <Setter Property="TextWrapping" Value="Wrap" />
                            <Setter Property="MaxLength" Value="4" />
                            <Setter Property="Text" Value="{Binding Path=boot_time}" />
                        </Style>
                    </DataGridTextColumn.EditingElementStyle>
                    <DataGridTextColumn.CellStyle>
                        <Style TargetType="{x:Type DataGridCell}">
                            <Setter Property="VerticalAlignment" Value="Stretch"/>
                            <Setter Property="VerticalContentAlignment" Value="Center"/>
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type DataGridCell}">
                                        <Border BorderBrush="{TemplateBinding BorderBrush}" VerticalAlignment="{TemplateBinding VerticalAlignment}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding  VerticalContentAlignment}"/>
                                        </Border>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="KeyboardNavigation.IsTabStop" Value="False"></Setter>
                        </Style>
                    </DataGridTextColumn.CellStyle>
                </DataGridTextColumn>
            </DataGrid.Columns>
        </DataGrid>
        <GridSplitter Grid.Row="1" Grid.Column="0" VerticalAlignment="Stretch" Margin="0,0,-1,40"
                                      Background="DarkGray" Width="3" ResizeDirection="Columns" ResizeBehavior="CurrentAndNext" ShowsPreview="True" KeyboardNavigation.IsTabStop="False"/>
        <DataGrid Name="dgJobnet" AutoGenerateColumns="False" Grid.Row="1" Grid.Column="1"
                  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="White"
                  BorderBrush="Black" GridLinesVisibility="None" RowHeight="20" CanUserAddRows="False"
                  SelectionMode="Extended" RowHeaderWidth="0" IsReadOnly="True" HeadersVisibility="All"
                  SelectionChanged="select_deleteJobnet" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Margin="0,0,0,40"
                  GotFocus="dgJobnet_GotFocus" LostFocus="dgJobnet_LostFocus" LostKeyboardFocus="dgJobnet_LostKeyboardFocus"
                  MouseUp="dgJobnet_MouseUp" KeyboardNavigation.TabNavigation="Once">
            <DataGrid.Resources>
                <SolidColorBrush x:Key="SelectionColorKeyJobnet" Color="LightGray"/>
                <SolidColorBrush x:Key="SelectionColorKeyJobnetText" Color="Black"/>
                <Style TargetType="DataGridRow">
                    <Style.Resources>
                        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="{Binding Source={StaticResource SelectionColorKeyJobnet}, Path=Color}"/>
                        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="{Binding Source={StaticResource SelectionColorKeyJobnetText}, Path=Color}"/>
                    </Style.Resources>
                </Style>
            </DataGrid.Resources>
            <DataGrid.Columns>
                <DataGridTextColumn Header="{x:Static src:Properties.Resources.jobnet_id_col_head_text}" CellStyle="{StaticResource IDDataListCellStyle}" Binding="{Binding Path=jobnet_id}" Width="Auto" />
                <DataGridTextColumn Header="{x:Static src:Properties.Resources.jobnet_name_col_head_text}" Binding="{Binding Path=jobnet_name}" Width="*" >
                    <DataGridTextColumn.CellStyle>
                        <Style TargetType="{x:Type DataGridCell}">
                            <Setter Property="VerticalAlignment" Value="Stretch"/>
                            <Setter Property="VerticalContentAlignment" Value="Center"/>
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type DataGridCell}">
                                        <Border BorderBrush="{TemplateBinding BorderBrush}" VerticalAlignment="{TemplateBinding VerticalAlignment}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding  VerticalContentAlignment}"/>
                                        </Border>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="KeyboardNavigation.IsTabStop" Value="False"></Setter>
                        </Style>
                    </DataGridTextColumn.CellStyle>
                </DataGridTextColumn>
            </DataGrid.Columns>
        </DataGrid>
        <Grid Grid.Row="2" Margin="0,0,0,0">
            <Button HorizontalAlignment="Right" Margin="0,-45,90,10" Name ="calendarDel" Content="{x:Static src:Properties.Resources.del_button_text}" Width="75" Height="23" Click="delCalendar_Click"/>
            <Button HorizontalAlignment="Right" Margin="0,-45,10,10" Name ="calendarAdd" Content="{x:Static src:Properties.Resources.add_button_text}" Width="75" Height="23" Click="addCalendar_Click"/>
        </Grid>
        <Grid Grid.Row="2" Grid.Column="1" Margin="0,0,0,0">
            <Button HorizontalAlignment="Right" Margin="0,-45,90,10" Name ="jobnetDel" Content="{x:Static src:Properties.Resources.del_button_text}" Width="75" Height="23" Click="delJobnet_Click"/>
            <Button HorizontalAlignment="Right" Margin="0,-45,10,10" Name ="jobnetAdd" Content="{x:Static src:Properties.Resources.add_button_text}" Width="75" Height="23" Click="addJobnet_Click"/>
        </Grid>
    </Grid>
</UserControl>
