<UserControl x:Class="Valg.EVA.Skanning.Scan.Presentation.ScannerQuality.ScannerQualityControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:scannerQuality="clr-namespace:Valg.EVA.Skanning.Scan.Presentation.ScannerQuality"
             mc:Ignorable="d" 
             d:DesignHeight="900" d:DesignWidth="900" d:DataContext="{d:DesignInstance d:Type=scannerQuality:ScannerQualityViewModel }">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Valg.EVA.Skanning.Assets;component/ResourceDictionaries/ResourceLibrary.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="1"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Grid VerticalAlignment="Stretch">
            <Grid.RowDefinitions>
                <RowDefinition Height="9*"/>
                <RowDefinition Height="2*"/>
            </Grid.RowDefinitions>

            <ScrollViewer VerticalScrollBarVisibility ="Auto" Grid.Row="0">
                <StackPanel >
                    <TextBlock Text="{Binding ScanLanguageString.ScannerQualityCheck_Header, FallbackValue='Denne testen er utarbeidet for å gi en indikasjon på om skanneren din har god nok avlesning. Siden skanneren har fysiske og maskinelle egenskaper (som lys og kamera) så er vil det alltid være en mulighet for en viss variasjon i avlesning fra gang til gang. Med andre ord - testen kan ikke gi deg et 100% entydig svar. I tillegg er det andre egenskaper med skanneren som ikke blir testet her, for eksempel driftssikkerhet og inntrekksmekanisme, som må fungere godt når man skal skanne mange stemmesedler. Merk at den beste testen av skanneren du kan gjøre er å skanne trykte stemmesedler, enten testtrykk eller ekte stemmesedler, og bruke systemet på vanlig måte. Denne kvalitetstesten er ment for bruk når trykte stemmesedler ikke er tilgjengelig'}" 
                           Style="{StaticResource TextBlockLarge}" 
                           TextWrapping="Wrap"/>
                    <BulletDecorator Width="Auto" Margin="10,0,0,5">
                            <BulletDecorator.Bullet>
                                <Ellipse Fill="Black" Width="5" Height="5" />
                            </BulletDecorator.Bullet>
                            <TextBlock Style="{StaticResource TextBlockLarge}" 
                               Text="{Binding ScanLanguageString.ScannerQualityCheck_PrintTheBallot, FallbackValue='Skriv ut testseddelen'}" 
                               Margin="10,0,0,0" 
                               TextWrapping="Wrap" />
                        </BulletDecorator>
                        <BulletDecorator Width="Auto" Margin="30,0,0,0">
                            <TextBlock Style="{StaticResource TextBlockLarge}" 
                               Text="{Binding ScanLanguageString.ScannerQualityCheck_PrintFormat, FallbackValue='Utskriftsformat: A4'}" Margin="10,0,0,0" 
                               TextWrapping="Wrap" />
                        </BulletDecorator>
                        <BulletDecorator Width="Auto" Margin="30,0,0,0">
                            <TextBlock Style="{StaticResource TextBlockLarge}" 
                               Text="{Binding ScanLanguageString.ScannerQualityCheck_PrintOrientation, FallbackValue='Retning: Liggende'}" 
                               Margin="10,0,0,0" 
                               TextWrapping="Wrap" />
                        </BulletDecorator>
                        <BulletDecorator Width="Auto" Margin="30,0,0,0">
                            <TextBlock Style="{StaticResource TextBlockLarge}" 
                               Text="{Binding ScanLanguageString.ScannerQualityCheck_PrintFlipInfo, FallbackValue='Utskrift på begge sider av arket og vendes på kortsiden'}" 
                               Margin="10,0,0,0" 
                               TextWrapping="Wrap" />
                        </BulletDecorator>
                        <BulletDecorator Width="Auto" Margin="10,5,0,0">
                            <BulletDecorator.Bullet>
                                <Ellipse Fill="Black" Width="5" Height="5" />
                            </BulletDecorator.Bullet>
                            <TextBlock Style="{StaticResource TextBlockLarge}" 
                               Text="{Binding ScanLanguageString.ScannerQualityCheck_CutAwayTheWhiteEdges, FallbackValue='Klipp eller beskjær vekk den hvite rammen rundt seddelen'}" 
                               Margin="10,0,0,0" 
                               TextWrapping="Wrap" />
                        </BulletDecorator>
                        <BulletDecorator Width="Auto" Margin="10,5,0,0">
                            <BulletDecorator.Bullet>
                                <Ellipse Fill="Black" Width="5" Height="5" />
                            </BulletDecorator.Bullet>
                            <TextBlock Style="{StaticResource TextBlockLarge}" 
                               Text="{Binding ScanLanguageString.ScannerQualityCheck_StartTheTest, FallbackValue='Legg testseddel inn i skanneren og klikk på Test skannerkvalitet'}" 
                               Margin="10,0,0,0" 
                               TextWrapping="Wrap" />
                        </BulletDecorator>
                        <BulletDecorator Width="Auto" Margin="10,5,0,0">
                            <BulletDecorator.Bullet>
                                <Ellipse Fill="Black" Width="5" Height="5" />
                            </BulletDecorator.Bullet>
                            <TextBlock Style="{StaticResource TextBlockLarge}" 
                               Text="{Binding ScanLanguageString.ScannerQualityCheck_TestBothCameras, FallbackValue='Test begge kameraene i skanneren ved å snu seddelen opp ned'}" 
                               Margin="10,0,0,0" 
                               TextWrapping="Wrap" />
                        </BulletDecorator>
                    </StackPanel>
            </ScrollViewer>
            <StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0,10,0,0" VerticalAlignment="Top">
                <Button Style="{StaticResource BlueButton}" 
                    Content="{Binding ScanLanguageString.ScannerQualityCheck_PrintButtonText, FallbackValue='Skriv ut testseddel'}" 
                    Width="200" Height="50" 
                    Command="{Binding ShowPdfToPrintCommand}" 
                    Margin="0,20,0,0" />
                <Button Style="{StaticResource BlueButton}" 
                    Content="{Binding ScanLanguageString.ScannerQualityCheck_TestScannerQualityButtonText, FallbackValue='Test skannerkvalitet'}" 
                    Width="200" Height="50" 
                    Command="{Binding StartScanningCommand}"
                    Margin="20,20,0,0" />
            </StackPanel>
        </Grid>

        <StackPanel Grid.Column="1" Margin="0,20,0,10">
            <Line X1="0" Y1="0" X2="0" Y2="2000" Stroke="Black" StrokeDashArray="1 1" StrokeThickness="1" ClipToBounds="False" />
        </StackPanel>

        <Grid Margin="20,0,0,0" Grid.Column="2">
            <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal" Visibility="{Binding ScanInProgress, Converter={StaticResource BooleanToVisibilityConverter}}">
                <TextBlock Text="{Binding ScanLanguageString.ScannerQualityCheck_ScanningInProgressText, FallbackValue='Skanning pågår, vennligst vent ... '}" 
                           Style="{StaticResource TextBlockLarge}"
                           Margin="0,20,0,20" />
            </StackPanel>
            <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal" Visibility="{Binding ErrorOccured, Converter={StaticResource BooleanToVisibilityConverter}}">
                <TextBlock Text="{Binding ErrorMessage, FallbackValue='En feil oppstod, vennligst prøv igjen ... '}" 
                           Style="{StaticResource TextBlockLarge}"
                           Margin="0,20,0,20" />
            </StackPanel>

            <StackPanel Visibility="{Binding IsDataAvailable, Converter={StaticResource BooleanToVisibilityConverter}}" VerticalAlignment="Center">
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                    <ItemsControl ItemsSource="{Binding RenumbersFirstGroup}">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="30"/>
                                        <ColumnDefinition Width="5"/>
                                        <ColumnDefinition Width="50"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" TextAlignment="Right" Text="{Binding Index}"/>
                                    <TextBlock Grid.Column="2" Style="{StaticResource RenumberIcon}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,5,0,5" />
                                    <TextBlock Grid.Column="2" Style="{StaticResource TextBlockLarge}" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding Value}" />
                                    <TextBlock Grid.Column="3" Style="{StaticResource CheckMarkIconGreen}" VerticalAlignment="Center" Visibility="{Binding NeedsVerification, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"/>
                                    <TextBlock Grid.Column="3" Style="{StaticResource CrossIconRed}" VerticalAlignment="Center" Visibility="{Binding NeedsVerification, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                                </Grid>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                    <ItemsControl ItemsSource="{Binding RenumbersSecondGroup}">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="30"/>
                                        <ColumnDefinition Width="5"/>
                                        <ColumnDefinition Width="50"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" TextAlignment="Right" Text="{Binding Index}"/>
                                    <TextBlock Grid.Column="2" Style="{StaticResource RenumberIcon}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,5,0,5" />
                                    <TextBlock Grid.Column="2" Style="{StaticResource TextBlockLarge}" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding Value}" />
                                    <TextBlock Grid.Column="3" Style="{StaticResource CheckMarkIconGreen}" VerticalAlignment="Center" Visibility="{Binding NeedsVerification, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"/>
                                    <TextBlock Grid.Column="3" Style="{StaticResource CrossIconRed}" VerticalAlignment="Center" Visibility="{Binding NeedsVerification, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                                </Grid>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                    <ItemsControl ItemsSource="{Binding RenumbersThirdGroup}">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="30"/>
                                        <ColumnDefinition Width="5"/>
                                        <ColumnDefinition Width="50"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" TextAlignment="Right" Text="{Binding Index}"/>
                                    <TextBlock Grid.Column="2" Style="{StaticResource RenumberIcon}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,5,0,5" />
                                    <TextBlock Grid.Column="2" Style="{StaticResource TextBlockLarge}" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding Value}" />
                                    <TextBlock Grid.Column="3" Style="{StaticResource CheckMarkIconGreen}" VerticalAlignment="Center" Visibility="{Binding NeedsVerification, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"/>
                                    <TextBlock Grid.Column="3" Style="{StaticResource CrossIconRed}" VerticalAlignment="Center" Visibility="{Binding NeedsVerification, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                                </Grid>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                    <ItemsControl ItemsSource="{Binding RenumbersFourthGroup}">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="30"/>
                                        <ColumnDefinition Width="5"/>
                                        <ColumnDefinition Width="50"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" TextAlignment="Right" Text="{Binding Index}"/>
                                    <TextBlock Grid.Column="2" Style="{StaticResource RenumberIcon}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,5,0,5" />
                                    <TextBlock Grid.Column="2" Style="{StaticResource TextBlockLarge}" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding Value}" />
                                    <TextBlock Grid.Column="3" Style="{StaticResource CheckMarkIconGreen}" VerticalAlignment="Center" Visibility="{Binding NeedsVerification, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"/>
                                    <TextBlock Grid.Column="3" Style="{StaticResource CrossIconRed}" VerticalAlignment="Center" Visibility="{Binding NeedsVerification, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                                </Grid>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                    <ItemsControl ItemsSource="{Binding RenumbersFifthGroup}">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="30"/>
                                        <ColumnDefinition Width="5"/>
                                        <ColumnDefinition Width="50"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" TextAlignment="Right" Text="{Binding Index}"/>
                                    <TextBlock Grid.Column="2" Style="{StaticResource RenumberIcon}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,5,0,5" />
                                    <TextBlock Grid.Column="2" Style="{StaticResource TextBlockLarge}" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding Value}" />
                                    <TextBlock Grid.Column="3" Style="{StaticResource CheckMarkIconGreen}" VerticalAlignment="Center" Visibility="{Binding NeedsVerification, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"/>
                                    <TextBlock Grid.Column="3" Style="{StaticResource CrossIconRed}" VerticalAlignment="Center" Visibility="{Binding NeedsVerification, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                                </Grid>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </StackPanel>
                <StackPanel Visibility="{Binding ScanInProgress, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"
                            Margin="20,40,0,0"
                            HorizontalAlignment="Center">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding ScanLanguageString.ScannerQualityCheck_BallotTypeWasRecognized, FallbackValue='Seddeltypen ble gjenkjent: '}" 
                                       Style="{StaticResource TextBlockLarge}" 
                                       VerticalAlignment="Center"/>
                        <TextBlock Style="{StaticResource CheckMarkIconGreen}" 
                                       Visibility="{Binding BallotTypeWasRecognized, Converter={StaticResource BooleanToVisibilityConverter}}"
                                       VerticalAlignment="Center"/>
                        <TextBlock Style="{StaticResource CrossIconRed}" 
                                       Visibility="{Binding BallotTypeWasRecognized, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"
                                       VerticalAlignment="Center"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding ScanLanguageString.ScannerQualityCheck_Stamp, FallbackValue='Stempel: '}" 
                                   Style="{StaticResource TextBlockLarge}" 
                                   VerticalAlignment="Center"/>
                        <TextBlock Style="{StaticResource CheckMarkIconGreen}" 
                                   Visibility="{Binding StampIsOK, Converter={StaticResource BooleanToVisibilityConverter}}"
                                   VerticalAlignment="Center"/>
                        <TextBlock Style="{StaticResource CrossIconRed}" 
                                   Visibility="{Binding StampIsOK, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"
                                   VerticalAlignment="Center"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding ScanLanguageString.ScannerQualityCheck_BallotNumber, FallbackValue='Seddelnummer: '}" 
                                   Style="{StaticResource TextBlockLarge}" 
                                   VerticalAlignment="Center"/>
                        <TextBlock Style="{StaticResource CheckMarkIconGreen}" 
                                   Visibility="{Binding BallotNumberFieldIsOK, Converter={StaticResource BooleanToVisibilityConverter}}"
                                   VerticalAlignment="Center"/>
                        <TextBlock Style="{StaticResource CrossIconRed}" 
                                   Visibility="{Binding BallotNumberFieldIsOK, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"
                                   VerticalAlignment="Center"/>
                        <TextBlock Text="{Binding BallotNumberFieldValue, FallbackValue='12345'}" 
                                   Style="{StaticResource TextBlockLarge}"
                                   Margin="5,0,0,0"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding ScanLanguageString.ScannerQualityCheck_RenumberFields, FallbackValue='Renummereringsfelter: '}" 
                                   Style="{StaticResource TextBlockLarge}" 
                                   VerticalAlignment="Center"/>
                        <TextBlock Style="{StaticResource CheckMarkIconGreen}" 
                                   Visibility="{Binding RenumberFieldsAreOK, Converter={StaticResource BooleanToVisibilityConverter}}"
                                   VerticalAlignment="Center"/>
                        <TextBlock Style="{StaticResource CrossIconRed}" 
                                   Visibility="{Binding RenumberFieldsAreOK, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"
                                   VerticalAlignment="Center"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding ScanLanguageString.ScannerQualityCheck_AllFieldsWasInterpreted, FallbackValue='Alle felter ble tolket rett: '}" 
                                   Style="{StaticResource TextBlockLarge}" 
                                   VerticalAlignment="Center"/>
                        <TextBlock Style="{StaticResource CheckMarkIconGreen}" 
                                   Visibility="{Binding ScannerPassedAllQualityTests, Converter={StaticResource BooleanToVisibilityConverter}}"
                                   VerticalAlignment="Center"/>
                        <TextBlock Style="{StaticResource CrossIconRed}" 
                                   Visibility="{Binding ScannerPassedAllQualityTests, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"
                                   VerticalAlignment="Center"/>
                    </StackPanel>
                    <Button Style="{StaticResource LinkButtonNormal}" 
                            Content="{Binding VerifyLanguageString.BallotPaper_ViewFullPage, FallbackValue='Vis seddel'}" 
                            Width="200" Height="50" 
                            Command="{Binding ShowBallotPaperImageCommand}"
                            Margin="0,10,0,0" />
                </StackPanel>
            </StackPanel>
        </Grid>
    </Grid>
</UserControl>






