<coreWindows:WindowBase x:Class="MPF.UI.Windows.CheckDumpWindow"
                        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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                        xmlns:core="clr-namespace:MPF.UI"
                        xmlns:coreWindows="clr-namespace:MPF.UI.Windows"
                        xmlns:viewModels="clr-namespace:MPF.Frontend.ViewModels;assembly=MPF.Frontend"
                        mc:Ignorable="d"
                        Title="Check Existing Dump" Width="600" WindowStyle="None"
                        WindowStartupLocation="CenterOwner" ResizeMode="CanMinimize" SizeToContent="Height"
                        AllowsTransparency="True" Background="Transparent">

    <Window.DataContext>
        <viewModels:CheckDumpViewModel/>
    </Window.DataContext>
    <Window.Resources>
        <core:ElementConverter x:Key="ElementConverter" />
    </Window.Resources>

    <Border CornerRadius="8" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="Gray" BorderThickness="2">
        <StackPanel Orientation="Vertical">
            <Grid Margin="0,2,0,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="25"/>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="50"/>
                    <ColumnDefinition Width="5"/>
                </Grid.ColumnDefinitions>

                <Image Grid.Column="0" Source="/Images/Icon.ico" Height="20" Width="20" Margin="1" MouseDown="TitleMouseDown" />
                <Label Grid.Column="1" Grid.ColumnSpan="4" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" MouseDown="TitleMouseDown">
                    <Label.Content>
                        <Run FontWeight="Bold" Text="Check Existing Dump" />
                    </Label.Content>
                    <Label.ContextMenu>
                        <ContextMenu Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
                                     Foreground="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"
                                     Style="{DynamicResource CustomContextMenuStyle}">
                            <MenuItem Header="Minimize" Click="MinimizeButtonClick" Width="185"
                                      Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
                                      Foreground="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"
                                      Template="{DynamicResource CustomMenuItemTemplate}"/>
                            <MenuItem Header="Close" Click="CloseButtonClick" Width="185"
                                      Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
                                      Foreground="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"
                                      Template="{DynamicResource CustomMenuItemTemplate}"/>
                        </ContextMenu>
                    </Label.ContextMenu>
                </Label>
                <Grid Grid.Column="5">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>

                    <Button x:Name="MinimizeButton" Grid.Column="0" BorderThickness="0" Background="Transparent" Style="{DynamicResource CustomButtonStyle}" Click="MinimizeButtonClick">
                        <Path Data="M 0,0 L 10,0" Stroke="{Binding Path=Foreground,RelativeSource={RelativeSource AncestorType={x:Type Button}}}" StrokeThickness="1"/>
                    </Button>
                    <Button x:Name="CloseButton" Grid.Column="1" BorderThickness="0" Background="Transparent" Style="{DynamicResource CustomButtonStyle}" Click="CloseButtonClick">
                        <Path Data="M 0,0 L 12,12 M 0,12 L 12,0" Stroke="{Binding Path=Foreground,RelativeSource={RelativeSource AncestorType={x:Type Button}}}" StrokeThickness="1"/>
                    </Button>
                </Grid>
            </Grid>

            <GroupBox Margin="5,5,5,5" HorizontalAlignment="Stretch" Header="Settings">
                <Grid Margin="5,5,5,5">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="1*"/>
                        <ColumnDefinition Width="2.5*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>

                    <Label x:Name="InputPathLabel" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Content="Input Path"/>
                    <TextBox x:Name="InputPathTextBox" Grid.Row="0" Grid.Column="1" Height="22" Width="345" HorizontalAlignment="Left" VerticalContentAlignment="Center"
                 Text="{Binding InputPath, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                 IsEnabled="{Binding InputPathTextBoxEnabled}" />
                    <Button x:Name="InputPathBrowseButton" Grid.Row="0" Grid.Column="1" Height="22" Width="50" HorizontalAlignment="Right" Content="Browse"
                IsEnabled="{Binding InputPathBrowseButtonEnabled}" Style="{DynamicResource CustomButtonStyle}"/>

                    <Label x:Name="SystemMediaTypeLabel" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Content="System/Media Type" />
                    <ComboBox x:Name="SystemTypeComboBox" Grid.Row="1" Grid.Column="1" Height="22" Width="250" HorizontalAlignment="Left"
                  ItemsSource="{Binding Systems}" SelectedItem="{Binding Path=CurrentSystem, Converter={StaticResource ElementConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                  IsEnabled="{Binding SystemTypeComboBoxEnabled}" Style="{DynamicResource CustomComboBoxStyle}">
                        <ComboBox.ItemContainerStyle>
                            <Style TargetType="{x:Type ComboBoxItem}">
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding IsHeader}" Value="True">
                                        <Setter Property="IsEnabled" Value="False"/>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </ComboBox.ItemContainerStyle>
                    </ComboBox>
                    <ComboBox x:Name="MediaTypeComboBox" Grid.Row="1" Grid.Column="1" Height="22" Width="140" HorizontalAlignment="Right"
                  ItemsSource="{Binding MediaTypes}" SelectedItem="{Binding Path=CurrentMediaType, Converter={StaticResource ElementConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                  IsEnabled="{Binding MediaTypeComboBoxEnabled}" Style="{DynamicResource CustomComboBoxStyle}" />

                    <Label x:Name="DumpingProgramLabel" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" Content="Dumping Program"/>
                    <ComboBox x:Name="DumpingProgramComboBox" Grid.Row="2" Grid.Column="1" Height="22" Width="250" HorizontalAlignment="Left"
                  ItemsSource="{Binding InternalPrograms}" SelectedItem="{Binding Path=CurrentProgram, Converter={StaticResource ElementConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                  IsEnabled="{Binding DumpingProgramComboBoxEnabled}" Style="{DynamicResource CustomComboBoxStyle}" />
                </Grid>
            </GroupBox>

            <GroupBox Margin="5,5,5,5" HorizontalAlignment="Stretch" Header="Status">
                <UniformGrid Margin="5,5,5,5" Grid.ColumnSpan="2">
                    <TextBlock x:Name="StatusLabel" VerticalAlignment="Center" HorizontalAlignment="Center"
                               ToolTipService.ToolTip="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                               Text="{Binding StatusFirstLine}" />
                </UniformGrid>
            </GroupBox>

            <GroupBox Margin="5,5,5,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <GroupBox.Template>
                    <ControlTemplate TargetType="GroupBox">
                        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="5">
                            <ContentPresenter Content="{TemplateBinding Content}" Margin="{TemplateBinding Padding}" />
                        </Border>
                    </ControlTemplate>
                </GroupBox.Template>
                <Label>
                    <Label.Content>
                        <TextBlock TextWrapping="Wrap">
                            <Run FontWeight="Bold" Foreground="Red" Text="WARNING:" />
                            <Run Text="Check will overwrite both any existing submission information files as well as any log archives. Please make backups of those if you need to before running Check." />
                        </TextBlock>
                    </Label.Content>
                </Label>
            </GroupBox>

            <!-- Check Dump / Cancel -->
            <GroupBox Margin="5,5,5,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <GroupBox.Template>
                    <ControlTemplate TargetType="GroupBox">
                        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="5">
                            <ContentPresenter Content="{TemplateBinding Content}" Margin="{TemplateBinding Padding}" />
                        </Border>
                    </ControlTemplate>
                </GroupBox.Template>
                <UniformGrid Columns="4" Margin="5,5,5,5" Height="27">
                    <Label/>
                    <!-- Empty label for padding -->
                    <Button Name="CheckDumpButton" Height="25" Width="80" IsDefault="True" Content="Check Dump"
                            IsEnabled="{Binding CheckDumpButtonEnabled}" Style="{DynamicResource CustomButtonStyle}" />
                    <Button Name="CancelButton" Height="25" Width="80" IsCancel="True" Content="Cancel"
                            IsEnabled="{Binding CancelButtonEnabled}" Style="{DynamicResource CustomButtonStyle}" />
                    <Label/>
                    <!-- Empty label for padding -->
                </UniformGrid>
            </GroupBox>
        </StackPanel>
    </Border>
</coreWindows:WindowBase>
