<Window x:Class="TSManagementApp.Views.MainWindowView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:TSManagementApp"
        xmlns:props="clr-namespace:TSManagementApp.Properties"
        PreviewMouseMove="Window_PreviewMouseMove"
        Closing="Window_Closing"
        mc:Ignorable="d"
        Title="Aplikace na správu časových razítek" Height="650" Width="1050"
        WindowStartupLocation="CenterScreen">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="20"/>
            <RowDefinition Height="60"/>
            <!-- {Binding ToolbarPanelIsVisible, Converter={StaticResource ConverterHideToolBar}} -->
            <RowDefinition Height="425*"/>
            <RowDefinition Height="{Binding StatePanelIsVisible, Converter={StaticResource ConverterHideStatePanel}}"/>
        </Grid.RowDefinitions>
        <Grid.Resources>
            <Style TargetType="RadioButton">
                <Setter Property="Margin" Value="5,2.5"/>
                <Setter Property="FontSize" Value="14"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>
            </Style>
            <Style TargetType="DataGrid">
                <Setter Property="BorderThickness" Value="1"/>
                <Setter Property="BorderBrush" Value="LightGray"/>
                <Setter Property="HeadersVisibility" Value="Column"/>
                <Setter Property="AutoGenerateColumns" Value="False"/>
                <Setter Property="HorizontalGridLinesBrush" Value="LightGray"/>
                <Setter Property="VerticalGridLinesBrush" Value="LightGray"/>
                <Setter Property="IsReadOnly" Value="True"/>
                <Setter Property="SelectionMode" Value="Single"/>
                <Setter Property="SelectionUnit" Value="FullRow"/>
            </Style>
            <Style TargetType="TextBox">
                <Setter Property="TextWrapping" Value="Wrap"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>
                <Setter Property="IsReadOnly" Value="True"/>
                <Setter Property="BorderThickness" Value="0"/>
                <Setter Property="Margin" Value="1"/>
                <Setter Property="IsEnabled" Value="True"/>
                <Setter Property="IsReadOnly" Value="True"/>
                <Setter Property="IsInactiveSelectionHighlightEnabled" Value="False"/>
                <Setter Property="Focusable" Value="False"/>
                <Setter Property="IsHitTestVisible" Value="False"/>
                <Style.Triggers>
                    <Trigger Property="IsEnabled" Value="False">
                        <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
                        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                    </Trigger>
                </Style.Triggers>
            </Style>
            <Style TargetType="MenuItem" x:Key="Menu">
                <Setter Property="Height" Value="20"/>
                <Setter Property="Width" Value="70"/>
                <Setter Property="HorizontalContentAlignment" Value="Center"/>
                <Setter Property="BorderThickness" Value="0,0,1,0"/>
                <Setter Property="BorderBrush" Value="LightGray"/>
                <Setter Property="HorizontalAlignment" Value="Center"/>
            </Style>
            <Style TargetType="MenuItem" x:Key="SubMenu">
                <Setter Property="Height" Value="30"/>
            </Style>
            <Style TargetType="Image" x:Key="TopMenuImage">
                <Setter Property="HorizontalAlignment" Value="Center"/>
                <Setter Property="Stretch" Value="Uniform"/>
            </Style>
            <Style TargetType="TextBlock" x:Key="Atsa">
                <Setter Property="FontSize" Value="24"/>
                <Setter Property="FontWeight" Value="DemiBold"/>
                <Setter Property="VerticalAlignment" Value="Center"/>
                <Setter Property="Margin" Value="0,0,10,0"/>
            </Style>
        </Grid.Resources>
        <!-- Horní menu -->
        <Grid Grid.Row="0">
            <Menu Grid.Row="0" VerticalAlignment="Center">
                <MenuItem Header="{x:Static props:Resources.MainWindowV_Ts}" Style="{StaticResource Menu}">
                    <MenuItem Header="{x:Static props:Resources.MainWindowV_TsNew}" Command="{Binding CommandCreateNewTimestamp}" Style="{StaticResource SubMenu}" 
                              ToolTip="{x:Static props:Resources.MainWindowV_ToolTipCreateTs}">
                        <MenuItem.Icon>
                            <Image Source="../Images/TimeStampCreate.png" Style="{StaticResource TopMenuImage}"/>
                        </MenuItem.Icon>
                    </MenuItem>
                    <MenuItem Header="{x:Static props:Resources.MainWindowV_TsOpen}" ToolTip="{x:Static props:Resources.MainWindowV_ToolTipOpen}" 
                              Command="{Binding CommandOpenExistingTimeStamp}" Style="{StaticResource SubMenu}">
                        <MenuItem.Icon>
                            <Image Source="../Images/TimeStampOpen.png" Style="{StaticResource TopMenuImage}"/>
                        </MenuItem.Icon>
                    </MenuItem>
                    <MenuItem Header="{x:Static props:Resources.MainWindowV_Tsverify}" ToolTip="{x:Static props:Resources.MainWindowV_ToolTipVerify}" 
                              Command="{Binding CommandVerifyTimeStamp}" Style="{StaticResource SubMenu}">
                        <MenuItem.Icon>
                            <Image Source="../Images/TimeStampVerify.png" Style="{StaticResource TopMenuImage}"/>
                        </MenuItem.Icon>
                    </MenuItem>
                    <MenuItem Header="{x:Static props:Resources.MainWindowV_TsClose}" ToolTip="{x:Static props:Resources.MainWindowV_ToolTipClose}" 
                              Command="{Binding CommandDeleteTimeStampFromList}" Style="{StaticResource SubMenu}">
                        <MenuItem.Icon>
                            <Image Source="../Images/TimeStampClose.png" Style="{StaticResource TopMenuImage}"/>
                        </MenuItem.Icon>
                    </MenuItem>
                    <Separator/>
                    <MenuItem Header="{x:Static props:Resources.MainWindowV_Print}" ToolTip="{x:Static props:Resources.MainWindowV_ToolTipPrint}" 
                              Command="{Binding CommandPrintCurrentUserControl}" Style="{StaticResource SubMenu}">
                        <MenuItem.Icon>
                            <Image Source="../Images/Printer.png" Style="{StaticResource TopMenuImage}"/>
                        </MenuItem.Icon>
                    </MenuItem>
                    <MenuItem Header="{x:Static props:Resources.MainWindowV_PrintPreview}" ToolTip="{x:Static props:Resources.MainWindowV_ToolTipPrintPreview}" Style="{StaticResource SubMenu}" Command="{Binding CommandPrinPreviewCurrentUserControl}">
                        <MenuItem.Icon>
                            <Image Source="../Images/Printer.png" Style="{StaticResource TopMenuImage}"/>
                        </MenuItem.Icon>
                    </MenuItem>
                    <MenuItem Header="{x:Static props:Resources.MainWindowV_Exit}" ToolTip="{x:Static props:Resources.MainWindowV_ToolTipExit}" 
                              Command="{Binding CommandExitApp}" Style="{StaticResource SubMenu}">
                        <MenuItem.Icon>
                            <Image Source="../Images/Exit.png" Style="{StaticResource TopMenuImage}"/>
                        </MenuItem.Icon>
                    </MenuItem>
                </MenuItem>
                <MenuItem Header="{x:Static props:Resources.MainWindowV_Show}" Style="{StaticResource Menu}">
                    <MenuItem IsCheckable="True" Header="{x:Static props:Resources.MainWindowV_Toolbar}" Style="{StaticResource SubMenu}" 
                              ToolTip="{x:Static props:Resources.MainWindowV_ToolTipToolbar}" IsChecked="{Binding ToolbarPanelIsVisible, Mode=TwoWay}"/>
                    <MenuItem IsCheckable="True" Header="{x:Static props:Resources.MainWindowV_StatePanel}" Style="{StaticResource SubMenu}" 
                              ToolTip="{x:Static props:Resources.MainWindowV_ToolTipStatePanel}" IsChecked="{Binding StatePanelIsVisible, Mode=TwoWay}"/>
                    <MenuItem IsCheckable="True" Header="{x:Static props:Resources.MainWindowV_ListPanel}" Style="{StaticResource SubMenu}" 
                              ToolTip="{x:Static props:Resources.MainWindowV_ToolTipListPanel}" IsChecked="{Binding ListPanelIsVisible, Mode=TwoWay}"/>
                </MenuItem>
                <MenuItem Header="{x:Static props:Resources.MainWindowV_Utils}" Style="{StaticResource Menu}">
                    <MenuItem Header="{x:Static props:Resources.MainWindowV_Settings}" ToolTip="{x:Static props:Resources.MainWindowV_ToolTipSettings}" 
                              Style="{StaticResource SubMenu}" Command="{Binding CommandGoUcSettings}">
                        <MenuItem.Icon>
                            <Image Source="../Images/Settings.png"/>
                        </MenuItem.Icon>
                    </MenuItem>
                </MenuItem>
                <MenuItem Header="{x:Static props:Resources.MainWindowV_Help}" Style="{StaticResource Menu}">
                    <MenuItem Header="{x:Static props:Resources.MainWindowV_AboutApp}" ToolTip="{x:Static props:Resources.MainWindowV_ToolTipAboutApp}" 
                              Style="{StaticResource SubMenu}" Command="{Binding CommandGoUcAbout}">
                        <MenuItem.Icon>
                            <Image Source="../Images/Home.png"/>
                        </MenuItem.Icon>
                    </MenuItem>
                </MenuItem>
            </Menu>
        </Grid>
        <!-- Toolbar -->
        <Grid Grid.Row="1" Visibility="{Binding ToolbarPanelIsVisible, 
            Converter={StaticResource ConverterBool2Visibility}}">
            <ToolBarTray Background="Transparent" VerticalAlignment="Stretch">
                <ToolBar Loaded="ToolBar_Loaded" ToolBarTray.IsLocked="True" Margin="0,5">
                    <Button  ToolTip="{x:Static props:Resources.MainWindowV_ToolTipCreateTs}" Command="{Binding CommandCreateNewTimestamp}">
                        <StackPanel>
                            <Image Source="../Images/TimeStampCreate.png" Height="30" Width="50"/>
                            <TextBlock Text="{x:Static props:Resources.MainWindowV_TsNew}" TextAlignment="Center"/>
                        </StackPanel>
                    </Button>
                    <Separator/>
                    <Button ToolTip="{x:Static props:Resources.MainWindowV_ToolTipOpen}" Command="{Binding CommandOpenExistingTimeStamp}">
                        <StackPanel>
                            <Image Source="../Images/TimeStampOpen.png" Height="30" Width="50"/>
                            <TextBlock Text="{x:Static props:Resources.MainWindowV_TsOpen}" TextAlignment="Center"/>
                        </StackPanel>
                    </Button>
                    <Separator/>
                    <Button ToolTip="{x:Static props:Resources.MainWindowV_ToolTipVerify}" Command="{Binding CommandVerifyTimeStamp}">
                        <StackPanel>
                            <Image Source="../Images/TimeStampVerify.png" Height="30" Width="50"/>
                            <TextBlock Text="{x:Static props:Resources.MainWindowV_Tsverify}" TextAlignment="Center"/>
                        </StackPanel>
                    </Button>
                    <Separator/>
                    <Button ToolTip="{x:Static props:Resources.MainWindowV_ToolTipClose}" Command="{Binding CommandDeleteTimeStampFromList}">
                        <StackPanel>
                            <Image Source="../Images/TimeStampClose.png" Height="30" Width="50"/>
                            <TextBlock Text="{x:Static props:Resources.MainWindowV_TsClose}" TextAlignment="Center"/>
                        </StackPanel>
                    </Button>
                    <Separator/>
                    <Button ToolTip="{x:Static props:Resources.MainWindowV_ToolTipSettings}" Command="{Binding CommandGoUcSettings}">
                        <StackPanel>
                            <Image Source="../Images/Settings.png" Height="30" Width="50"/>
                            <TextBlock Text="{x:Static props:Resources.MainWindowV_Settings}" TextAlignment="Center"/>
                        </StackPanel>
                    </Button>
                    <Separator/>
                    <Button ToolTip="{x:Static props:Resources.MainWindowV_ToolTipPrint}" Command="{Binding CommandPrintCurrentUserControl}">
                        <StackPanel>
                            <Image Source="../Images/Printer.png" Height="30" Width="50"/>
                            <TextBlock Text="{x:Static props:Resources.MainWindowV_Print}" TextAlignment="Center"/>
                        </StackPanel>
                    </Button>
                    <Separator/>
                    <Button ToolTip="{x:Static props:Resources.MainWindowV_ToolTipAboutApp}" Command="{Binding CommandGoUcAbout}">
                        <StackPanel>
                            <Image Source="../Images/Home.png" Height="30" Width="50"/>
                            <TextBlock Text="{x:Static props:Resources.MainWindowV_AboutApp}" TextAlignment="Center"/>
                        </StackPanel>
                    </Button>
                    <Separator/>
                    <Button ToolTip="{x:Static props:Resources.MainWindowV_ToolTipExit}" Command="{Binding CommandExitApp}">
                        <StackPanel>
                            <Image Source="../Images/Exit.png" Height="30" Width="50"/>
                            <TextBlock Text="{x:Static props:Resources.MainWindowV_Exit}" TextAlignment="Center"/>
                        </StackPanel>
                    </Button>
                </ToolBar>
            </ToolBarTray>
        </Grid>
        <!-- Content -->
        <Grid Grid.Row="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="250"/>
                <!--{Binding ListPanelIsVisible, Converter={StaticResource ConverterHideListPanel}}-->
                <ColumnDefinition Width="1"/>
                <ColumnDefinition Width="654*"/>
                <ColumnDefinition Width="137*"/>
            </Grid.ColumnDefinitions>
            <!-- Seznam časových razítek -->
            <DataGrid Grid.Column="0" ItemsSource="{Binding TimeStamps}" SelectedItem="{Binding SelectedTimeStamp}" 
                      Visibility="{Binding ListPanelIsVisible, Converter={StaticResource ConverterBool2Visibility}}">
                <DataGrid.Columns>
                    <DataGridTemplateColumn Header="{x:Static props:Resources.MainWindowV_FileWithTs}" Width="*">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBox Text="{Binding TimeStampFileName, Mode=OneWay}"/>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Header="{x:Static props:Resources.MainWindowV_UtcTime}" Width="*">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBox Text="{Binding GenTime, Mode=OneWay}"/>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                </DataGrid.Columns>
            </DataGrid>
            <!-- GridSplitter mezi jednotlivými obrazovkami -->
            <GridSplitter Grid.Column="1" Background="Gainsboro" HorizontalAlignment="Stretch" />
            <Grid Grid.Column="2" Grid.ColumnSpan="2">
                <Grid.RowDefinitions>
                    <RowDefinition Height="30*" MaxHeight="80"/>
                    <RowDefinition Height="148*"/>
                </Grid.RowDefinitions>
                <DockPanel Grid.Row="0">
                    <DockPanel.Background>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                            <GradientStop Color="{StaticResource LogoDarkBlue}" Offset="0"/>
                            <GradientStop Color="{StaticResource LogoLightBlue}" Offset="1"/>
                        </LinearGradientBrush>
                    </DockPanel.Background>
                    <TextBlock Text="{x:Static props:Resources.MainWindowV_LogoTitle}" FontSize="21" Foreground="White" VerticalAlignment="Center"
                               HorizontalAlignment="Center"/>
                </DockPanel>
                <UserControl HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
                             Grid.Row="1" Content="{Binding CurrentUserControl}" Margin="5,0"/>
            </Grid>
        </Grid>
        <!-- Status bar -->
        <StatusBar Grid.Row="3" Visibility="{Binding StatePanelIsVisible, Converter={StaticResource ConverterBool2Visibility}}">
            <StatusBarItem>
                <TextBlock Text="{Binding HoverToolTip, RelativeSource={RelativeSource AncestorType=Window}}"/>
            </StatusBarItem>
        </StatusBar>
    </Grid>
</Window>
