﻿<Page x:Class="TwitchDownloaderWPF.PageClipDownload"
      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:emoji="clr-namespace:Emoji.Wpf;assembly=Emoji.Wpf"
      xmlns:gif="http://wpfanimatedgif.codeplex.com"
      xmlns:lex="http://wpflocalizeextension.codeplex.com"
      lex:LocalizeDictionary.DesignCulture=""
      lex:ResxLocalizationProvider.DefaultAssembly="TwitchDownloaderWPF"
      lex:ResxLocalizationProvider.DefaultDictionary="Strings"
      xmlns:hc="https://handyorg.github.io/handycontrol"
      xmlns:fa="http://schemas.fontawesome.com/icons/"
      xmlns:local="clr-namespace:TwitchDownloaderWPF"
      xmlns:behave="clr-namespace:TwitchDownloaderWPF.Behaviors"
      mc:Ignorable="d"
      d:DesignHeight="400" d:DesignWidth="800"
      Title="PageClipDownload" Initialized="Page_Initialized" Loaded="Page_Loaded">
    <Page.Resources>
        <Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
            <Setter Property="behave:TextBoxTripleClickBehavior.TripleClickSelectLine" Value="True" />
        </Style>
    </Page.Resources>

    <Grid Background="{DynamicResource AppBackground}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="20"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="20"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="10"/>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="28"/>
        </Grid.RowDefinitions>
        <!-- LEFT -->
        <StackPanel Margin="0,21,0,0" Grid.Column="1" Grid.Row="2" Grid.RowSpan="2">
            <Border BorderBrush="{DynamicResource AppElementBorder}" BorderThickness="1">
                <Image Stretch="Fill" StretchDirection="Both" x:Name="imgThumbnail" MinHeight="100" />
            </Border>
            <WrapPanel Orientation="Horizontal">
                <TextBlock Margin="0,3,3,3" Text="{lex:Loc Streamer}" Foreground="{DynamicResource AppText}" />
                <TextBlock Margin="3" x:Name="textStreamer" Foreground="{DynamicResource AppText}" />
            </WrapPanel>
            <WrapPanel Orientation="Horizontal">
                <TextBlock Margin="0,3,3,3" Text="{lex:Loc VideoCreatedAt}" Foreground="{DynamicResource AppText}" />
                <TextBlock Margin="3" x:Name="textCreatedAt" Foreground="{DynamicResource AppText}" />
            </WrapPanel>
            <WrapPanel Orientation="Horizontal">
                <TextBlock Margin="0,3,3,3" Text="{lex:Loc VideoTitle}" Foreground="{DynamicResource AppText}" />
            </WrapPanel>
            <emoji:TextBlock TextWrapping="Wrap" x:Name="textTitle" Foreground="{DynamicResource AppText}" />
        </StackPanel>
        <!-- MIDDLE -->
        <WrapPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="4" Margin="0,0,0,10" Orientation="Horizontal" HorizontalAlignment="Center">
            <TextBlock Margin="3,8,3,3" Text="{lex:Loc ClipLinkId}" Foreground="{DynamicResource AppText}" />
            <TextBox x:Name="textUrl" Margin="3" MinWidth="200" MaxWidth="400" KeyDown="TextUrl_OnKeyDown" Background="{DynamicResource AppElementBackground}" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}" />
            <Button x:Name="btnGetInfo" Margin="3" MinWidth="50" Content="{lex:Loc GetInfo}" Click="btnGetInfo_Click" Background="{DynamicResource ActionButtonBackground}" Foreground="{DynamicResource ActionButtonText}" BorderBrush="{DynamicResource ActionButtonBorder}"/>
        </WrapPanel>
        <StackPanel Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" Margin="0,20,0,0" Orientation="Horizontal" HorizontalAlignment="Center">
            <StackPanel HorizontalAlignment="Left">
                <TextBlock Text="{lex:Loc Length}" HorizontalAlignment="Right" Foreground="{DynamicResource AppText}" />
                <TextBlock Text="{lex:Loc Quality}" HorizontalAlignment="Right" Margin="0,14,0,0" Foreground="{DynamicResource AppText}" />
                <TextBlock Text="{lex:Loc EncodeClipMetadata}" HorizontalAlignment="Right" Margin="0,16,0,0" Foreground="{DynamicResource AppText}" />
            </StackPanel>
            <StackPanel>
                <TextBlock x:Name="labelLength" Text="0:0:0" Margin="5,0,0,0" Foreground="{DynamicResource AppText}" />
                <ComboBox x:Name="comboQuality" Margin="5,10,0,0" MinWidth="150" Background="{DynamicResource AppElementBackground}" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}" />
                <CheckBox x:Name="CheckMetadata" Margin="5,8,0,0" Checked="CheckMetadata_OnCheckStateChanged" Unchecked="CheckMetadata_OnCheckStateChanged" BorderBrush="{DynamicResource AppElementBorder}" />
            </StackPanel>
        </StackPanel>
        <StackPanel Orientation="Horizontal" Grid.Row="3" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="0,0,0,10" VerticalAlignment="Bottom">
            <hc:SplitButton x:Name="SplitBtnDownload" Height="40" Width="120" Content="{lex:Loc Download}" Click="SplitBtnDownload_Click" Background="{DynamicResource ActionButtonBackground}" Foreground="{DynamicResource ActionButtonText}" BorderBrush="{DynamicResource ActionButtonBorder}" >
                <hc:SplitButton.DropDownContent>
                    <StackPanel>
                        <MenuItem x:Name="MenuItemEnqueue" Header="{lex:Loc EnqueueDownload}" Click="MenuItemEnqueue_Click"/>
                    </StackPanel>
                </hc:SplitButton.DropDownContent>
            </hc:SplitButton>
            <Button x:Name="BtnCancel" Height="40" MinWidth="120" Margin="0,6,0,0" Content="{lex:Loc TaskCancel}" Click="BtnCancel_Click" Visibility="Collapsed" Background="{DynamicResource ActionButtonBackground}" Foreground="{DynamicResource ActionButtonText}" BorderBrush="{DynamicResource ActionButtonBorder}"/>
        </StackPanel>
        <!-- RIGHT -->
        <StackPanel Grid.Column="4" Grid.Row="1" Grid.RowSpan="1" HorizontalAlignment="Right">
            <StackPanel Orientation="Horizontal">
                <Button fa:Awesome.Content="Solid_DollarSign" x:Name="btnDonate" ToolTip="{lex:Loc DonateTooltip}" Height="26" Width="40" Click="btnDonate_Click" Background="{DynamicResource AppElementBackground}" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}" />
                <Button fa:Awesome.Content="Solid_Cog" x:Name="btnSettings" Height="26" Width="40" Margin="4,0,0,0" Click="btnSettings_Click" Background="{DynamicResource AppElementBackground}" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}" />
            </StackPanel>
        </StackPanel>
        <StackPanel Grid.Column="4" Grid.Row="2" Grid.RowSpan="2">
            <TextBlock Text="{lex:Loc LogHeader}" Foreground="{DynamicResource AppText}" />
            <RichTextBox Margin="0,5" IsReadOnly="True" Name="textLog" Height="230" Background="{DynamicResource AppElementBackground}" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}" >
                <RichTextBox.Resources>
                    <Style TargetType="{x:Type Paragraph}">
                        <Setter Property="Margin" Value="0" />
                    </Style>
                </RichTextBox.Resources>
            </RichTextBox>
        </StackPanel>
        <!--STATUS BAR-->
        <StatusBar Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="6" Background="{DynamicResource StatusBarBackground}" BorderBrush="{DynamicResource StatusBarBorder}">
            <StatusBarItem Padding="10,5,0,5">
                <Image x:Name="statusImage" gif:ImageBehavior.AnimatedSource="Images/ppHop.gif"/>
            </StatusBarItem>
            <StatusBarItem Padding="10,1,0,1">
                <TextBlock Text="{lex:Loc StatusIdle}" x:Name="statusMessage" FontWeight="Bold" Foreground="{DynamicResource StatusBarText}"/>
            </StatusBarItem>
            <StatusBarItem Padding="10,1,10,1" HorizontalAlignment="Right">
                <ProgressBar Width="200" Height="14" x:Name="statusProgressBar" Background="{DynamicResource StatusBarElement}" Foreground="{DynamicResource ProgressBarForeground}"/>
            </StatusBarItem>
        </StatusBar>
    </Grid>
</Page>
