<?xml version="1.0" encoding="utf-8"?>
<Page
    x:Class="AppControlManager.Pages.ValidatePolicy"
    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:ui="using:CommunityToolkit.WinUI"
    xmlns:controls="using:CommunityToolkit.WinUI.Controls"
    xmlns:tk7controls="using:CommunityToolkit.WinUI.UI.Controls"
    xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    mc:Ignorable="d">

    <Page.Resources>
        <!--  These styles can be referenced to create a consistent SettingsPage layout  -->
        <!--  Spacing between cards  -->
        <x:Double x:Key="SettingsCardSpacing">4</x:Double>
        <!--  Style (inc. the correct spacing) of a section header  -->
        <Style x:Key="SettingsSectionHeaderTextBlockStyle"
            BasedOn="{StaticResource BodyStrongTextBlockStyle}"
            TargetType="TextBlock">
            <Style.Setters>
                <Setter Property="Margin" Value="1,30,0,6" />
            </Style.Setters>
        </Style>
    </Page.Resources>

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

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

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

                    <Span>
                        Validate <Run Foreground="{ThemeResource SystemAccentColor}">App Control</Run> Policies to ensure they are compliant with the official schema.
                        If you manually modified XML policy files and want to ensure your modifications are correct, use this feature to validate them.
                    </Span>
                </TextBlock>

                <HyperlinkButton Content="Guide" NavigateUri="https://github.com/HotCakeX/Harden-Windows-Security/wiki/Validate-Policies" />

            </controls:WrapPanel>

            <InfoBar
                x:Name="MainInfoBar"
                IsOpen="False"
                IsIconVisible="True"
                IsClosable="False"
                Title="Status"
                Grid.Row="1">
            </InfoBar>

            <StackPanel HorizontalAlignment="Stretch"
                        Spacing="{StaticResource SettingsCardSpacing}" Grid.Row="2" Margin="0,40,0,0">

                <win:StackPanel.ChildrenTransitions>
                    <win:EntranceThemeTransition FromVerticalOffset="50" />
                    <win:RepositionThemeTransition IsStaggeringEnabled="False" />
                </win:StackPanel.ChildrenTransitions>

                <controls:SettingsCard Description="Browse for an App Control policy XML file to validate"
                                       x:Name="BrowseForXMLSettingsCard"
                    Header="Select Policy" IsClickEnabled="True" Click="BrowseForXMLSettingsCard_Click" IsActionIconVisible="False">

                    <Button Content="Browse" x:Name="BrowseForXMLButton" Click="BrowseForXMLButton_Click" />

                </controls:SettingsCard>

            </StackPanel>

        </Grid>

    </ScrollViewer>
</Page>
