<Page
    x:Class="YJMPD_UWP.Views.MatchView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:YJMPD_UWP.Views"
    xmlns:map="using:Windows.UI.Xaml.Controls.Maps"
    xmlns:convert="using:YJMPD_UWP.Helpers.Converter"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>
        <convert:BoolToVisibilityConverter x:Key="BoolToVisConverter" />
    </Page.Resources>

    <Grid>
        <Pivot>
         
            <PivotItem Header="Photo">
                <Grid>
                    <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" ZoomMode="Enabled">
                        <Image Name="Photo" Stretch="UniformToFill" RenderTransformOrigin="0.5,0.5" Source="{Binding Photo}" />
                    </ScrollViewer>
                </Grid>
            </PivotItem>

            <PivotItem Header="Direction">
                <Grid>
                    <Image Name="Direction" Visibility="{Binding HeadingVisible, Converter={StaticResource BoolToVisConverter}}" Stretch="Uniform" RenderTransformOrigin="0.5,0.5" Source="ms-appx:///Assets/Direction.png" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                        <Image.RenderTransform>
                            <CompositeTransform Rotation="{Binding Degrees}"/>
                        </Image.RenderTransform>
                    </Image>

                    <TextBlock Visibility="{Binding InvHeadingVisible, Converter={StaticResource BoolToVisConverter}}" Text="The direction hint is currently not available because you are already too close to your destination" />
                </Grid>
            </PivotItem>

            <PivotItem Header="Map">
                <map:MapControl Name="Map" MapServiceToken="74Y70e71HVjjN7lnx4Eh~3wugTlBDe2DbPGuR_AM2aA~AjMbg-pU2qn4gYf97oH0GZI1oY9Jc4vH-4WyIRyoYQM0Q71CnfbWalEN37bdSgms" />
            </PivotItem>
        </Pivot>

        <StackPanel Visibility="{Binding MessageVisible, Converter={StaticResource BoolToVisConverter}}" Background="DarkGreen" Padding="20" VerticalAlignment="Bottom">
            <TextBlock Foreground="White" Text="{Binding Message}" />
        </StackPanel>

        <StackPanel Visibility="{Binding ErrorVisible, Converter={StaticResource BoolToVisConverter}}" Background="DarkRed" Padding="20" VerticalAlignment="Bottom">
            <TextBlock Foreground="White" Text="{Binding Error}" />
        </StackPanel>
    </Grid>
    
</Page>
