<Page x:Name="Page_Reader"
    x:Class="Zebra_RFID_Mobile.PageReaderList"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Zebra_RFID_Mobile"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    NavigationCacheMode="Enabled"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Page.Resources>
        <Flyout x:Name="flyout1" x:Key="FlyoutBase1" Placement="Full">
            <StackPanel VerticalAlignment="Center">
                <TextBlock x:Name="textflyoutconnecting"  Grid.Row="4"   FontSize="18" HorizontalAlignment="Center" Text="Connecting to" VerticalAlignment="Center" Margin="0" />
                <TextBlock x:Name="textflyout"   Grid.Row="5"  FontSize="18" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,20" />
                <ProgressBar x:Name="ProgressConnection" IsIndeterminate="True" Width="300"  Grid.Row="6" LargeChange="0.1" VerticalAlignment="Center" />
            </StackPanel>
        </Flyout>       

    </Page.Resources>

    <Grid>
        <TextBlock HorizontalAlignment="Left" Margin="80,10,0,0" TextWrapping="Wrap" Text="Readers List" VerticalAlignment="Top" Height="45" Width="199" FontSize="30"/>
        <AppBarButton x:Name="ButtonGoToSettings" HorizontalAlignment="Left" Icon="Back" Label="Settings" Margin="10,0,0,0" VerticalAlignment="Top" Width="Auto" Click="GoTo_Settings_Click"/>
        <TextBlock HorizontalAlignment="Left" Margin="10,80,0,0" TextWrapping="Wrap" Text="Available Readers" VerticalAlignment="Top" FontSize="24"/>
        <ListView x:Name="ListViewReaders" DataContext="{Binding}" IsItemClickEnabled="True" ItemClick="ListViewReaders_ItemClick" Margin="10,120,10,20" FlyoutBase.AttachedFlyout="{StaticResource FlyoutBase1}"  FontSize="14" BorderThickness="0" >
            <ListView.ItemTemplate>
                <DataTemplate>
                    <Grid HorizontalAlignment="Left" VerticalAlignment="Top">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="280" />
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <TextBlock x:Name="TextDisplayName"  Grid.Column="0" Text="{Binding DisplayName}" VerticalAlignment="Top" FontSize="16" Margin="0,10,0,0" HorizontalAlignment="Left"/>
                        <CheckBox x:Name="checkbox" Grid.Column="1" IsChecked="{Binding ReaderConnectionState}" IsEnabled="False" FontSize="10"/>
                        <TextBlock Text="Serial:" Grid.Row="1" FontSize="14" Visibility="{Binding ReaderConnectionStateVisible}" />
                        <TextBlock x:Name="TextSerialDisplayName"  Grid.Column="0" Text="{Binding SerialDisplayName}" FontSize="14" Grid.Row="1" Margin="50,0,0,0" Visibility="{Binding ReaderConnectionStateVisible}"/>
                        <TextBlock Text="Model:" Grid.Row="2" FontSize="14" Visibility="{Binding ReaderConnectionStateVisible}" Margin="0,0,0,10" />
                        <TextBlock x:Name="TextModelDisplayName"  Grid.Column="0" Text="{Binding ModelDisplayName}" FontSize="14" Grid.Row="2" Margin="50,0,0,10" Visibility="{Binding ReaderConnectionStateVisible}"/>
                    </Grid>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
        <TextBlock x:Name="TextBlockError" HorizontalAlignment="Left" Margin="16,469,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Height="136" Width="375" FontSize="14"/>
        <Popup x:Name="PopUpPassword">
            <Grid x:Name="PopupPasswordGrid"  Height="185" Width="398" Margin="0,200,0,0" Background="Gray">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <TextBlock x:Name="textConnectLabel"  Grid.Row="0"   FontSize="24" HorizontalAlignment="Center" Text="Connection password required!" Margin="34,15,13,61.333" Grid.RowSpan="2" Width="351"  />
                <TextBox x:Name="TextPassword" Grid.Row="1" FontSize="18" HorizontalAlignment="Center"  Width="247" />
                <Grid Grid.Row="2">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Button x:Name="ButtonPasswordConnectCommand" Grid.Column="1" HorizontalAlignment="Center" Content="Connect" Margin="9.5,9,79,8" Click="ButtonPasswordConnectCommand_Click"/>
                    <Button x:Name="ButtonPasswordCancelCommand" Grid.Column="0" HorizontalAlignment="Center" Content="Cancel" Margin="78,9,10.5,8" Click="ButtonPasswordCancelCommand_Click"/>
                </Grid>
            </Grid>
        </Popup>
    </Grid>
</Page>
