<?xml version="1.0" encoding="utf-8"?>
<Page
    x:Class="AppControlManager.Pages.GetCIHashes"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:AppControlManager.Pages"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:controls="using:CommunityToolkit.WinUI.Controls"
    mc:Ignorable="d">

    <ScrollViewer>

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


            <controls:WrapPanel Grid.Row="0" VerticalSpacing="4" HorizontalSpacing="4" Orientation="Vertical" Margin="6,10,6,10">

                <TextBlock
                    TextWrapping="WrapWholeWords"
                    Style="{StaticResource BodyTextBlockStyle}">

                    <Span>
                        Calculate the <Italic>Code Integrity</Italic>
                            <Run Foreground="{ThemeResource SystemAccentColor}">hashes</Run>
                        of files.</Span>
                </TextBlock>

                <HyperlinkButton Content="Guide" NavigateUri="https://github.com/HotCakeX/Harden-Windows-Security/wiki/Get-Code-Integrity-Hashes" />

            </controls:WrapPanel>

            <controls:WrapPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalSpacing="10" VerticalSpacing="15" Margin="15,0,15,0" Grid.Row="1">

                <!-- Button to trigger file picker -->
                <Button x:Name="PickFileButton" Content="Browse for a file" Click="PickFile_Click"
            HorizontalAlignment="Center"
            ToolTipService.ToolTip="Click/Tap to choose a file from your device." 
            Style="{StaticResource AccentButtonStyle}"/>

                <!-- Grid for SHA1 Page -->
                <Grid HorizontalAlignment="Stretch">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <!-- Takes all available space -->
                        <ColumnDefinition Width="Auto"/>
                        <!-- Takes space for ProgressRing -->
                    </Grid.ColumnDefinitions>

                    <TextBox Header="SHA1 Page" x:Name="Sha1PageTextBox" IsReadOnly="True" HorizontalAlignment="Stretch" MinWidth="300" Margin="0,0,12,0"/>
                    <ProgressRing x:Name="Sha1PageProgressRing" Visibility="Collapsed" Grid.Column="1" Margin="0,27,0,0"/>
                </Grid>

                <!-- Grid for SHA256 Page -->
                <Grid HorizontalAlignment="Stretch">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>

                    <TextBox Header="SHA256 Page" x:Name="Sha256PageTextBox" IsReadOnly="True" HorizontalAlignment="Stretch" MinWidth="300" Margin="0,0,12,0"/>
                    <ProgressRing x:Name="Sha256PageProgressRing" Visibility="Collapsed" Grid.Column="1" Margin="0,27,0,0"/>
                </Grid>

                <!-- Grid for SHA1 Authenticode -->
                <Grid HorizontalAlignment="Stretch">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>

                    <TextBox Header="SHA1 Authenticode" x:Name="Sha1AuthenticodeTextBox" IsReadOnly="True" HorizontalAlignment="Stretch" MinWidth="300" Margin="0,0,12,0"/>
                    <ProgressRing x:Name="Sha1AuthenticodeProgressRing" Visibility="Collapsed" Grid.Column="1" Margin="0,27,0,0"/>
                </Grid>

                <!-- Grid for SHA256 Authenticode -->
                <Grid HorizontalAlignment="Stretch">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>

                    <TextBox Header="SHA256 Authenticode" x:Name="Sha256AuthenticodeTextBox" IsReadOnly="True" HorizontalAlignment="Stretch" MinWidth="300" Margin="0,0,12,0"/>
                    <ProgressRing x:Name="Sha256AuthenticodeProgressRing" Visibility="Collapsed" Grid.Column="1" Margin="0,27,0,0"/>
                </Grid>

                <!-- Grid for SHA3 384 Flat -->
                <Grid HorizontalAlignment="Stretch">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>

                    <TextBox Header="SHA3 384 Flat" x:Name="SHA3384FlatHash" IsReadOnly="True" HorizontalAlignment="Stretch" MinWidth="300" Margin="0,0,12,0"/>
                    <ProgressRing x:Name="SHA3384FlatHashProgressRing" Visibility="Collapsed" Grid.Column="1" Margin="0,27,0,0"/>
                </Grid>

                <!-- Grid for SHA3 512 Flat -->
                <Grid HorizontalAlignment="Stretch">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>

                    <TextBox Header="SHA3 512 Flat" x:Name="SHA3512FlatHash" IsReadOnly="True" HorizontalAlignment="Stretch" MinWidth="300" Margin="0,0,12,0"/>
                    <ProgressRing x:Name="SHA3512FlatHashProgressRing" Visibility="Collapsed" Grid.Column="1" Margin="0,27,0,0"/>
                </Grid>

            </controls:WrapPanel>

        </Grid>

    </ScrollViewer>

</Page>
