UI/Console/HDTApplicationDependency.xaml

<!--
    WHAT AN APPLICATION HAS TO BE INSTALLED AFTER, chosen from what is on the
    share rather than typed.
 
    TYPING AN ID IS THE PROBLEM THIS WINDOW EXISTS FOR. A dependency is an
    application id in a document, and a misspelled one is not caught until a
    deployment runs, when Resolve-HDTApplicationOrder refuses the WHOLE plan -
    not just that application - on the machine in front of somebody. Picking
    from the catalog makes a missing id impossible to produce.
 
    A CHOICE THAT WOULD CLOSE A LOOP IS ON THE LIST AND CANNOT BE TICKED, with
    the loop named beside it. An entry that vanished would be a window somebody
    argues with; Get-HDTConsoleDependencyChoice decides which ones those are,
    and it follows the whole chain rather than the first step.
 
    NO ORDER IS ASKED FOR HERE, and there is nothing to ask: dependencies are a
    set, and the ORDER is computed from the whole graph by
    Resolve-HDTApplicationOrder. A list somebody could drag into an order would
    be a list whose order does nothing.
 
    NO x:Class AND NO CODE-BEHIND, as every other window here. Handlers are
    attached in PowerShell, by name.
 
    NAMED CONTROLS ARE THE CONTRACT with New-HDTConsoleHost:
    HDTDependencyTitleText, HDTDependencyRootText, HDTDependencyList,
    HDTDependencyEmptyText, HDTDependencyCommandText, HDTDependencySaveButton
    and HDTCancelButton.
-->
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Depends on"
        Width="560" Height="520"
        WindowStartupLocation="CenterOwner"
        ResizeMode="NoResize"
        ShowInTaskbar="False"
        Background="{DynamicResource HDTWindowBrush}"
        FontFamily="Segoe UI" FontSize="12">
 
    <Window.Resources>
        <SolidColorBrush x:Key="HDTWindowBrush" Color="#FFF3F3F3" />
        <SolidColorBrush x:Key="HDTBannerBrush" Color="#FF0E639C" />
        <SolidColorBrush x:Key="HDTBannerTextBrush" Color="#FFFFFFFF" />
        <SolidColorBrush x:Key="HDTBannerLabelBrush" Color="#FFD6E9F5" />
        <SolidColorBrush x:Key="HDTPanelBrush" Color="#FFFFFFFF" />
        <SolidColorBrush x:Key="HDTPanelTextBrush" Color="#FF1B1B1B" />
        <SolidColorBrush x:Key="HDTBorderBrush" Color="#FFC8C8C8" />
        <SolidColorBrush x:Key="HDTHintTextBrush" Color="#FF6B6B6B" />
        <SolidColorBrush x:Key="HDTCommandTextBrush" Color="#FF0A3069" />
        <SolidColorBrush x:Key="HDTFooterBrush" Color="#FFE8E8E8" />
        <SolidColorBrush x:Key="HDTButtonBrush" Color="#FF0E639C" />
        <SolidColorBrush x:Key="HDTButtonTextBrush" Color="#FFFFFFFF" />
 
        <Style TargetType="Button">
            <Setter Property="Background" Value="{DynamicResource HDTButtonBrush}" />
            <Setter Property="Foreground" Value="{DynamicResource HDTButtonTextBrush}" />
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="Padding" Value="14,6,14,6" />
        </Style>
    </Window.Resources>
 
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
 
        <Border Grid.Row="0" Background="{DynamicResource HDTBannerBrush}" Padding="16,12,16,12">
            <StackPanel>
                <TextBlock x:Name="HDTDependencyTitleText"
                           Foreground="{DynamicResource HDTBannerTextBrush}"
                           FontSize="18" FontWeight="SemiBold" />
                <TextBlock x:Name="HDTDependencyRootText"
                           Foreground="{DynamicResource HDTBannerLabelBrush}"
                           FontFamily="Consolas, Courier New" FontSize="11"
                           Margin="0,3,0,0" TextTrimming="CharacterEllipsis" />
            </StackPanel>
        </Border>
 
        <Grid Grid.Row="1" Margin="16,14,16,0">
            <!-- A TICK BOX PER APPLICATION. IsEnabled is bound to the row's own
                 answer, so an entry that would close a loop is on the list,
                 greyed, with the reason on its tooltip - which is where a
                 disabled control's reason has to be. -->
            <ListBox x:Name="HDTDependencyList"
                     Background="{DynamicResource HDTPanelBrush}"
                     Foreground="{DynamicResource HDTPanelTextBrush}"
                     BorderBrush="{DynamicResource HDTBorderBrush}" BorderThickness="1"
                     ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <CheckBox IsChecked="{Binding Selected, Mode=TwoWay}"
                                  IsEnabled="{Binding Choosable}"
                                  ToolTip="{Binding Reason}"
                                  Margin="2,4,2,4">
                            <StackPanel>
                                <TextBlock Text="{Binding Display}" TextWrapping="Wrap" />
                                <TextBlock Text="{Binding Id}"
                                           Foreground="{DynamicResource HDTHintTextBrush}"
                                           FontFamily="Consolas, Courier New" FontSize="11" />
                            </StackPanel>
                        </CheckBox>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
 
            <!-- A SHARE WITH ONE APPLICATION ON IT has nothing to offer, and an
                 empty box with no explanation reads as a window that failed to
                 load. -->
            <TextBlock x:Name="HDTDependencyEmptyText"
                       Foreground="{DynamicResource HDTHintTextBrush}"
                       TextWrapping="Wrap" Margin="12"
                       Visibility="Collapsed"
                       VerticalAlignment="Top" />
        </Grid>
 
        <Border Grid.Row="2" Margin="16,0,16,0" Padding="0,8,0,8">
            <TextBlock x:Name="HDTDependencyCommandText"
                       Foreground="{DynamicResource HDTCommandTextBrush}"
                       FontFamily="Consolas, Courier New" FontSize="11"
                       TextWrapping="Wrap" />
        </Border>
 
        <Border Grid.Row="3" Background="{DynamicResource HDTFooterBrush}" Padding="16,12,16,12">
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                <Button x:Name="HDTDependencySaveButton" MinWidth="96" IsDefault="True" />
                <Button x:Name="HDTCancelButton" MinWidth="96" Margin="8,0,0,0" IsCancel="True" />
            </StackPanel>
        </Border>
    </Grid>
</Window>