<commit_before>﻿<Page
    x:Class="iHentai.Pages.ReadingPage"
    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:controls="using:Microsoft.UI.Xaml.Controls"
    xmlns:animations="using:Microsoft.Toolkit.Uwp.UI.Animations"
    xmlns:icon="using:Bug10.Icon"
    xmlns:extensions="using:Microsoft.Toolkit.Uwp.UI.Extensions"
    xmlns:views="using:iHentai.Views"
    xmlns:helpers="using:iHentai.Common.Helpers"
    xmlns:viewModels="using:iHentai.ViewModels"
    xmlns:readingImages="using:iHentai.ReadingImages"
    xmlns:Windows10version1903="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 8)"
    mc:Ignorable="d"
    d:DataContext="{d:DesignInstance viewModels:ReadingViewModel}"
    Background="{ThemeResource SystemControlAcrylicWindowBrush}">

    <Grid>
        <Grid.Resources>
            <Windows10version1903:ThemeShadow x:Name="SharedShadow" />
        </Grid.Resources>

        <Grid Tapped="UIElement_OnTapped">
            <views:Optional FlowDirection="{x:Bind ViewModel.FlowDirection, Mode=OneWay}"
                            Content="{x:Bind ViewModel,Mode=OneWay}" When="{x:Bind ViewModel.IsBookMode, Mode=OneWay}">
                <views:Optional.ContentTemplate>
                    <DataTemplate x:DataType="viewModels:ReadingViewModel">
                        <views:BookView ItemsSource="{x:Bind Images, Mode=OneWay}"
                                        SelectedIndex="{x:Bind SelectedIndex, Mode=TwoWay}">
                            <views:BookView.LeftTemplate>
                                <DataTemplate x:DataType="readingImages:IReadingImage">
                                    <Grid Background="Transparent">
                                        <Image
                                            HorizontalAlignment="Right"
                                            Source="{x:Bind Source, Mode=OneWay}"
                                            Visibility="{x:Bind helpers:XamlHelper.InvertBoolToVisibility(IsLoading), Mode=OneWay}" />
                                        <StackPanel
                                            FlowDirection="{Binding ElementName=ReadingRoot, Path=FlowDirection}"
                                            Visibility="{x:Bind IsLoading, Mode=OneWay}"
                                            HorizontalAlignment="Center" VerticalAlignment="Center">
                                            <TextBlock Text="{x:Bind Index, Mode=OneWay}" HorizontalAlignment="Center"
                                                       Style="{ThemeResource TitleTextBlockStyle}" />
                                            <controls:ProgressBar
                                                IsIndeterminate="{x:Bind helpers:XamlHelper.IsZero(Progress), Mode=OneWay}"
                                                Maximum="1" Value="{x:Bind Progress, Mode=OneWay}" Width="100" />
                                        </StackPanel>
                                    </Grid>
                                </DataTemplate>
                            </views:BookView.LeftTemplate>
                            <views:BookView.RightTemplate>
                                <DataTemplate x:DataType="readingImages:IReadingImage">
                                    <Grid Background="Transparent">
                                        <Image
                                            HorizontalAlignment="Left"
                                            Source="{x:Bind Source, Mode=OneWay}"
                                            Visibility="{x:Bind helpers:XamlHelper.InvertBoolToVisibility(IsLoading), Mode=OneWay}" />
                                        <StackPanel
                                            FlowDirection="{Binding ElementName=ReadingRoot, Path=FlowDirection}"
                                            Visibility="{x:Bind IsLoading, Mode=OneWay}"
                                            HorizontalAlignment="Center" VerticalAlignment="Center">
                                            <TextBlock Text="{x:Bind Index, Mode=OneWay}" HorizontalAlignment="Center"
                                                       Style="{ThemeResource TitleTextBlockStyle}" />
                                            <controls:ProgressBar
                                                IsIndeterminate="{x:Bind helpers:XamlHelper.IsZero(Progress), Mode=OneWay}"
                                                Maximum="1" Value="{x:Bind Progress, Mode=OneWay}" Width="100" />
                                        </StackPanel>
                                    </Grid>
                                </DataTemplate>
                            </views:BookView.RightTemplate>
                        </views:BookView>
                    </DataTemplate>
                </views:Optional.ContentTemplate>
            </views:Optional>
            <views:Optional FlowDirection="{x:Bind ViewModel.FlowDirection, Mode=OneWay}"
                            Content="{x:Bind ViewModel,Mode=OneWay}"
                            When="{x:Bind ViewModel.IsBookCoverFirstMode, Mode=OneWay}">
                <views:Optional.ContentTemplate>
                    <DataTemplate x:DataType="viewModels:ReadingViewModel">
                        <views:BookView CoverFirst="True" ItemsSource="{x:Bind Images, Mode=OneWay}"
                                        SelectedIndex="{x:Bind SelectedIndex, Mode=TwoWay}">
                            <views:BookView.LeftTemplate>
                                <DataTemplate x:DataType="readingImages:IReadingImage">
                                    <Grid Background="Transparent">
                                        <Image
                                            HorizontalAlignment="Right"
                                            Source="{x:Bind Source, Mode=OneWay}"
                                            Visibility="{x:Bind helpers:XamlHelper.InvertBoolToVisibility(IsLoading), Mode=OneWay}" />
                                        <StackPanel
                                            FlowDirection="{Binding ElementName=ReadingRoot, Path=FlowDirection}"
                                            Visibility="{x:Bind IsLoading, Mode=OneWay}"
                                            HorizontalAlignment="Center" VerticalAlignment="Center">
                                            <TextBlock Text="{x:Bind Index, Mode=OneWay}" HorizontalAlignment="Center"
                                                       Style="{ThemeResource TitleTextBlockStyle}" />
                                            <controls:ProgressBar
                                                IsIndeterminate="{x:Bind helpers:XamlHelper.IsZero(Progress), Mode=OneWay}"
                                                Maximum="1" Value="{x:Bind Progress, Mode=OneWay}" Width="100" />
                                        </StackPanel>
                                    </Grid>
                                </DataTemplate>
                            </views:BookView.LeftTemplate>
                            <views:BookView.RightTemplate>
                                <DataTemplate x:DataType="readingImages:IReadingImage">
                                    <Grid Background="Transparent">
                                        <Image
                                            HorizontalAlignment="Left"
                                            Source="{x:Bind Source, Mode=OneWay}"
                                            Visibility="{x:Bind helpers:XamlHelper.InvertBoolToVisibility(IsLoading), Mode=OneWay}" />
                                        <StackPanel
                                            FlowDirection="{Binding ElementName=ReadingRoot, Path=FlowDirection}"
                                            Visibility="{x:Bind IsLoading, Mode=OneWay}"
                                            HorizontalAlignment="Center" VerticalAlignment="Center">
                                            <TextBlock Text="{x:Bind Index, Mode=OneWay}" HorizontalAlignment="Center"
                                                       Style="{ThemeResource TitleTextBlockStyle}" />
                                            <controls:ProgressBar
                                                IsIndeterminate="{x:Bind helpers:XamlHelper.IsZero(Progress), Mode=OneWay}"
                                                Maximum="1" Value="{x:Bind Progress, Mode=OneWay}" Width="100" />
                                        </StackPanel>
                                    </Grid>
                                </DataTemplate>
                            </views:BookView.RightTemplate>
                        </views:BookView>
                    </DataTemplate>
                </views:Optional.ContentTemplate>
            </views:Optional>
            <views:Optional FlowDirection="{x:Bind ViewModel.FlowDirection, Mode=OneWay}"
                            Content="{x:Bind ViewModel,Mode=OneWay}" When="{x:Bind ViewModel.IsFlipMode, Mode=OneWay}">
                <views:Optional.ContentTemplate>
                    <DataTemplate x:DataType="viewModels:ReadingViewModel">
                        <FlipView ItemsSource="{x:Bind Images, Mode=OneWay}"
                                  Background="Transparent"
                                  SelectedIndex="{x:Bind SelectedIndex, Mode=TwoWay}">
                            <FlipView.ItemTemplate>
                                <DataTemplate x:DataType="readingImages:IReadingImage">
                                    <Grid Background="Transparent"
                                          FlowDirection="{Binding ElementName=ReadingRoot, Path=FlowDirection}">
                                        <ScrollViewer x:Name="Scroll" ZoomMode="Enabled"
                                                      MinZoomFactor="1"
                                                      HorizontalScrollBarVisibility="Auto" HorizontalScrollMode="Auto">
                                            <Image
                                                MaxWidth="{Binding ElementName=Scroll, Path=ViewportWidth}"
                                                MaxHeight="{Binding ElementName=Scroll, Path=ViewportHeight}"
                                                Source="{x:Bind Source, Mode=OneWay}"
                                                Visibility="{x:Bind helpers:XamlHelper.InvertBoolToVisibility(IsLoading), Mode=OneWay}" />
                                        </ScrollViewer>
                                        <StackPanel
                                            Visibility="{x:Bind IsLoading, Mode=OneWay}"
                                            HorizontalAlignment="Center" VerticalAlignment="Center">
                                            <TextBlock Text="{x:Bind Index, Mode=OneWay}" HorizontalAlignment="Center"
                                                       Style="{ThemeResource TitleTextBlockStyle}" />
                                            <controls:ProgressBar
                                                IsIndeterminate="{x:Bind helpers:XamlHelper.IsZero(Progress), Mode=OneWay}"
                                                Maximum="1" Value="{x:Bind Progress, Mode=OneWay}" Width="100" />
                                        </StackPanel>
                                    </Grid>
                                </DataTemplate>
                            </FlipView.ItemTemplate>
                        </FlipView>
                    </DataTemplate>
                </views:Optional.ContentTemplate>
            </views:Optional>
            <views:Optional Content="{x:Bind ViewModel,Mode=OneWay}" When="{x:Bind ViewModel.IsListMode, Mode=OneWay}">
                <views:Optional.ContentTemplate>
                    <DataTemplate x:DataType="viewModels:ReadingViewModel">
                        <ScrollViewer ZoomMode="Enabled" MinZoomFactor="1" HorizontalScrollMode="Auto"
                                      HorizontalScrollBarVisibility="Auto">
                            <controls:ItemsRepeater ItemsSource="{x:Bind Images, Mode=OneWay}">
                                <controls:ItemsRepeater.ItemTemplate>
                                    <DataTemplate x:DataType="readingImages:IReadingImage">
                                        <Grid Background="Transparent">
                                            <Image
                                                MaxWidth="{Binding ElementName=Scroll, Path=ViewportWidth}"
                                                MaxHeight="{Binding ElementName=Scroll, Path=ViewportHeight}"
                                                Source="{x:Bind Source, Mode=OneWay}"
                                                Visibility="{x:Bind helpers:XamlHelper.InvertBoolToVisibility(IsLoading), Mode=OneWay}" />
                                            <StackPanel
                                                Visibility="{x:Bind IsLoading, Mode=OneWay}"
                                                HorizontalAlignment="Center" VerticalAlignment="Center">
                                                <TextBlock Text="{x:Bind Index, Mode=OneWay}"
                                                           HorizontalAlignment="Center"
                                                           Style="{ThemeResource TitleTextBlockStyle}" />
                                                <controls:ProgressBar
                                                    IsIndeterminate="{x:Bind helpers:XamlHelper.IsZero(Progress), Mode=OneWay}"
                                                    Maximum="1" Value="{x:Bind Progress, Mode=OneWay}" Width="100" />
                                            </StackPanel>
                                        </Grid>
                                    </DataTemplate>
                                </controls:ItemsRepeater.ItemTemplate><commit_msg>Fix list reading mode scale issue<commit_after>﻿<Page
    x:Class="iHentai.Pages.ReadingPage"
    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:controls="using:Microsoft.UI.Xaml.Controls"
    xmlns:animations="using:Microsoft.Toolkit.Uwp.UI.Animations"
    xmlns:icon="using:Bug10.Icon"
    xmlns:extensions="using:Microsoft.Toolkit.Uwp.UI.Extensions"
    xmlns:views="using:iHentai.Views"
    xmlns:helpers="using:iHentai.Common.Helpers"
    xmlns:viewModels="using:iHentai.ViewModels"
    xmlns:readingImages="using:iHentai.ReadingImages"
    xmlns:Windows10version1903="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 8)"
    mc:Ignorable="d"
    d:DataContext="{d:DesignInstance viewModels:ReadingViewModel}"
    Background="{ThemeResource SystemControlAcrylicWindowBrush}">

    <Grid>
        <Grid.Resources>
            <Windows10version1903:ThemeShadow x:Name="SharedShadow" />
        </Grid.Resources>

        <Grid Tapped="UIElement_OnTapped">
            <views:Optional FlowDirection="{x:Bind ViewModel.FlowDirection, Mode=OneWay}"
                            Content="{x:Bind ViewModel,Mode=OneWay}" When="{x:Bind ViewModel.IsBookMode, Mode=OneWay}">
                <views:Optional.ContentTemplate>
                    <DataTemplate x:DataType="viewModels:ReadingViewModel">
                        <views:BookView ItemsSource="{x:Bind Images, Mode=OneWay}"
                                        SelectedIndex="{x:Bind SelectedIndex, Mode=TwoWay}">
                            <views:BookView.LeftTemplate>
                                <DataTemplate x:DataType="readingImages:IReadingImage">
                                    <Grid Background="Transparent">
                                        <Image
                                            HorizontalAlignment="Right"
                                            Source="{x:Bind Source, Mode=OneWay}"
                                            Visibility="{x:Bind helpers:XamlHelper.InvertBoolToVisibility(IsLoading), Mode=OneWay}" />
                                        <StackPanel
                                            FlowDirection="{Binding ElementName=ReadingRoot, Path=FlowDirection}"
                                            Visibility="{x:Bind IsLoading, Mode=OneWay}"
                                            HorizontalAlignment="Center" VerticalAlignment="Center">
                                            <TextBlock Text="{x:Bind Index, Mode=OneWay}" HorizontalAlignment="Center"
                                                       Style="{ThemeResource TitleTextBlockStyle}" />
                                            <controls:ProgressBar
                                                IsIndeterminate="{x:Bind helpers:XamlHelper.IsZero(Progress), Mode=OneWay}"
                                                Maximum="1" Value="{x:Bind Progress, Mode=OneWay}" Width="100" />
                                        </StackPanel>
                                    </Grid>
                                </DataTemplate>
                            </views:BookView.LeftTemplate>
                            <views:BookView.RightTemplate>
                                <DataTemplate x:DataType="readingImages:IReadingImage">
                                    <Grid Background="Transparent">
                                        <Image
                                            HorizontalAlignment="Left"
                                            Source="{x:Bind Source, Mode=OneWay}"
                                            Visibility="{x:Bind helpers:XamlHelper.InvertBoolToVisibility(IsLoading), Mode=OneWay}" />
                                        <StackPanel
                                            FlowDirection="{Binding ElementName=ReadingRoot, Path=FlowDirection}"
                                            Visibility="{x:Bind IsLoading, Mode=OneWay}"
                                            HorizontalAlignment="Center" VerticalAlignment="Center">
                                            <TextBlock Text="{x:Bind Index, Mode=OneWay}" HorizontalAlignment="Center"
                                                       Style="{ThemeResource TitleTextBlockStyle}" />
                                            <controls:ProgressBar
                                                IsIndeterminate="{x:Bind helpers:XamlHelper.IsZero(Progress), Mode=OneWay}"
                                                Maximum="1" Value="{x:Bind Progress, Mode=OneWay}" Width="100" />
                                        </StackPanel>
                                    </Grid>
                                </DataTemplate>
                            </views:BookView.RightTemplate>
                        </views:BookView>
                    </DataTemplate>
                </views:Optional.ContentTemplate>
            </views:Optional>
            <views:Optional FlowDirection="{x:Bind ViewModel.FlowDirection, Mode=OneWay}"
                            Content="{x:Bind ViewModel,Mode=OneWay}"
                            When="{x:Bind ViewModel.IsBookCoverFirstMode, Mode=OneWay}">
                <views:Optional.ContentTemplate>
                    <DataTemplate x:DataType="viewModels:ReadingViewModel">
                        <views:BookView CoverFirst="True" ItemsSource="{x:Bind Images, Mode=OneWay}"
                                        SelectedIndex="{x:Bind SelectedIndex, Mode=TwoWay}">
                            <views:BookView.LeftTemplate>
                                <DataTemplate x:DataType="readingImages:IReadingImage">
                                    <Grid Background="Transparent">
                                        <Image
                                            HorizontalAlignment="Right"
                                            Source="{x:Bind Source, Mode=OneWay}"
                                            Visibility="{x:Bind helpers:XamlHelper.InvertBoolToVisibility(IsLoading), Mode=OneWay}" />
                                        <StackPanel
                                            FlowDirection="{Binding ElementName=ReadingRoot, Path=FlowDirection}"
                                            Visibility="{x:Bind IsLoading, Mode=OneWay}"
                                            HorizontalAlignment="Center" VerticalAlignment="Center">
                                            <TextBlock Text="{x:Bind Index, Mode=OneWay}" HorizontalAlignment="Center"
                                                       Style="{ThemeResource TitleTextBlockStyle}" />
                                            <controls:ProgressBar
                                                IsIndeterminate="{x:Bind helpers:XamlHelper.IsZero(Progress), Mode=OneWay}"
                                                Maximum="1" Value="{x:Bind Progress, Mode=OneWay}" Width="100" />
                                        </StackPanel>
                                    </Grid>
                                </DataTemplate>
                            </views:BookView.LeftTemplate>
                            <views:BookView.RightTemplate>
                                <DataTemplate x:DataType="readingImages:IReadingImage">
                                    <Grid Background="Transparent">
                                        <Image
                                            HorizontalAlignment="Left"
                                            Source="{x:Bind Source, Mode=OneWay}"
                                            Visibility="{x:Bind helpers:XamlHelper.InvertBoolToVisibility(IsLoading), Mode=OneWay}" />
                                        <StackPanel
                                            FlowDirection="{Binding ElementName=ReadingRoot, Path=FlowDirection}"
                                            Visibility="{x:Bind IsLoading, Mode=OneWay}"
                                            HorizontalAlignment="Center" VerticalAlignment="Center">
                                            <TextBlock Text="{x:Bind Index, Mode=OneWay}" HorizontalAlignment="Center"
                                                       Style="{ThemeResource TitleTextBlockStyle}" />
                                            <controls:ProgressBar
                                                IsIndeterminate="{x:Bind helpers:XamlHelper.IsZero(Progress), Mode=OneWay}"
                                                Maximum="1" Value="{x:Bind Progress, Mode=OneWay}" Width="100" />
                                        </StackPanel>
                                    </Grid>
                                </DataTemplate>
                            </views:BookView.RightTemplate>
                        </views:BookView>
                    </DataTemplate>
                </views:Optional.ContentTemplate>
            </views:Optional>
            <views:Optional FlowDirection="{x:Bind ViewModel.FlowDirection, Mode=OneWay}"
                            Content="{x:Bind ViewModel,Mode=OneWay}" When="{x:Bind ViewModel.IsFlipMode, Mode=OneWay}">
                <views:Optional.ContentTemplate>
                    <DataTemplate x:DataType="viewModels:ReadingViewModel">
                        <FlipView ItemsSource="{x:Bind Images, Mode=OneWay}"
                                  Background="Transparent"
                                  SelectedIndex="{x:Bind SelectedIndex, Mode=TwoWay}">
                            <FlipView.ItemTemplate>
                                <DataTemplate x:DataType="readingImages:IReadingImage">
                                    <Grid Background="Transparent"
                                          FlowDirection="{Binding ElementName=ReadingRoot, Path=FlowDirection}">
                                        <ScrollViewer x:Name="Scroll" ZoomMode="Enabled"
                                                      MinZoomFactor="1"
                                                      HorizontalScrollBarVisibility="Auto" HorizontalScrollMode="Auto">
                                            <Image
                                                MaxWidth="{Binding ElementName=Scroll, Path=ViewportWidth}"
                                                MaxHeight="{Binding ElementName=Scroll, Path=ViewportHeight}"
                                                Source="{x:Bind Source, Mode=OneWay}"
                                                Visibility="{x:Bind helpers:XamlHelper.InvertBoolToVisibility(IsLoading), Mode=OneWay}" />
                                        </ScrollViewer>
                                        <StackPanel
                                            Visibility="{x:Bind IsLoading, Mode=OneWay}"
                                            HorizontalAlignment="Center" VerticalAlignment="Center">
                                            <TextBlock Text="{x:Bind Index, Mode=OneWay}" HorizontalAlignment="Center"
                                                       Style="{ThemeResource TitleTextBlockStyle}" />
                                            <controls:ProgressBar
                                                IsIndeterminate="{x:Bind helpers:XamlHelper.IsZero(Progress), Mode=OneWay}"
                                                Maximum="1" Value="{x:Bind Progress, Mode=OneWay}" Width="100" />
                                        </StackPanel>
                                    </Grid>
                                </DataTemplate>
                            </FlipView.ItemTemplate>
                        </FlipView>
                    </DataTemplate>
                </views:Optional.ContentTemplate>
            </views:Optional>
            <views:Optional Content="{x:Bind ViewModel,Mode=OneWay}" When="{x:Bind ViewModel.IsListMode, Mode=OneWay}" >
                <views:Optional.ContentTemplate>
                    <DataTemplate x:DataType="viewModels:ReadingViewModel">
                        <ScrollViewer ZoomMode="Enabled" HorizontalScrollMode="Auto"
                                      HorizontalAlignment="Stretch"
                                      HorizontalContentAlignment="Center"
                                      HorizontalScrollBarVisibility="Auto">
                            <controls:ItemsRepeater ItemsSource="{x:Bind Images, Mode=OneWay}" HorizontalAlignment="Center">
                                <controls:ItemsRepeater.ItemTemplate>
                                    <DataTemplate x:DataType="readingImages:IReadingImage">
                                        <Grid Background="Transparent">
                                            <Image
                                                MaxWidth="{Binding ElementName=Scroll, Path=ViewportWidth}"
                                                MaxHeight="{Binding ElementName=Scroll, Path=ViewportHeight}"
                                                Source="{x:Bind Source, Mode=OneWay}"
                                                Visibility="{x:Bind helpers:XamlHelper.InvertBoolToVisibility(IsLoading), Mode=OneWay}" />
                                            <StackPanel
                                                Visibility="{x:Bind IsLoading, Mode=OneWay}"
                                                HorizontalAlignment="Center" VerticalAlignment="Center">
                                                <TextBlock Text="{x:Bind Index, Mode=OneWay}"
                                                           HorizontalAlignment="Center"
                                                           Style="{ThemeResource TitleTextBlockStyle}" />
                                                <controls:ProgressBar
                                                    IsIndeterminate="{x:Bind helpers:XamlHelper.IsZero(Progress), Mode=OneWay}"
                                                    Maximum="1" Value="{x:Bind Progress, Mode=OneWay}" Width="100" />
                                            </StackPanel>
                                        </Grid>
                                    </DataTemplate>
                                </controls:ItemsRepeater.ItemTemplate>
{'fraction_non_alphanumeric': 0.08831276861222792, 'fraction_numerical': 0.004193816719811451, 'mean_word_length': 1.1160982764943161, 'pattern_counts': {'":': 0, '<': 209, '<?xml version=': 0, '>': 209, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 28}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 368, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7538551', 'n_tokens_mistral': 5811, 'n_tokens_neox': 5226, 'n_words': 772}