<Page
        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:local="clr-namespace:ForzaUI"
      x:Class="ForzaUI.CrashUploader"
      x:Name="Page"
      WindowTitle="Page"
      FlowDirection="LeftToRight"
      DataContext="{Binding RelativeSource={x:Static RelativeSource.Self}}"
      Style="{StaticResource A_Style_Page_Generic}" >
    <Page.Background>
        <SolidColorBrush Color="#FF101010" />
    </Page.Background>
    <Page.Resources>
        <Style x:Key="SmileFace" TargetType="{x:Type Path}">
            <Setter Property="Data" Value="M32,39.704002C39.487766,39.704002 46.095413,43.433239 50.098,49.125999 44.997589,45.458061 38.76125,43.27314 32,43.27314 25.23875,43.27314 19.002413,45.458061 13.902,49.125999 17.904589,43.433239 24.512236,39.704002 32,39.704002z M41.9907,22.009001C44.746445,22.009001 46.986,24.246023 46.986,27.00515 46.986,29.763077 44.746445,32 41.9907,32 39.234856,32 36.996002,29.763077 36.996002,27.00515 36.996002,24.246023 39.234856,22.009001 41.9907,22.009001z M22.00955,22.009001C24.765379,22.009001 27.005001,24.246023 27.005001,27.00515 27.005001,29.763077 24.765379,32 22.00955,32 19.253624,32 17.014,29.763077 17.014,27.00515 17.014,24.246023 19.253624,22.009001 22.00955,22.009001z M32,4.9947796C17.110001,4.9947801 4.99547,17.109301 4.99547,32 4.99547,46.890701 17.110001,59.005199 32,59.005199 46.889999,59.005199 59.005199,46.890701 59.005199,32 59.005199,17.109301 46.889999,4.9947801 32,4.9947796z M32,0C49.673199,0 64,14.3268 64,32 64,49.673199 49.673199,64 32,64 14.3268,64 0,49.673199 0,32 0,14.3268 14.3268,0 32,0z" />
            <Setter Property="Stretch" Value="Uniform" />
            <Setter Property="Fill" Value="White" />
            <Setter Property="Width" Value="68" />
            <Setter Property="Height" Value="68" />
        </Style>
        <Style x:Key="SadFace" TargetType="{x:Type Path}">
            <Setter Property="Data" Value="M13.613,38.875C18.607058,42.467495 24.713106,44.60701 31.333448,44.60701 37.953793,44.60701 44.05994,42.467495 49.054001,38.875 45.13483,44.449402 38.665386,48.102001 31.333448,48.102001 24.001511,48.102001 17.532166,44.449402 13.613,38.875z M41.115601,21.551001C43.814354,21.551001 46.007,23.740988 46.007,26.44265 46.007,29.143013 43.814354,31.333 41.115601,31.333 38.417046,31.333 36.224998,29.143013 36.224998,26.44265 36.224998,23.740988 38.417046,21.551001 41.115601,21.551001z M21.551451,21.551001C24.249977,21.551001 26.442001,23.740988 26.442001,26.44265 26.442001,29.143013 24.249977,31.333 21.551451,31.333 18.852722,31.333 16.66,29.143013 16.66,26.44265 16.66,23.740988 18.852722,21.551001 21.551451,21.551001z M31.333448,4.8906832C16.753281,4.8906832 4.8913631,16.753981 4.8913627,31.333448 4.8913631,45.913017 16.753281,57.776276 31.333448,57.776276 45.913719,57.776276 57.775574,45.913017 57.775574,31.333448 57.775574,16.753981 45.913719,4.8906832 31.333448,4.8906832z M31.333448,0C48.638233,-3.5527137E-15 62.666996,14.028767 62.666996,31.333448 62.666996,48.638233 48.638233,62.666996 31.333448,62.666996 14.028767,62.666996 -3.5527137E-15,48.638233 0,31.333448 -3.5527137E-15,14.028767 14.028767,-3.5527137E-15 31.333448,0z" />
            <Setter Property="Stretch" Value="Uniform" />
            <Setter Property="Fill" Value="White" />
            <Setter Property="Width" Value="68" />
            <Setter Property="Height" Value="68" />
        </Style>
        <Style x:Key="A_Style_Button_CrashUploader" TargetType="{x:Type local:FZButton}">
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Padding" Value="1"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type local:FZButton}">
                        <Border x:Name="border" BorderBrush="White" BorderThickness="3" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
                            <TextBlock x:Name="text" Text="{TemplateBinding Content}"
                                               FontFamily="Horizon_A"
                                               FontSize="60"
                                               HorizontalAlignment="Stretch"
                                               VerticalAlignment="Center"
                                               Foreground="White"
                                               Margin="0,-10"
                                               TextAlignment="Center"
                                               TextWrapping="Wrap"/>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsFocused" Value="false">
                                <Setter Property="Background" TargetName="border" Value="Black"/>
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Background" TargetName="border" Value="Gray"/>
                                <Setter Property="BorderBrush" TargetName="border" Value="Gray"/>
                                <Setter Property="Foreground" TargetName="text" Value="DarkGray"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Page.Resources>
    <DockPanel x:Name="PART_LayoutRoot" >
        <TextBlock FontFamily="Horizon_A"
                   FontSize="100"
                   Foreground="White"
                   Text="Opus Crash Uploader" 
                   HorizontalAlignment="Center"
                   DockPanel.Dock="Top"
                   Margin="0,40,0,0"/>

        <StackPanel VerticalAlignment="Top"
                    Orientation="Horizontal"
                    HorizontalAlignment="Right"
                    DockPanel.Dock="Bottom"
                    Margin="0,0,200,0" >
            <TextBlock FontFamily="Horizon_B"
                       FontSize="28"
                       Foreground="White"
                       Margin="50,0,0,0"
                       Text="{Binding CrashFolders.Count}" />
            <TextBlock FontFamily="Horizon_B"
                       FontSize="28"
                       Foreground="White"
                       Text=" Remaining"
                       Margin="0,0,0,30"/>
        </StackPanel>

        <DockPanel DockPanel.Dock="Top" Margin="100,20" Height="180">
            <DockPanel Height="80" DockPanel.Dock="Bottom">
                <Path Style="{StaticResource SmileFace}"
                    Margin="10,0" 
                    DockPanel.Dock="Left"/>
                <Path Style="{StaticResource SadFace}"
                    Margin="10,0" 
                    DockPanel.Dock="Right" />
                <ProgressBar Minimum="0"
                             Maximum="100"
                             Value="{Binding Current.Progress, FallbackValue=100}" />
            </DockPanel>
            <TextBlock Text="{Binding Current.Status, FallbackValue=Status}"
                        FontFamily="Horizon_A"
                        FontSize="28"
                        Foreground="White"
                        DockPanel.Dock="Bottom"/>
            <TextBlock Text="{Binding Current.Action, FallbackValue=Action}"
                        FontFamily="Horizon_A"
                        FontSize="50"
                        Foreground="White"
                        DockPanel.Dock="Left"/>
        </DockPanel>

        <TextBlock Text="Instructions: Please upload the dumps you want invesigated, you can instead delete dumps by pressing right to select which dumps to erase, or down to erase all." DockPanel.Dock="Top" FontFamily="Horizon_D" Foreground="Gray" FontSize="22" Margin="200,0"/>
        <DockPanel KeyboardNavigation.DirectionalNavigation="Contained" Margin="200,0">
            <DockPanel DockPanel.Dock="Left" Width="280">
                <local:FZButton x:Name="PART_DeleteAllButton" Content="DELETE ALL" DockPanel.Dock="Bottom" Margin="0,0,6,0" Style="{StaticResource A_Style_Button_CrashUploader}" Background="Red"/>
                <local:FZButton x:Name="PART_IgnoreButton" Content="POSTPONE" DockPanel.Dock="Bottom" Margin="0,0,6,0" Style="{StaticResource A_Style_Button_CrashUploader}" Background="Blue"/>
                <Grid Margin="0,0,6,0">
                    <local:FZButton x:Name="PART_UploadAllButton" Content="UPLOAD ALL" Style="{StaticResource A_Style_Button_CrashUploader}" Background="Green"/>
                    <TextBlock FontFamily="Horizon_B" FontSize="28" Text="{Binding AutoTimeOut}" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,10" Foreground="White" />
                </Grid>
            </DockPanel>
            <Grid>
                <local:CommonListBox
                        x:Name="PART_List"
                        IsEnabled="{Binding IsEnabled, ElementName=PART_StartButton}"
                        ItemsSource="{Binding CrashFolders}" 
                        VerticalAlignment="Stretch" 
                        HorizontalAlignment="Stretch" 
                        HorizontalContentAlignment="Stretch"
                        IsSynchronizedWithCurrentItem="True"
                        Focusable="False"
                        KeyboardNavigation.DirectionalNavigation="Continue">
                    <local:CommonListBox.Template>
                        <ControlTemplate TargetType="{x:Type ItemsControl}">
                            <Border x:Name="Bd" BorderBrush="#FFABADB3" BorderThickness="3" Background="#ff404040" Padding="1" SnapsToDevicePixels="True" >
                                <ScrollViewer Focusable="False" Padding="{TemplateBinding Padding}" VerticalScrollBarVisibility="Hidden" >
                                    <VirtualizingStackPanel Orientation="Vertical" IsItemsHost="True" />
                                </ScrollViewer>
                            </Border>
                        </ControlTemplate>
                    </local:CommonListBox.Template>
                    <local:CommonListBox.ItemTemplate>
                        <DataTemplate>
                            <DockPanel x:Name="templateRoot" Background="Transparent" SnapsToDevicePixels="True">
                                <Border BorderBrush="White" Background="Black" BorderThickness="3" Margin="3" >
                                    <Grid>
                                        <Path x:Name="deleteMark" Data="M33.977998,27.684L33.977998,58.102997 41.373998,58.102997 41.373998,27.684z M14.841999,27.684L14.841999,58.102997 22.237998,58.102997 22.237998,27.684z M4.0319996,22.433001L52.183,22.433001 52.183,63.999001 4.0319996,63.999001z M15.974,0L40.195001,0 40.195001,7.7260003 56.167001,7.7260003 56.167001,16.000999 0,16.000999 0,7.7260003 15.974,7.7260003z" 
                                          Fill="Red" Margin="1" Opacity="0" Stretch="Uniform" Width="32" Height="32" />
                                        <Path x:Name="optionMark" Data="F1 M 9.97498,1.22334L 4.6983,9.09834L 4.52164,9.09834L 0,5.19331L 1.27664,3.52165L 4.255,6.08833L 8.33331,1.52588e-005L 9.97498,1.22334 Z " 
                                              Fill="White" Margin="1" Opacity="0" Stretch="Uniform" Width="32" Height="32" />
                                    </Grid>
                                </Border>
                                <TextBlock Text="{Binding FolderName}"
                                               FontFamily="Horizon_A"
                                               FontSize="28"
                                               Foreground="White"/>
                            </DockPanel>
                            <DataTemplate.Triggers>
                                <DataTrigger Binding="{Binding IsFocused, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBoxItem}}}" Value="True">
                                    <Setter Property="Background" TargetName="templateRoot" Value="Green"/>
                                    <Setter Property="Opacity" TargetName="deleteMark" Value="1"/>
                                </DataTrigger>
                                <DataTrigger Binding="{Binding InProgress}" Value="True">
                                    <Setter Property="Opacity" TargetName="optionMark" Value="1"/>
                                </DataTrigger>
                            </DataTemplate.Triggers>
                        </DataTemplate>
                    </local:CommonListBox.ItemTemplate>
                </local:CommonListBox>
                <TextBlock Text="Congratulations, you have no crash dumps!" HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="Horizon_A" FontSize="28" Foreground="White">
                    <TextBlock.Style>
                        <Style TargetType="TextBlock">
                            <Setter Property="Visibility" Value="Collapsed" />
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding CrashFolders.Count}" Value="0">
                                    <Setter Property="Visibility" Value="Visible" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </TextBlock.Style>
                </TextBlock>
            </Grid>
        </DockPanel>
    </DockPanel>
</Page>