Templates/Wizard/AdminPassword.xaml

<!--
    THE LOCAL ADMINISTRATOR PASSWORD that goes into the answer file - the one
    value a deployment can neither invent nor proceed without.
 
    THIS PAGE EXISTS BECAUSE A REAL DEPLOYMENT STOPPED WITHOUT IT. A Latitude
    running the shipped client template reached step 6 of 11 and failed with
    "stages an answer file that asks for %HDTAdminPassword%, but nothing
    supplies it ... or on the wizard's administrator password page" - naming a
    page that did not exist. The only way through was to hand-edit rules.yaml
    on the share, which is exactly the thing a technician wizard is for.
 
    TWO BOXES, BECAUSE ONE BOX IS A TYPO NOBODY SEES. A password box shows
    dots, so the only way to know what was typed is to type it twice, and
    Test-HDTAdminPassword is what compares them.
 
    AN EYE ON EACH BOX, AND THEY ARE INDEPENDENT. Every box carries the trio
    New-HDTWizardHost wires by name - a base name plus Box, RevealBox and
    RevealToggle - because PasswordBox.Password is not a
    DependencyProperty and a reveal cannot be done declaratively. This page
    carried none for a while, and the reason given was that the wiring handled
    one pair per page. That is no longer true: Get-HDTWizardRevealPair finds
    every trio on a page and the host loops over them.
 
    THE CONFIRM BOX STAYS. It catches a typo made with the eye OFF, which is
    how the box will be filled in most of the time; a reveal is what a
    technician reaches for when the two boxes already disagree and neither will
    say why.
 
    OFF BY DEFAULT, AND THAT IS THE PART THAT MATTERS. This is the local
    Administrator password on every machine the share deploys, and a bench
    screen gets photographed, shoulder-read and left open. The eye is a
    deliberate act with the password in clear only while it is held down, not a
    state the page opens in.
 
    xmlns AND xmlns:x ARE BOTH DECLARED. A page fragment is loaded standalone
    by XamlReader, so it carries no namespace by inheritance - and one using
    x:Name without xmlns:x throws "'x' is an undeclared prefix" at load, which
    on a bench looks like a wizard that failed to open.
 
    THE BOXES CARRY NO COLOURS, AND NEITHER DO THE EYES. Every other control on
    every other page takes its brushes from HDTTheme.xaml, which templates
    ToggleButton for exactly this control; spelling them here would make this
    page the one that does not follow a retheme, and a local value beats a
    style setter so it would win silently.
-->
<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
 
    <TextBlock Grid.Row="0" Grid.Column="0" Text="Administrator password" Foreground="#FF8A8A8A"
               FontSize="13" VerticalAlignment="Center" Margin="0,0,16,8"
               ToolTip="The password for the LOCAL Administrator account on the machine being deployed." />
 
    <!--
        TWO BOXES IN ONE CELL, and only one of them visible at a time. The eye
        sits in the second column so it does not move when the boxes swap.
    -->
    <Grid Grid.Row="0" Grid.Column="1" Margin="0,0,0,8">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="380" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
 
        <PasswordBox Grid.Column="0" x:Name="HDTAdminPasswordBox"
                     Width="380" HorizontalAlignment="Left" />
 
        <TextBox Grid.Column="0" x:Name="HDTAdminPasswordRevealBox" Width="380"
                 HorizontalAlignment="Left" Visibility="Collapsed" />
 
        <ToggleButton Grid.Column="1" x:Name="HDTAdminPasswordRevealToggle"
                      Style="{DynamicResource HDTRevealEye}"
                      Width="36" Height="34" Margin="8,0,0,0"
                      ToolTip="Show the password" />
    </Grid>
 
    <TextBlock Grid.Row="1" Grid.Column="0" Text="Confirm password" Foreground="#FF8A8A8A"
               FontSize="13" VerticalAlignment="Center" Margin="0,0,16,8"
               ToolTip="Type the same password again. A password box shows dots, so this is what catches a typo." />
 
    <!--
        ITS OWN EYE, NOT A SHARED ONE. Revealing both at once turns the two
        boxes back into one box: the whole point of the confirmation is that it
        is entered independently, and a technician checking why they disagree
        wants to look at one of them at a time.
    -->
    <Grid Grid.Row="1" Grid.Column="1" Margin="0,0,0,8">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="380" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
 
        <PasswordBox Grid.Column="0" x:Name="HDTAdminPasswordConfirmBox"
                     Width="380" HorizontalAlignment="Left" />
 
        <TextBox Grid.Column="0" x:Name="HDTAdminPasswordConfirmRevealBox" Width="380"
                 HorizontalAlignment="Left" Visibility="Collapsed" />
 
        <ToggleButton Grid.Column="1" x:Name="HDTAdminPasswordConfirmRevealToggle"
                      Style="{DynamicResource HDTRevealEye}"
                      Width="36" Height="34" Margin="8,0,0,0"
                      ToolTip="Show the password" />
    </Grid>
 
    <!--
        ONE LINE, AND IT SAYS WHAT TO DO ABOUT IT. Which account this is, and
        the fact that it can be set once for every machine instead of typed on
        every deployment - which is the thing an MDT admin actually wants to
        know and the reason the page can be skipped at all.
 
        Everything else - why HDT refuses to invent one, what DESIGN 4.5.2
        says, what happens to a blank one - is in Test-HDTAdminPassword and in
        the comment above, where the next person to change this will read it
        and a technician standing at a bench will not.
    -->
    <TextBlock Grid.Row="2" Grid.Column="1" Foreground="#FF8A8A8A" FontSize="12"
               TextWrapping="Wrap" MaxWidth="380" HorizontalAlignment="Left"
               Text="Sets the local Administrator account on this machine. Put HDTAdminPassword in rules.yaml to stop being asked." />
</Grid>