<UserControl x:Class="FasdDesktopUi.Basics.UserControls.TimerView"
             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:FasdDesktopUi.Basics.UserControls"
             xmlns:config="clr-namespace:C4IT.FASD.Base;assembly=F4SD-Cockpit-Client-Base"
             xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"  
             xmlns:vd="clr-namespace:FasdDesktopUi.Basics.Converter"
             xmlns:vc="clr-namespace:C4IT.MultiLanguage;assembly=F4SD-Cockpit-Client-Base"
             mc:Ignorable="d"

             Initialized="UserControl_Initialized">        

    <UserControl.Resources>
        <vd:LanguageDefinitionsConverter x:Key="LanguageConverter"/>    
        
        <!-- Style für den Hovereffekt -->
        <Style x:Key="PauseButtonHoverStyle" TargetType="Border">
            <Setter Property="Background" Value="Transparent"/>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Background" Value="{DynamicResource Background.Menu.Icon.Hover}"/>
                </Trigger>
            </Style.Triggers>
        </Style>           
    </UserControl.Resources>

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>

        <Border Padding="8"
                Grid.Column="0"
                CornerRadius="10"
                Background="Transparent">

            <TextBlock x:Name="TimerControl"
                       VerticalAlignment="Center"
                       FontFamily="Calibri"
                       FontSize="16"
                       Margin="0 -10 10 -10"
                       ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TimerView.Time.ToolTip}"
                       Foreground="{DynamicResource Color.Menu.Icon}" />
        </Border>
        
        <Border Padding="20 5 5 5"            
                Grid.Column="1"
                Width="Auto"
                Height="33"
                Cursor="Hand"
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
                CornerRadius="5"  
                Margin="-5 0 0 0"
                ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TimerView.Pausebutton.ToolTip}"
                Style="{DynamicResource PauseButtonHoverStyle}"
                MouseLeftButtonUp="Border_MouseLeftButtonUp" TouchDown="Border_TouchDown"
                >

            <StackPanel Orientation="Horizontal"                
                        HorizontalAlignment="Center"                
                        VerticalAlignment="Center">

                <ico:AdaptableIcon Grid.Column="1"                           
                                   x:Name="PauseButton"
                                   HorizontalAlignment="Center"
                                   VerticalAlignment="Center"
                                   Margin="-15 0 5 0"                           
                                   Panel.ZIndex="2"
                                   BorderPadding="0"
                                   IconHeight="22"
                                   IconWidth="22"
                                   SelectedMaterialIcon="ic_pause_circle_outline" 
                                   IconBackgroundColor="Transparent">
                    <ico:AdaptableIcon.Resources>
                        <Style TargetType="ico:AdaptableIcon"
                               BasedOn="{StaticResource Menu.MenuBar.PinnedIcon.Pinned}">
                            <Setter Property="PrimaryIconColor"
                                    Value="{DynamicResource FontColor.Menu.Categories}"/>
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Border}, Path=IsMouseOver}" 
                                             Value="True">
                                    <Setter Property="PrimaryIconColor" 
                                            Value="{DynamicResource FontColor.Menu.Categories.Hover}"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </ico:AdaptableIcon.Resources>
                </ico:AdaptableIcon>

                <TextBlock Grid.Column="2" Text="Pause">
                    <TextBlock.Resources>
                        <Style TargetType="TextBlock">
                            <Setter Property="VerticalAlignment"
                                    Value="Center"/>
                            <Setter Property="HorizontalAlignment"
                                    Value="Center"/>
                            <Setter Property="FontSize"
                                    Value="16"/>
                            <Setter Property="Foreground"
                                    Value="{DynamicResource FontColor.Menu.Categories}"/>
                            <Setter Property="Margin"
                                    Value="0 0 0 2"/>

                            <Style.Triggers>
                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Border}, Path=IsMouseOver}"
                                             Value="True">
                                    <Setter Property="Foreground"
                                            Value="{DynamicResource FontColor.Menu.Categories.Hover}"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </TextBlock.Resources>
                </TextBlock>
            </StackPanel>
        </Border>
    </Grid>
</UserControl>
