<Window x:Class="HandBrakeWPF.Views.QueueView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Converters="clr-namespace:HandBrakeWPF.Converters"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
        xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:Audio="clr-namespace:HandBrakeWPF.Converters.Audio"
        xmlns:Subtitles="clr-namespace:HandBrakeWPF.Converters.Subtitles"
        xmlns:video="clr-namespace:HandBrakeWPF.Converters.Video"
        xmlns:commands="clr-namespace:HandBrakeWPF.Commands"
        xmlns:helpers="clr-namespace:HandBrakeWPF.Helpers"
        xmlns:Properties="clr-namespace:HandBrakeWPF.Properties"
        xmlns:queue="clr-namespace:HandBrakeWPF.Converters.Queue"
        xmlns:main="clr-namespace:HandBrakeWPF.Converters.Main"
        Title="{Binding Title}"
        Width="975"
        Height="550"
        MinWidth="400"
        MinHeight="300"
        WindowStartupLocation="CenterScreen"
        TextOptions.TextFormattingMode="Display"
        mc:Ignorable="d">

    <Window.Resources>
        <Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
        <Converters:FullPathToFileNameConverter x:Key="filePathToFilenameConverter" />
        <Converters:EnumComboConverter x:Key="enumComboConverter" />
        <Converters:InverseBooleanConverter x:Key="notBooleanConverter" />
        <Audio:AudioQueueDisplayConverter x:Key="audioTrackDisplayConverter" />
        <Subtitles:SubtitlesQueueDisplayConverter x:Key="subtitleTrackDisplayConverter" />
        <video:EncoderOptionsTooltipConverter x:Key="encoderOptionsTooltipConverter" />
        <video:VideoOptionsTooltipConverter x:Key="videoOptionsTooltipConverter" />
        <queue:PictureSettingsDescConverter x:Key="pictureSettingsDescConverter" />
        <queue:FilterSettingsDescConverter x:Key="filterSettingsDescConverter" />
        <Converters:ThemeImageConverter x:Key="themeConverter" />
        <main:PointToPointConverter x:Key="PointToPointConverter" />

        <Style x:Key="LongToolTipHolder" TargetType="FrameworkElement">
            <Setter Property="ToolTipService.ShowDuration" Value="10000" />
        </Style>

        <Style x:Key="RotatingImageStyle" TargetType="{x:Type Image}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Status, Converter={StaticResource enumComboConverter}}" Value="Waiting">
                    <Setter Property="Source" Value="{Binding Converter={StaticResource themeConverter}, ConverterParameter='Source.png'}" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Status, Converter={StaticResource enumComboConverter}}" Value="In Progress">
                    <Setter Property="Source" Value="Images/Working0.png" />
                    <DataTrigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard Timeline.DesiredFrameRate="10">
                                <DoubleAnimation Duration="0:0:2" To="180" Storyboard.TargetProperty="(Image.LayoutTransform).(RotateTransform.Angle)" RepeatBehavior="Forever" />
                            </Storyboard>
                        </BeginStoryboard>
                    </DataTrigger.EnterActions>
                    <DataTrigger.ExitActions>
                        <BeginStoryboard>
                            <Storyboard Timeline.DesiredFrameRate="10">
                                <DoubleAnimation Duration="0:0:0" To="0" Storyboard.TargetProperty="(Image.LayoutTransform).(RotateTransform.Angle)"/>
                            </Storyboard>
                        </BeginStoryboard>
                    </DataTrigger.ExitActions>
                </DataTrigger>
                <DataTrigger Binding="{Binding Status, Converter={StaticResource enumComboConverter}}" Value="Completed">
                    <Setter Property="Source" Value="Images/Complete.png" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Status, Converter={StaticResource enumComboConverter}}" Value="Error">
                    <Setter Property="Source" Value="Images/WarningSmall.png" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Status, Converter={StaticResource enumComboConverter}}" Value="Cancelled">
                    <Setter Property="Source" Value="Images/WarningSmall.png" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Status, Converter={StaticResource enumComboConverter}}" Value="Paused">
                    <Setter Property="Source" Value="Images/pause_small.png" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

    </Window.Resources>

    <Grid>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Grid HorizontalAlignment="Stretch" Grid.Row="0" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <TextBlock Text="{x:Static Properties:Resources.MainView_ShowQueue}" Style="{StaticResource windowTitle}"  Margin="10,0,0,0" />
            <TextBlock Text="{Binding JobsPending}"  Grid.Column="1" Margin="15,0,0,5 " VerticalAlignment="Bottom" TextWrapping="WrapWithOverflow" TextTrimming="CharacterEllipsis" />
        </Grid>

        <Grid Grid.Row="2" Margin="0,15,0,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="3*" MaxWidth="750" x:Name="leftTabPanel" />
                <ColumnDefinition Width="4*" x:Name="rightTabPanel"  />
            </Grid.ColumnDefinitions>

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <Grid Grid.Row="0"  HorizontalAlignment="Stretch" Margin="10,0,5,5">

                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>

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

                    <Button Name="Start" AutomationProperties.Name="Start Queue" Command="{Binding RelayCommand}" CommandParameter="StartQueue" Grid.Column="0"
                                IsEnabled="{Binding IsQueueRunning, Converter={StaticResource notBooleanConverter}}"
                                Visibility="{Binding IsQueueRunning, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}">
                        <StackPanel Orientation="Horizontal">
                            <Image Width="16" Height="16" Margin="2,0,0,0" Source="Images/Play.png"  />
                            <Label Margin="5,0,5,0" VerticalAlignment="Center" Content="{x:Static Properties:Resources.QueueView_Start}" />
                        </StackPanel>
                    </Button>

                    <StackPanel Grid.Column="1" Orientation="Horizontal">
                        <Button Name="Pause" AutomationProperties.Name="{x:Static Properties:Resources.QueueView_Pause}" Command="{Binding RelayCommand}" CommandParameter="PauseQueueToolbar"
                                Visibility="{Binding IsQueueRunning, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}">
                            <StackPanel Orientation="Horizontal">
                                <Image Width="16" Height="16" Margin="2,0,0,0" Source="Images/Pause.png" />
                                <Label Margin="5,0,0,0" VerticalAlignment="Center" Content="{x:Static Properties:Resources.QueueView_Pause}" />
                            </StackPanel>
                        </Button>

                        <Button Name="Stop" AutomationProperties.Name="{x:Static Properties:Resources.QueueView_Stop}" Command="{Binding RelayCommand}" CommandParameter="StopQueue"
                                Visibility="{Binding IsQueueRunning, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}"
                                Margin="5,0,0,0">
                            <StackPanel Orientation="Horizontal">
                                <Image Width="16" Height="16" Margin="2,0,0,0" Source="Images/stop.png" />
                                <Label Margin="5,0,0,0" VerticalAlignment="Center" Content="{x:Static Properties:Resources.QueueView_Stop}" />
                            </StackPanel>
                        </Button>
                    </StackPanel>

                    <Menu HorizontalAlignment="Right" Background="Transparent" VerticalAlignment="Bottom" Grid.Column="3" Margin="0,0,0,0" >
                        <MenuItem>
                            <MenuItem.Header>
                                <StackPanel Height="27" Orientation="Horizontal">
                                    <Image Source="{Binding Converter={StaticResource themeConverter}, ConverterParameter='Advanced.png'}" Width="20" Height="20" VerticalAlignment="Center" />
                                    <TextBlock VerticalAlignment="Center"
                                       Text="{x:Static Properties:Resources.QueueView_Options}" Margin="5,0,0,0" />
                                    <Path Height="5"
                                  Margin="2,2,0,0"
                                  Data="M 0 0 L 4 4 L 8 0 Z"
                                  Fill="{DynamicResource ButtonGlyphBrush}" />
                                </StackPanel>
                            </MenuItem.Header>
                            <MenuItem Command="{Binding RelayCommand}" CommandParameter="ResetFailed" Header="{x:Static Properties:Resources.QueueView_ResetFailed}" />
                            <MenuItem Command="{Binding RelayCommand}" CommandParameter="ResetSelectedJobs" Header="{x:Static Properties:Resources.QueueView_ResetSelectedJobs}" />
                            <MenuItem Command="{Binding RelayCommand}" CommandParameter="ResetAllJobs" Header="{x:Static Properties:Resources.QueueView_ResetAllJobs}" />
                            <Separator />
                            <MenuItem Command="{Binding RelayCommand}" CommandParameter="ClearCompleted" Header="{x:Static Properties:Resources.QueueView_ClearCompleted}" />
                            <MenuItem Command="{Binding RelayCommand}" CommandParameter="Clear" Header="{x:Static Properties:Resources.QueueView_ClearAll}" />
                            <MenuItem Command="{Binding RelayCommand}" CommandParameter="RemoveSelectedJobs" Header="{x:Static Properties:Resources.QueueView_ClearSelected}" />
                            <Separator />
                            <MenuItem Command="{Binding RelayCommand}" CommandParameter="Import" Header="{x:Static Properties:Resources.QueueView_Import}" />
                            <MenuItem Command="{Binding RelayCommand}" CommandParameter="Export" Header="{x:Static Properties:Resources.QueueView_Export}" />
                            <Separator />
                            <MenuItem Command="{Binding RelayCommand}" CommandParameter="ExportCli" Header="{x:Static Properties:Resources.QueueView_ExportCLI}" />
                            <Separator Visibility="{Binding IsNightly, Converter={StaticResource boolToVisConverter}}" />
                            <MenuItem Header="Debug" Visibility="{Binding IsNightly, Converter={StaticResource boolToVisConverter}}">
                                <MenuItem Header="{x:Static Properties:Resources.Debug_QueueDataExport}" Command="{Binding QueueExtractResultDataCommand}" />
                            </MenuItem>
                        </MenuItem>
                    </Menu>
                </Grid>

                <ListBox Tag="{Binding}" x:Name="queueJobs" Grid.Row="1" Margin="10,0,5,0"
                             dd:DragDrop.DropHandler="{Binding}"
                             dd:DragDrop.IsDragSource="True"
                             dd:DragDrop.IsDropTarget="True"
                             ItemsSource="{Binding QueueTasks, Mode=OneWay}"
                             helpers:ListBoxHelper.SelectedItems="{Binding SelectedItems}" 
                             SelectedItem="{Binding SelectedTask}"
                             SelectionMode="Extended"
                             BorderThickness="1"
                             ScrollViewer.HorizontalScrollBarVisibility="Disabled" >

                    <ListBox.CommandBindings>
                        <CommandBinding Command="Delete" Executed="DeleteItem_OnClick" />
                    </ListBox.CommandBindings>

                    <ListBox.ContextMenu>
                        <ContextMenu Opened="ContextMenu_OnOpened">
                            <MenuItem Header="{x:Static Properties:Resources.QueueView_PlayMediaFile}" Command="{Binding RelayCommand}" CommandParameter="PlayFile" />
                            <Separator />
                            <MenuItem Header="{x:Static Properties:Resources.QueueView_MoveToTop}" x:Name="moveToTopMenuItem" Command="{Binding RelayCommand}" CommandParameter="MoveToTop" />
                            <MenuItem Header="{x:Static Properties:Resources.QueueView_MoveToBottom}" x:Name="moveToBottomMenuItem" Command="{Binding RelayCommand}" CommandParameter="MoveToBottom" />
                            <Separator />
                            <MenuItem Header="{x:Static Properties:Resources.QueueView_Reset}" x:Name="ResetMenuItem" Click="QueueItem_Retry" />
                            <MenuItem Header="{x:Static Properties:Resources.QueueView_Delete}" x:Name="DeleteMenuItem" Click="QueueItem_Delete" />
                            <Separator />
                            <MenuItem Header="{x:Static Properties:Resources.QueueView_Edit}" x:Name="EditMenuItem" Click="QueueItem_Edit" />
                            <Separator />
                            <MenuItem Header="{x:Static Properties:Resources.QueueView_OpenSourceDir}" x:Name="openSourceDir" Click="OpenSourceDir_OnClick" />
                            <MenuItem Header="{x:Static Properties:Resources.QueueView_OpenDestDir}" x:Name="openDestDir" Click="OpenDestDir_OnClick" />

                        </ContextMenu>
                    </ListBox.ContextMenu>

                    <ListBox.ItemContainerStyle>
                        <Style TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource {x:Type ListBoxItem}}">
                            <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                            <Setter Property="Margin" Value="0,0,0,1" />
                        </Style>
                    </ListBox.ItemContainerStyle>

                    <ListBox.ItemTemplate>
                        <DataTemplate x:Name="QueueItemTemplate">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>

                                <Grid Visibility="{Binding IsBreakpointTask, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="40" />
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>

                                    <!--  Marker  -->
                                    <Image Grid.Column="0" Width="16" Height="16" SnapsToDevicePixels="True" Style="{StaticResource RotatingImageStyle}">
                                        <Image.LayoutTransform>
                                            <RotateTransform CenterX="8" CenterY="8" Angle="0"/>
                                        </Image.LayoutTransform>
                                    </Image>

                                    <!--  Settings  -->
                                    <Grid Grid.Column="1" Margin="0,3,5,3" VerticalAlignment="Center" MinHeight="27">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto" />
                                        </Grid.RowDefinitions>

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

                                        <StackPanel Grid.Row="0" Grid.Column="0"  VerticalAlignment="Center">
                                            <TextBlock Text="{Binding Task.Destination, Converter={StaticResource filePathToFilenameConverter}}"
                                                   TextWrapping="Wrap" VerticalAlignment="Center" Margin="0,0,5,0"   />

                                            <ProgressBar Minimum="0" Height="4" Maximum="100" Name="pbStatus" HorizontalAlignment="Stretch" Margin="0,8,10,0"
                                                     Value="{Binding JobProgress.ProgressValue}" IsIndeterminate="{Binding JobProgress.IntermediateProgress}"
                                                     Visibility="{Binding ShowEncodeProgress, Converter={StaticResource boolToVisConverter}}" />
                                        </StackPanel>

                                        <Button Grid.Row="0" Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,0,0,0" Click="QueueDeleteJob_OnClick"
                                            AutomationProperties.Name="{x:Static Properties:ResourcesTooltips.QueueView_DeleteJob}" ToolTip="{x:Static Properties:ResourcesTooltips.QueueView_DeleteJob}" >
                                            <Button.Template>
                                                <ControlTemplate>
                                                    <Image Width="16" Height="16" VerticalAlignment="Center" Source="Images/close64.png" />
                                                </ControlTemplate>
                                            </Button.Template>
                                        </Button>
                                    </Grid>
                                </Grid>

                                <Grid Visibility="{Binding IsBreakpointTask, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="40" />
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>

                                    <!--  Marker  -->
                                    <Image Source="Images/stop.png" Grid.Column="0" Width="16" Height="16" SnapsToDevicePixels="True" />

                                    <!--  Settings  -->
                                    <Grid Grid.Column="1" Margin="0,3,5,3" VerticalAlignment="Center" MinHeight="27">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="Auto" />
                                        </Grid.ColumnDefinitions>

                                        <TextBlock Text="Stop" Grid.Column="0" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Center" />
                                    </Grid>
                                    
                                </Grid>
                            </Grid>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>

                <Border BorderThickness="1,0,1,1" BorderBrush="DarkGray" Grid.Row="2" Margin="10,0,5,10" SnapsToDevicePixels="True" >
                    <Menu HorizontalAlignment="Center" VerticalAlignment="Center" Background="Transparent"   
                              AutomationProperties.Name="{x:Static Properties:Resources.QueueView_WhenDone}">
                        <MenuItem>
                            <MenuItem.Header>
                                <StackPanel Height="32" Orientation="Horizontal">
                                    <TextBlock VerticalAlignment="Center"
                                               FontWeight="Bold"
                                               Text="{x:Static Properties:Resources.QueueView_WhenDone}" />
                                    <Label Margin="8,0,0,0"
                                           VerticalAlignment="Center"
                                           Content="{Binding WhenDoneAction, Converter={StaticResource enumComboConverter}}" />
                                    <Path Height="5"
                                          Margin="2,2,2,0"
                                          Data="M 0 0 L 4 4 L 8 0 Z"
                                          Fill="{DynamicResource ButtonGlyphBrush}" />
                                </StackPanel>
                            </MenuItem.Header>

                            <MenuItem x:Name="doNothing" Command="{Binding DataContext.WhenDoneCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="0" Header="{x:Static Properties:Resources.WhenDone_DoNothing}" />
                            <MenuItem x:Name="shutdown" Command="{Binding DataContext.WhenDoneCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="1" Header="{x:Static Properties:Resources.WhenDone_Shutdown}" />
                            <MenuItem x:Name="suspend" Command="{Binding DataContext.WhenDoneCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="2" Header="{x:Static Properties:Resources.WhenDone_Suspend}" />
                            <MenuItem x:Name="hibernate" Command="{Binding DataContext.WhenDoneCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="3" Header="{x:Static Properties:Resources.WhenDone_Hibernate}"/>
                            <MenuItem x:Name="lock" Command="{Binding DataContext.WhenDoneCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="4" Header="{x:Static Properties:Resources.WhenDone_LockSystem}" />
                            <MenuItem x:Name="logoff" Command="{Binding DataContext.WhenDoneCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="5" Header="{x:Static Properties:Resources.WhenDone_Logoff}"/>
                            <MenuItem x:Name="quit" Command="{Binding DataContext.WhenDoneCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="6" Header="{x:Static Properties:Resources.WhenDone_QuitHandBrake}"/>
                        </MenuItem>
                    </Menu>
                </Border>
            </Grid>

            <TabControl x:Name="summaryTabControl"  Grid.Column="1"  Margin="5,0,10,10" SelectedIndex="{Binding SelectedTabIndex}" >
                <TabItem Header="{x:Static Properties:Resources.QueueView_Summary}" IsEnabled="{Binding JobInfoVisible}" >
                    <ScrollViewer VerticalScrollBarVisibility="Auto" Margin="5,5,0,5">

                        <StackPanel>
                            <TextBlock Text="{x:Static Properties:Resources.QueueView_JobInformationNotAvailable}" Margin="0,10,0,0" 
                                       Visibility="{Binding JobInfoVisible, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />

                            <StackPanel Orientation="Vertical"  Margin="5,5,0,5" Visibility="{Binding JobInfoVisible, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}">

                                <StackPanel Orientation="Horizontal" >

                                    <StackPanel.Resources>
                                        <Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
                                            <Setter Property="Padding" Value="8,2" />
                                        </Style>
                                    </StackPanel.Resources>

                                    <Button AutomationProperties.Name="{x:Static Properties:Resources.QueueView_Reset}"  ToolTip="{x:Static Properties:ResourcesTooltips.QueueView_ResetJobStatus}">
                                        <Button.Content>
                                            <StackPanel Orientation="Horizontal">
                                                <Image Width="20" Height="20" VerticalAlignment="Center" Margin="0,0,5,0"
                                               Source="{Binding Converter={StaticResource themeConverter}, ConverterParameter='Refresh.png'}">
                                                </Image>
                                                <TextBlock Text="{x:Static Properties:Resources.QueueView_Reset}" VerticalAlignment="Center" />
                                            </StackPanel>

                                        </Button.Content>
                                        <i:Interaction.Triggers>
                                            <i:EventTrigger EventName="Click">
                                                <i:InvokeCommandAction Command="{Binding DataContext.RetryCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="{Binding SelectedTask}" />
                                            </i:EventTrigger>
                                        </i:Interaction.Triggers>
                                    </Button>

                                    <Button Margin="10,0,0,0" AutomationProperties.Name="{x:Static Properties:Resources.QueueView_Edit}" ToolTip="{x:Static Properties:ResourcesTooltips.QueueView_SendJobBack}">
                                        <Button.Content>
                                            <StackPanel Orientation="Horizontal">
                                                <Image Width="20" Margin="0,0,5,0" Height="20" VerticalAlignment="Center"
                                               Source="{Binding Converter={StaticResource themeConverter}, ConverterParameter='New.png'}">
                                                </Image>
                                                <TextBlock Text="{x:Static Properties:Resources.QueueView_Edit}" VerticalAlignment="Center" />
                                            </StackPanel>
                                        </Button.Content>
                                        <i:Interaction.Triggers>
                                            <i:EventTrigger EventName="Click">
                                                <i:InvokeCommandAction Command="{Binding DataContext.EditCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="{Binding SelectedTask}" />
                                            </i:EventTrigger>
                                        </i:Interaction.Triggers>
                                    </Button>

                                    <Button x:Name="queueOptionsDropButton" Margin="10,0,0,0" Click="QueueOptionsDropButton_OnClick"
                                        AutomationProperties.Name="{x:Static Properties:Resources.QueueView_Actions}" IsEnabled="{Binding CanPerformActionOnSource}">
                                        <Button.Content>
                                            <StackPanel Orientation="Horizontal">
                                                <Image Width="20" Height="20" VerticalAlignment="Center" Margin="0,0,5,0" 
                                                   Source="{Binding Converter={StaticResource themeConverter}, ConverterParameter='Advanced.png'}">
                                                </Image>

                                                <TextBlock Margin="0,0,5,0" Padding="0"
                                                       VerticalAlignment="Center"
                                                       Text="{x:Static Properties:Resources.QueueView_Actions}" />

                                                <Path Height="5" Margin="2,2,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"
                                                  Data="M 0 0 L 4 4 L 8 0 Z"
                                                  Fill="{DynamicResource ButtonGlyphBrush}" x:Name="dropdownArrowPreset" />
                                            </StackPanel>
                                        </Button.Content>

                                        <Button.ContextMenu>
                                            <ContextMenu>
                                                <MenuItem Header="{x:Static Properties:Resources.QueueView_PlayMediaFile}" Command="{Binding RelayCommand}" CommandParameter="PlayFile" />
                                                <Separator />
                                                <MenuItem Header="{x:Static Properties:Resources.QueueView_OpenSourceDir}" Command="{Binding RelayCommand}" CommandParameter="OpenSourceDir" />
                                                <MenuItem Header="{x:Static Properties:Resources.QueueView_OpenDestDir}" Command="{Binding RelayCommand}" CommandParameter="OpenDestDir" />
                                            </ContextMenu>
                                        </Button.ContextMenu>
                                    </Button>
                                </StackPanel>

                                <!-- Job Summary -->
                                <Grid Style="{StaticResource LongToolTipHolder}" Margin="0,10,0,0" >
                                    <Grid.Resources>
                                        <Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
                                            <Setter Property="Margin" Value="0,5,0,5" />
                                        </Style>
                                    </Grid.Resources>

                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>

                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" MinWidth="100" />
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>

                                    <TextBlock FontWeight="Bold" Text="Status:" VerticalAlignment="Top"  Grid.Row="0" />
                                    <TextBlock Text="{Binding SelectedTask.JobProgress.JobStatus}" TextWrapping="WrapWithOverflow" VerticalAlignment="Top" TextTrimming="CharacterEllipsis" Grid.Row="0" Grid.Column="1" />

                                    <TextBlock FontWeight="Bold" Text="{x:Static Properties:Resources.QueueView_Source}" VerticalAlignment="Top" Grid.Row="1" Grid.Column="0" />
                                    <TextBlock Text="{Binding SelectedTask.Task.Source}" TextWrapping="Wrap" Grid.Row="1" Grid.Column="1" />

                                    <TextBlock FontWeight="Bold" Text="{x:Static Properties:Resources.MainView_Title}" VerticalAlignment="Top" Grid.Row="2" Grid.Column="0" />
                                    <StackPanel Orientation="Horizontal"  Grid.Row="2" Grid.Column="1" Margin="0,0,0,0" >
                                        <TextBlock Text="{Binding SelectedTask.Task.Title}" TextWrapping="Wrap"/>
                                        <TextBlock Text="{Binding SelectedTask.Task.PointToPointMode, Converter={StaticResource PointToPointConverter}}" TextWrapping="Wrap" Margin="10,0,0,0" FontWeight="Bold"/>
                                        <TextBlock Text=":" FontWeight="Bold" />
                                        <TextBlock Text="{Binding SelectedTask.Task.StartPoint}" TextWrapping="Wrap" Margin="5,0,0,0"/>
                                        <TextBlock Text="to" TextWrapping="Wrap" Margin="5,0,5,0"/>
                                        <TextBlock Text="{Binding SelectedTask.Task.EndPoint}" TextWrapping="Wrap"/>
                                    </StackPanel>

                                    <TextBlock FontWeight="Bold" Text="{x:Static Properties:Resources.QueueView_Destination}" VerticalAlignment="Top" Grid.Row="3" Grid.Column="0" />
                                    <TextBlock Text="{Binding SelectedTask.Task.Destination}" TextWrapping="Wrap" Grid.Row="3" Grid.Column="1" />

                                    <TextBlock FontWeight="Bold" VerticalAlignment="Top" Text="{x:Static Properties:Resources.QueueView_SelectedPresets}" Grid.Row="4" Grid.Column="0"   />
                                    <TextBlock Text="{Binding SelectedTask.SelectedPresetKey}" Grid.Row="4" Grid.Column="1" />
                                    
                                    <TextBlock FontWeight="Bold" Text="{x:Static Properties:Resources.QueueView_PictureSettings}" VerticalAlignment="Top" Grid.Row="5" Grid.Column="0" />
                                    <TextBlock Text="{Binding SelectedTask.Task, Converter={StaticResource pictureSettingsDescConverter}}" TextWrapping="Wrap" Grid.Row="5" Grid.Column="1"  />

                                    <TextBlock FontWeight="Bold" Text="{x:Static Properties:Resources.QueueView_FilterSettings}" VerticalAlignment="Top" Grid.Row="6" Grid.Column="0" />
                                    <TextBlock Text="{Binding SelectedTask.Task, Converter={StaticResource filterSettingsDescConverter}}" TextWrapping="Wrap" Grid.Row="6" Grid.Column="1"  />

                                    <TextBlock FontWeight="Bold" Text="{x:Static Properties:Resources.QueueView_Video}" Grid.Row="7" Grid.Column="0" />
                                    <TextBlock Text="{Binding SelectedTask.Task, Converter={StaticResource videoOptionsTooltipConverter}}" Grid.Row="7" Grid.Column="1" TextWrapping="Wrap"  />

                                    <TextBlock FontWeight="Bold" VerticalAlignment="Top" Grid.Row="8" Grid.Column="0"  Text="{x:Static Properties:Resources.QueueView_Advanced}" />
                                    <TextBlock Text="{Binding SelectedTask.Task, Converter={StaticResource encoderOptionsTooltipConverter}}" Grid.Row="8" Grid.Column="1" TextWrapping="Wrap"  />

                                    <TextBlock FontWeight="Bold" Text="{x:Static Properties:Resources.QueueView_Audio}"  Grid.Row="9" Grid.Column="0" VerticalAlignment="Top"/>
                                    <TextBlock Text="{Binding SelectedTask.Task.AudioTracks, Converter={StaticResource audioTrackDisplayConverter}}" TextWrapping="Wrap" Grid.Row="9" Grid.Column="1" />

                                    <TextBlock FontWeight="Bold" VerticalAlignment="Top" Text="{x:Static Properties:Resources.QueueView_Subtitles}" Grid.Row="10" Grid.Column="0"   />
                                    <TextBlock Text="{Binding SelectedTask.Task.SubtitleTracks, Converter={StaticResource subtitleTrackDisplayConverter}}" Grid.Row="10" Grid.Column="1" />


                                </Grid>

                            </StackPanel>
                        </StackPanel>
                   
                    </ScrollViewer>
                </TabItem>

                <TabItem Header="{x:Static Properties:Resources.QueueView_Statistics}" IsEnabled="{Binding JobInfoVisible}" >
                    <ScrollViewer VerticalScrollBarVisibility="Auto" Margin="10,0,0,5">
                        <StackPanel>
                            <TextBlock Text="{x:Static Properties:Resources.QueueView_StatsNotAvailableYet}" Margin="0,10,0,0" Visibility="{Binding StatsVisible, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />

                            <!-- Job Stats -->
                            <TextBlock Text="Job" FontWeight="Bold" Margin="0,10,0,5" Visibility="{Binding StatsVisible, Converter={StaticResource boolToVisConverter}}" />
                            <Grid Style="{StaticResource LongToolTipHolder}" Margin="10,5,0,0" Visibility="{Binding StatsVisible, Converter={StaticResource boolToVisConverter}}">
                                <Grid.Resources>
                                    <Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
                                        <Setter Property="Margin" Value="0,5,0,5" />
                                    </Style>
                                </Grid.Resources>

                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>

                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" MinWidth="160" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>

                                <TextBlock FontWeight="Bold" Text="{x:Static Properties:Resources.QueueView_StartTime}" VerticalAlignment="Top" Grid.Row="0" Grid.Column="0" />
                                <TextBlock Text="{Binding SelectedTask.Statistics.StartTimeDisplay}" TextWrapping="Wrap" Grid.Row="0" Grid.Column="1" />

                                <TextBlock FontWeight="Bold" Text="{x:Static Properties:Resources.QueueView_EndTime}" VerticalAlignment="Top" Grid.Row="1" Grid.Column="0" />
                                <TextBlock Text="{Binding SelectedTask.Statistics.EndTimeDisplay}" TextWrapping="Wrap" Grid.Row="1" Grid.Column="1" />

                                <TextBlock FontWeight="Bold" Text="{x:Static Properties:Resources.QueueView_Duration}" VerticalAlignment="Top" Grid.Row="2" Grid.Column="0" />
                                <TextBlock Text="{Binding SelectedTask.Statistics.DurationDisplay}" TextWrapping="Wrap" Grid.Row="2" Grid.Column="1" />

                                <TextBlock FontWeight="Bold" Text="{x:Static Properties:Resources.QueueView_PausedDuration}" VerticalAlignment="Top" Grid.Row="3" Grid.Column="0" />
                                <TextBlock Text="{Binding SelectedTask.Statistics.PausedDisplay}" TextWrapping="Wrap" Grid.Row="3" Grid.Column="1" />

                                <TextBlock FontWeight="Bold" Text="{x:Static Properties:Resources.QueueView_AverageEncodeSpeed}" VerticalAlignment="Top" Grid.Row="4" Grid.Column="0" />
                                <TextBlock Text="{Binding SelectedTask.Statistics.EncodingSpeedDisplay}" TextWrapping="Wrap" Grid.Row="4" Grid.Column="1" />

                            </Grid>

                            <!-- Content Stats -->
                            <TextBlock Text="Content" FontWeight="Bold" Margin="0,10,0,5" Visibility="{Binding StatsVisible, Converter={StaticResource boolToVisConverter}}" />
                            <Grid Style="{StaticResource LongToolTipHolder}" Margin="10,5,0,0" Visibility="{Binding StatsVisible, Converter={StaticResource boolToVisConverter}}">
                                <Grid.Resources>
                                    <Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
                                        <Setter Property="Margin" Value="0,5,0,5" />
                                    </Style>
                                </Grid.Resources>

                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>

                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" MinWidth="160" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                
                                <TextBlock FontWeight="Bold" Text="{x:Static Properties:Resources.QueueView_SourceLength}" VerticalAlignment="Top" Grid.Row="0" Grid.Column="0" />
                                <TextBlock Text="{Binding SelectedTask.Statistics.SourceLength}" TextWrapping="Wrap" Grid.Row="0" Grid.Column="1" />

                                <TextBlock FontWeight="Bold" Text="{x:Static Properties:Resources.QueueView_Length}" VerticalAlignment="Top" Grid.Row="1" Grid.Column="0" />
                                <TextBlock Text="{Binding SelectedTask.Statistics.ContentLength}" TextWrapping="Wrap" Grid.Row="1" Grid.Column="1" />

                                <TextBlock FontWeight="Bold" Text="{x:Static Properties:Resources.QueueView_FileSize}" VerticalAlignment="Top" Grid.Row="2" Grid.Column="0" />
                                <TextBlock Text="{Binding SelectedTask.Statistics.FileSizeDisplay}" TextWrapping="Wrap" Grid.Row="2" Grid.Column="1"  />
                            </Grid>

                        </StackPanel>
                    </ScrollViewer>
                </TabItem>

                <TabItem Header="{x:Static Properties:Resources.MainView_ActivityLog}" IsEnabled="{Binding JobInfoVisible}">
                    <TextBox ScrollViewer.VerticalScrollBarVisibility="Visible" Text="{Binding ActivityLog, Mode=OneWay}" TextWrapping="Wrap" x:Name="logText">
                        <TextBox.ContextMenu>
                            <ContextMenu>
                                <MenuItem Header="{x:Static Properties:Resources.LogView_CopyClipboard}" Command="{Binding RelayCommand}" CommandParameter="CopyLog" >
                                    <MenuItem.Icon>
                                        <Image Width="16" Source="{Binding Converter={StaticResource themeConverter}, ConverterParameter='Copy.png'}" />
                                    </MenuItem.Icon>
                                </MenuItem>
                                <MenuItem Header="{x:Static Properties:Resources.LogView_OpenLogDir}" Command="{Binding RelayCommand}" CommandParameter="OpenLogDirectory">
                                    <MenuItem.Icon>
                                        <Image Width="16" Source="{Binding Converter={StaticResource themeConverter}, ConverterParameter='Folder.png'}" />
                                    </MenuItem.Icon>
                                </MenuItem>
                            </ContextMenu>
                        </TextBox.ContextMenu>
                    </TextBox>
                </TabItem>
            </TabControl>

        </Grid>
    </Grid>
</Window>
    