<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: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>
    
    <ScrollViewer>
        <StackPanel Style="{StaticResource BaseStackPanel}" >
            <StackPanel>
                <TextBlock Text="Start a match" Style="{StaticResource Header}" />
                <Button Content="Start match" Style="{StaticResource Green}" Click="StartMatchButton_Click" IsEnabled="{Binding MatchAvailable}" Visibility="{Binding StartMatch, Converter={StaticResource BoolToVisConverter}}" />
                <Button Content="Leave match" Style="{StaticResource Red}" Click="StopMatchButton_Click" Visibility="{Binding StopMatch, Converter={StaticResource BoolToVisConverter}}" />
            </StackPanel>

            <StackPanel Visibility="{Binding StopMatch, Converter={StaticResource BoolToVisConverter}}" Margin="0,10,0,0">
                <TextBlock Text="Current players in match" Style="{StaticResource Header}" />

                <TextBlock Text="{Binding PlayersCount}" />

                <ListView x:Name="PlayersList" ItemsSource="{Binding Players}" SelectionMode="None" IsTapEnabled="False">
                    <ListView.ItemTemplate>
                        <DataTemplate x:Name="ListViewDataTemplate">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding Username}" />
                            </StackPanel>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
                
            </StackPanel>
        </StackPanel>
    </ScrollViewer>
</Page>
