<!--
/*
** Job Arranger Manager
** Copyright (C) 2012 FitechForce, Inc. All Rights Reserved.
** Copyright (C) 2013 Daiwa Institute of Research Business Innovation 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.
**
**/
-->
<src:BaseWindow x:Class="jp.co.ftf.jobcontroller.JobController.JobArrangerWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:design="clr-namespace:jp.co.ftf.jobcontroller.JobController.Form.JobEdit"
        xmlns:exec="clr-namespace:jp.co.ftf.jobcontroller.JobController.Form.JobManager"                
        xmlns:src="clr-namespace:jp.co.ftf.jobcontroller.JobController"
        Title="{x:Static src:Properties.Resources.WINDOW_NAME_200}" Height="760" Width="1170"
        WindowStartupLocation="CenterScreen" Closing="Window_Closed" Background="White"
        Loaded="mainWindow_Load" WindowStyle="ThreeDBorderWindow" KeyDown="JobArrangerWindow_KeyDown" 
        FontSize="11" FontFamily="Meiryo">
    <Window.Resources>
        <src:ContentToPathConverter x:Key="content2PathConverter"/>
        <src:ContentToMarginConverter x:Key="content2MarginConverter"/>

        <SolidColorBrush x:Key="BorderBrush" Color="#FFFFFFFF"/>
        <SolidColorBrush x:Key="HoverBrush" Color="#FFFF4500"/>
        <LinearGradientBrush x:Key="TabItemPathBrush" StartPoint="0,0" EndPoint="0,1">
            <GradientStop Color="#FF3164a5" Offset="0"/>
            <GradientStop Color="#FFe4f6fa" Offset="1"/>
        </LinearGradientBrush>

        <!-- TabControl style -->
        <Style x:Key="TabControlStyle" TargetType="{x:Type TabControl}">
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="TabControl">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Border Grid.Row="1" BorderThickness="2,0,2,2" Panel.ZIndex="2" CornerRadius="0,0,2,2"
                                BorderBrush="{StaticResource BorderBrush}"
                                Background="{StaticResource BackgroundBrush}">
                                <ContentPresenter ContentSource="SelectedContent"/>
                            </Border>
                            <StackPanel Orientation="Horizontal" Grid.Row="0" Panel.ZIndex="1" IsItemsHost="true"/>
                            <Rectangle Grid.Row="0" Height="2" VerticalAlignment="Bottom"
                                   Fill="{StaticResource BorderBrush}"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <!-- TabItem style -->
        <Style x:Key="{x:Type TabItem}" TargetType="{x:Type TabItem}">
            <Setter Property="SnapsToDevicePixels" Value="True"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="TabItem">
                        <Grid x:Name="grd">
                            <Path x:Name="TabPath" StrokeThickness="2"
                              Margin="{Binding ElementName=TabItemContent, Converter={StaticResource content2MarginConverter}}"
                              Stroke="{StaticResource BorderBrush}"
                              Fill="{StaticResource TabItemPathBrush}">
                                <Path.Data>
                                    <PathGeometry>
                                        <PathFigure IsClosed="False" StartPoint="1,0" 
                                                Segments="{Binding ElementName=TabItemContent, Converter={StaticResource content2PathConverter}}">
                                        </PathFigure>
                                    </PathGeometry>
                                </Path.Data>
                                <Path.LayoutTransform>
                                    <ScaleTransform ScaleY="-1"/>
                                </Path.LayoutTransform>
                            </Path>
                            <Rectangle x:Name="TabItemTopBorder" Height="2" Visibility="Visible"
                                   VerticalAlignment="Bottom" Fill="{StaticResource BorderBrush}"
                                   Margin="{Binding ElementName=TabItemContent, Converter={StaticResource content2MarginConverter}}" />
                            <ContentPresenter x:Name="TabItemContent" ContentSource="Header"
                                          Margin="10,2,10,2" VerticalAlignment="Center"
                                          TextElement.Foreground="#FF000000"/>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True" SourceName="grd">
                                <Setter Property="Stroke" Value="{StaticResource HoverBrush}" TargetName="TabPath"/>
                            </Trigger>
                            <Trigger Property="Selector.IsSelected" Value="True">
                                <Setter Property="Fill" TargetName="TabPath">
                                    <Setter.Value>
                                        <SolidColorBrush Color="#FFe4f6fa"/>
                                    </Setter.Value>
                                </Setter>
                                <Setter Property="BitmapEffect">
                                    <Setter.Value>
                                        <DropShadowBitmapEffect Direction="302" Opacity="0.4" 
                                                        ShadowDepth="2" Softness="0.5"/>
                                    </Setter.Value>
                                </Setter>
                                <Setter Property="Panel.ZIndex" Value="2"/>
                                <Setter Property="Visibility" Value="Hidden" TargetName="TabItemTopBorder"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>

    <DockPanel Name="dockPanel1" Margin="0" Background="#FFEEECE1">
        <Menu DockPanel.Dock="Top" HorizontalAlignment="Left" BorderBrush="Black">
            <MenuItem Name="MenuItemFile" Header="{x:Static src:Properties.Resources.file_menu_text}" Click="MenuitemFile_Click" MouseEnter="MenuitemFile_Click" >
                <MenuItem Header="{x:Static src:Properties.Resources.new_context_menu_text}" Name="menuitemAdd" Click="MenuitemAdd_Click" />
                <Separator/>
                <MenuItem Header="{x:Static src:Properties.Resources.import_menu_text}" Name="menuitemImport" Click="MenuitemImport_Click"/>
                <MenuItem Header="{x:Static src:Properties.Resources.export_menu_text}" Name="menuitemExport" Click="MenuitemExport_Click"/>
                <Separator/>
                <MenuItem Header="{x:Static src:Properties.Resources.exit_menu_text}" Click="MenuitemEnd_Click" />
            </MenuItem>
            <MenuItem Name="MenuItemEdit" Header="{x:Static src:Properties.Resources.edit_menu_text}" Click="MenuitemEdit_Click" MouseEnter="MenuitemEdit_Click">
                <MenuItem Header="{x:Static src:Properties.Resources.del_menu_text}" Name="menuitemDel" Click="MenuitemDel_Click"/>
            </MenuItem>
            <MenuItem Header="{x:Static src:Properties.Resources.view_menu_text}" Click="MenuitemView_Click" MouseEnter="MenuitemView_Click">
                <MenuItem Header="{x:Static src:Properties.Resources.jobnet_situation_menu_text}" Name="menuitemViewAll" IsCheckable="True" IsChecked="True"/>
                <MenuItem Header="{x:Static src:Properties.Resources.err_jobnet_situation_menu_text}" Name="menuitemViewErr" IsCheckable="True" IsChecked="True" />
                <MenuItem Header="{x:Static src:Properties.Resources.during_jobnet_situation_menu_text}" Name="menuitemViewRunning" IsCheckable="True" IsChecked="True" />
            </MenuItem>
            <MenuItem Name="MenuItemRun" Header="{x:Static src:Properties.Resources.run_menu_text}"  Click="MenuitemRun_Click" MouseEnter="MenuitemRun_Click">
                <MenuItem Header="{x:Static src:Properties.Resources.immediate_run_menu_text}" Name="menuItemImmediateRun" Click="MenuitemImmediateRun_Click"/>
                <MenuItem Header="{x:Static src:Properties.Resources.reservation_run_menu_text}" Name="menuItemReserveRun"  Click="MenuitemReserveRun_Click"/>
                <MenuItem Header="{x:Static src:Properties.Resources.test_run_menu_text}" Name="menuItemTestRun"  Click="MenuitemTestRun_Click"/>
            </MenuItem>
            <MenuItem Header="{x:Static src:Properties.Resources.help_menu_text}">
                <MenuItem Header="{x:Static src:Properties.Resources.ver_menu_text}"  Click="MenuitemVer_Click"/>
            </MenuItem>
        </Menu>
        <Separator Height="5" DockPanel.Dock="Top" HorizontalAlignment="Stretch" Margin="0,-4,0,0" Background="Black" />
        <Grid Name="grid1" DockPanel.Dock="Top" Margin="0,3,0,15" Background="#FF4A452A">
            <Label Content="{x:Static src:Properties.Resources.user_name_label_text}" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,9,207,0"
                   Height="25" Foreground="White" />
            <TextBlock  Name="productName" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,5,3,10" 
                   Width="400" Height="43" Foreground="White" TextWrapping="Wrap" >
                <Hyperlink NavigateUri="http://xn--yck0c5b3804be7h.fitechforce.com/" RequestNavigate="Hyperlink_SendClick" Foreground="White">
                    Job Arranger 3.2.0
                </Hyperlink>
                 
            </TextBlock>
            
            <TextBlock Text="" Name="userName" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,14,3,0" 
                   Width="205" Height="43" Foreground="White" TextWrapping="Wrap" />
            <TabControl HorizontalAlignment="Stretch" Margin="0,30,-1,0" Name="tabControl" VerticalAlignment="Stretch" SelectionChanged="tabControl_Selected" Style="{StaticResource TabControlStyle}" >
                <TabItem Header="{x:Static src:Properties.Resources.object_control_tab_text}" Name="tabItemObjectList" Background="#FF897F7F">
                    <Grid Name="grid" Margin="0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="262" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Border Grid.Column="0" Margin="1,1,1,1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" BorderThickness="1" BorderBrush="Black" >
                            <TreeView Name="treeView1" BorderThickness="0" PreviewMouseRightButtonUp ="TreetView_PreviewMouseRightButtonUp" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Auto">
                                <TreeViewItem Header="{x:Static src:Properties.Resources.calendar_node_text}" Name="treeViewCalendar" Tag="0"  PreviewMouseRightButtonDown="TreeViewItem_PreviewMouseRightButtonDown" Selected="Calendar_Selected">
                                    <TreeViewItem Header="{x:Static src:Properties.Resources.public_calendar_node_text}" Name="publicCalendar" Selected="Public_Calendar_Selected" Tag="0" PreviewMouseRightButtonDown="TreeViewItem_PreviewMouseRightButtonDown"/>
                                    <TreeViewItem Header="{x:Static src:Properties.Resources.private_calendar_node_text}" Name="privateCalendar" Selected="Private_Calendar_Selected" Tag="0" PreviewMouseRightButtonDown="TreeViewItem_PreviewMouseRightButtonDown"/>

                                    <TreeViewItem Header="{x:Static src:Properties.Resources.public_filter_node_text}" Name="publicFilter"  Selected="Public_Filter_Selected" Tag="1" PreviewMouseRightButtonDown="TreeViewItem_PreviewMouseRightButtonDown"/>
                                    <TreeViewItem Header="{x:Static src:Properties.Resources.private_filter_node_text}" Name="privateFilter" Selected="Private_Filter_Selected" Tag="1" PreviewMouseRightButtonDown="TreeViewItem_PreviewMouseRightButtonDown"/>
                                </TreeViewItem>
                                <TreeViewItem Header="{x:Static src:Properties.Resources.schedule_node_text}" Name="treeViewSchedule" Tag="1" PreviewMouseRightButtonDown="TreeViewItem_PreviewMouseRightButtonDown" Selected="Schedule_Selected">
                                    <TreeViewItem Header="{x:Static src:Properties.Resources.public_schedule_node_text}" Name="publicSchedule" Selected="Public_Schedule_Selected" Tag="2" PreviewMouseRightButtonDown="TreeViewItem_PreviewMouseRightButtonDown"/>
                                    <TreeViewItem Header="{x:Static src:Properties.Resources.private_schedule_node_text}" Name="privateSchedule" Selected="Private_Schedule_Selected" Tag="2" PreviewMouseRightButtonDown="TreeViewItem_PreviewMouseRightButtonDown"/>
                                </TreeViewItem>
                                <TreeViewItem Header="{x:Static src:Properties.Resources.jobnet_node_text}" Name="treeViewJobNet" Tag="2" PreviewMouseRightButtonDown="TreeViewItem_PreviewMouseRightButtonDown" Selected="Jobnet_Selected">
                                    <TreeViewItem Header="{x:Static src:Properties.Resources.public_jobnet_node_text}" Name="publicJobnet" Selected="Public_Jobnet_Selected" Tag="3" PreviewMouseRightButtonDown="TreeViewItem_PreviewMouseRightButtonDown"/>
                                    <TreeViewItem Header="{x:Static src:Properties.Resources.private_jobnet_node_text}" Name="privateJobnet" Selected="Private_Jobnet_Selected" Tag="3" PreviewMouseRightButtonDown="TreeViewItem_PreviewMouseRightButtonDown"/>
                                </TreeViewItem>
                                <TreeView.ContextMenu>
                                    <ContextMenu Opened="ContextMenu_Open" Name="contextMenu">
                                        <MenuItem Header="{x:Static src:Properties.Resources.new_context_menu_text}"  Name="contextMenuitemAdd" Click="ContextMenuitemAdd_Click"></MenuItem>
                                        <!--
                                        <MenuItem Header="{x:Static src:Properties.Resources.copy_new_context_menu_text}"  Name="contextMenuitemCopyNew" IsEnabled="False"></MenuItem>
                                        <MenuItem Header="{x:Static src:Properties.Resources.update_context_menu_text}"  Name="contextMenuitemEdit" IsEnabled="False"></MenuItem>
                                        <MenuItem Header="{x:Static src:Properties.Resources.new_version_context_menu_text}"  Name="contextMenuitemCopyVer" IsEnabled="False"></MenuItem>
                                        　　　　　
                                        <Separator></Separator>
                                        <MenuItem Header="{x:Static src:Properties.Resources.validity_context_menu_text}"  Name="contextMenuitemValid" IsEnabled="False"></MenuItem>
                                        <MenuItem Header="{x:Static src:Properties.Resources.invalidity_context_menu_text}"  Name="contextMenuitemInValid" IsEnabled="False"></MenuItem>
                                        -->
                                        <Separator></Separator>
                                        <MenuItem Header="{x:Static src:Properties.Resources.del_menu_text}"  Name="contextMenuitemDel" Click="ContextMenuitemDel_Click"></MenuItem>
                                        <Separator></Separator>
                                        <!--  added by YAMA 2014/11/10    JAMのGUIの名称の変更
                                        <MenuItem Header="{x:Static src:Properties.Resources.export_menu_text}"  Name="contextMenuitemExport" Click="ContextMenuitemExport_Click"></MenuItem>
                                        -->
                                        <MenuItem Header="{x:Static src:Properties.Resources.export_menu_tree_text}"  Name="contextMenuitemExport" Click="ContextMenuitemExport_Click"></MenuItem>
                                        <Separator></Separator>
                                        <MenuItem Header="{x:Static src:Properties.Resources.immediate_run_menu_text}" Name="contextMenuItemImmediateRun" Click="MenuitemImmediateRun_Click"/>
                                        <MenuItem Header="{x:Static src:Properties.Resources.reservation_run_menu_text}" Name="contextMenuItemReserveRun"  Click="MenuitemReserveRun_Click"/>
                                        <MenuItem Header="{x:Static src:Properties.Resources.test_run_menu_text}" Name="contextMenuItemTestRun"  Click="MenuitemTestRun_Click"/>
                                    </ContextMenu>
                                </TreeView.ContextMenu>
                            </TreeView>
                        </Border>
                        <GridSplitter Grid.Column="1" VerticalAlignment="Stretch" HorizontalAlignment="Center" Width="8"
                                      Background="White" ShowsPreview="True" KeyboardNavigation.IsTabStop="False"/>
                        <Grid Grid.Column="2" Name="JobNetGrid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                        </Grid>
                    </Grid>
                </TabItem>
                <TabItem Header="{x:Static src:Properties.Resources.job_control_tab_text}" Name="tabItemJobManager" Background="#FF897F7F">
                </TabItem>
                <TabItem Header="{x:Static src:Properties.Resources.job_result_tab_text}" Name="tabItemJobResult" Background="#FF897F7F">
                </TabItem>
                <!--  added by YAMA 2014/08/18 タブ追加 -->
                <TabItem Header="{x:Static src:Properties.Resources.general_settings_tab_text}" Name="tabItemSetParameter" Background="#FF897F7F">
                </TabItem>
            </TabControl>
        </Grid>
    </DockPanel>
</src:BaseWindow>
