<Window x:Class="unitechRFIDSample.MainWindow"
        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:local="clr-namespace:unitechRFIDSample"
        xmlns:l="clr-namespace:unitechRFIDSample.ViewModels"
        mc:Ignorable="d"
        d:DataContext="{d:DesignInstance Type=l:MainViewModel}"
        FontSize="16"
        FontFamily="Arial"
        Closing="Window_Closing"
        Title="unitechRFIDSample" Height="600" Width="900">
    <Window.Resources>
        <Style x:Key="infoTag" TargetType="TextBlock">
            <Setter Property="FontWeight" Value="Bold"/>
            <Setter Property="HorizontalAlignment" Value="Left"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
        </Style>
        <Style x:Key="infoData" TargetType="TextBlock">
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="HorizontalAlignment" Value="Left"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
        </Style>
        <Style x:Key="operationButton" TargetType="Button">
            <Setter Property="Margin" Value="10"/>
            <Setter Property="HorizontalAlignment" Value="Stretch"/>
            <Setter Property="IsEnabled" Value="{Binding IsInventoried}"/>
            <Setter Property="Command" Value="{Binding OperationCommand}"/>
            <Setter Property="CommandParameter" Value="{Binding}"/>
        </Style>
        <Style x:Key="inventoryButton" TargetType="Button">
            <Setter Property="Margin" Value="10"/>
            <Setter Property="HorizontalAlignment" Value="Stretch"/>
            <Setter Property="IsEnabled" Value="{Binding IsConnected}"/>
            <Setter Property="Command" Value="{Binding OperationCommand}"/>
            <Setter Property="CommandParameter" Value="{Binding}"/>
        </Style>
        <Style x:Key="findButton" TargetType="Button">
            <Setter Property="Margin" Value="10"/>
            <Setter Property="HorizontalAlignment" Value="Stretch"/>
            <Setter Property="IsEnabled" Value="{Binding IsFindable}"/>
            <Setter Property="Command" Value="{Binding OperationCommand}"/>
            <Setter Property="CommandParameter" Value="{Binding}"/>
        </Style>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="60"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <!--#region Connection Bar-->
        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="180"/>
                <ColumnDefinition Width="150"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="300"/>
                <ColumnDefinition Width="100"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button Grid.Column="0" Style="{StaticResource operationButton}"
                    Content="{Binding ConnectText}" CommandParameter="{Binding ConnectText}"
                    IsEnabled="True"/>
            <ComboBox Grid.Column="1" Margin="10" HorizontalAlignment="Stretch" VerticalAlignment="Center"
                      ItemsSource="{Binding ConnectionTypes}"
                      SelectedItem="{Binding SelectedConnectionType}"
                      SelectedIndex="{Binding SelectedConnectionTypeIndex}"
                      IsEnabled="{Binding IsDisconnected}">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding Path=Name}"/>
                        </StackPanel>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
            <TextBlock Grid.Column="2" Margin="10" VerticalAlignment="Center" Text="{Binding PathInfo}"/>
            <TextBox Grid.Column="3" Margin="10" VerticalAlignment="Center" Name="ConnectPathTextBox"
                     Text="{Binding Path=ConnectPath, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                     IsEnabled="{Binding IsDisconnected}"/>

            <TextBlock Grid.Column="3" Margin="15" IsHitTestVisible="False"
                       Text="{Binding HintText}" VerticalAlignment="Center" Foreground="DarkGray">
                <TextBlock.Style>
                    <Style TargetType="{x:Type TextBlock}">
                        <Setter Property="Visibility" Value="Collapsed"/>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding Text, ElementName=ConnectPathTextBox}" Value="">
                                <Setter Property="Visibility" Value="Visible"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </TextBlock.Style>
            </TextBlock>

            <Button Grid.Column="4" Style="{StaticResource findButton}"
                    Content="Find" CommandParameter="Find"/>
        </Grid>
        <!--#endregion-->

        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="130"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <!--#region Device Info-->
            <Grid Grid.Column="0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="60"/>
                    <RowDefinition Height="60"/>
                    <RowDefinition Height="60"/>
                    <RowDefinition Height="60"/>
                    <RowDefinition Height="60"/>
                    <RowDefinition Height="60"/>
                    <RowDefinition Height="60"/>
                    <RowDefinition Height="60"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Grid Grid.Row="0" Margin="10">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0" Style="{StaticResource infoTag}" Text="Name: "/>
                    <TextBlock Grid.Row="1" Style="{StaticResource infoData}" Text="{Binding Name}"/>
                </Grid>
                <Grid Grid.Row="1" Margin="10">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0" Style="{StaticResource infoTag}" Text="Version: "/>
                    <TextBlock Grid.Row="1" Style="{StaticResource infoData}" Text="{Binding Version}"/>
                </Grid>
                <Grid Grid.Row="2" Margin="10">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0" Style="{StaticResource infoTag}" Text="Bluetooth: "/>
                    <TextBlock Grid.Row="1" Style="{StaticResource infoData}" Text="{Binding Bluetooth}"/>
                </Grid>
                <Grid Grid.Row="3" Margin="10">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0" Style="{StaticResource infoTag}" Text="Battery: "/>
                    <TextBlock Grid.Row="1" Style="{StaticResource infoData}" Text="{Binding Battery}"/>
                </Grid>
                <Grid Grid.Row="4" Margin="10">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0" Style="{StaticResource infoTag}" Text="Temperature: "/>
                    <TextBlock Grid.Row="1" Style="{StaticResource infoData}" Text="{Binding Temperature}"/>
                </Grid>
                <Grid Grid.Row="5" Margin="10">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0" Style="{StaticResource infoTag}" Text="Key: "/>
                    <TextBlock Grid.Row="1" Style="{StaticResource infoData}" Text="{Binding KeyStatus}"/>
                </Grid>
                <Grid Grid.Row="6" Margin="10">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0" Style="{StaticResource infoTag}" Text="Status: "/>
                    <TextBlock Grid.Row="1" Style="{StaticResource infoData}" Text="{Binding ConnectStatus}"/>
                </Grid>
                <Grid Grid.Row="7" Margin="10">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0" Style="{StaticResource infoTag}" Text="Action State: "/>
                    <TextBlock Grid.Row="1" Style="{StaticResource infoData}" Text="{Binding ActionStateText}"/>
                </Grid>
            </Grid>
            <!--#endregion-->

            <Grid Grid.Column="1">
                <Grid.RowDefinitions>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>

                <!--#region Inventory-->
                <Grid Grid.Row="0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="130"/>
                        <ColumnDefinition Width="100"/>
                        <ColumnDefinition Width="200"/>
                        <ColumnDefinition Width="50"/>
                        <ColumnDefinition Width="50"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Button Grid.Column="0" Style="{StaticResource inventoryButton}" Content="{Binding InventoryText}" CommandParameter="{Binding InventoryText}"/>
                    <TextBlock Grid.Column="1" Style="{StaticResource infoTag}" Text="Target EPC:"/>
                    <TextBlock Grid.Column="2" Style="{StaticResource infoData}" Text="{Binding EPC}"/>
                    <TextBlock Grid.Column="3" Style="{StaticResource infoTag}" Text="RSSI:"/>
                    <TextBlock Grid.Column="4" Style="{StaticResource infoData}" Text="{Binding RSSI}"/>
                </Grid>
                <!--#endregion-->

                <Grid Grid.Row="1" Margin="10">
                    <DockPanel>
                        <TabControl>
                            <!--#region Read/Write-->
                            <TabItem Header="Read/Write" Tag="Read/Write">
                                <Grid Margin="0,-3,0,0">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="100"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid Grid.Column="0">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="50"/>
                                            <RowDefinition Height="50"/>
                                            <RowDefinition Height="50"/>
                                            <RowDefinition Height="50"/>
                                            <RowDefinition Height="*"/>
                                        </Grid.RowDefinitions>
                                        <Button Grid.Row="0" Style="{StaticResource operationButton}" Content="Read" CommandParameter="Read"/>
                                        <Button Grid.Row="1" Style="{StaticResource operationButton}" Content="Write" CommandParameter="Write"/>
                                        <Button Grid.Row="3" Style="{StaticResource operationButton}" Content="Display" CommandParameter="Display"/>
                                    </Grid>

                                    <Grid Grid.Column="1">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="50"/>
                                            <RowDefinition Height="50"/>
                                            <RowDefinition Height="50"/>
                                            <RowDefinition Height="50"/>
                                            <RowDefinition Height="*"/>
                                        </Grid.RowDefinitions>
                                        <Grid Grid.Row="0">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="60"/>
                                                <ColumnDefinition Width="120"/>
                                                <ColumnDefinition Width="50"/>
                                                <ColumnDefinition Width="80"/>
                                                <ColumnDefinition Width="60"/>
                                                <ColumnDefinition Width="80"/>
                                                <ColumnDefinition Width="*"/>
                                            </Grid.ColumnDefinitions>

                                            <TextBlock Grid.Column="0" Style="{StaticResource infoTag}" Text="Bank:"/>
                                            <ComboBox Grid.Column="1" Margin="0,0,10,0" HorizontalAlignment="Stretch" VerticalAlignment="Center"
                                                      ItemsSource="{Binding BankTypes}"
                                                      SelectedItem="{Binding SelectedBankType}"
                                                      SelectedIndex="{Binding SelectedBankTypeIndex}"
                                                      IsEnabled="{Binding IsConnected}">
                                                <ComboBox.ItemTemplate>
                                                    <DataTemplate>
                                                        <StackPanel Orientation="Horizontal">
                                                            <TextBlock Text="{Binding Path=Name}"/>
                                                        </StackPanel>
                                                    </DataTemplate>
                                                </ComboBox.ItemTemplate>
                                            </ComboBox>

                                            <TextBlock Grid.Column="2" Style="{StaticResource infoTag}" Text="Offset:"/>
                                            <TextBox Grid.Column="3" Margin="10,0,10,0" VerticalAlignment="Center"
                                                     Text="{Binding Path=Offset, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                     PreviewTextInput="NumberChecker" IsEnabled="{Binding IsConnected}"/>

                                            <TextBlock Grid.Column="4" Style="{StaticResource infoTag}" Text="Length:"/>
                                            <TextBox Grid.Column="5" Margin="10,0,10,0" VerticalAlignment="Center"
                                                     Text="{Binding Path=Length, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                     PreviewTextInput="NumberChecker" IsEnabled="{Binding IsConnected}"/>
                                        </Grid>
                                        <Grid Grid.Row="1">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="50"/>
                                                <ColumnDefinition Width="200"/>
                                                <ColumnDefinition Width="70"/>
                                                <ColumnDefinition Width="*"/>
                                            </Grid.ColumnDefinitions>

                                            <TextBlock Grid.Column="0" Style="{StaticResource infoTag}" Text="Data:"/>
                                            <TextBox Grid.Column="1" Margin="10,0,10,0" VerticalAlignment="Center"
                                                     Text="{Binding Path=Data, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>

                                            <TextBlock Grid.Column="2" Style="{StaticResource infoTag}" Text="Result:"/>
                                            <TextBlock Grid.Column="3" Style="{StaticResource infoData}" Text="{Binding Result}"/>
                                        </Grid>
                                        <Grid Grid.Row="2">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="150"/>
                                                <ColumnDefinition Width="120"/>
                                                <ColumnDefinition Width="*"/>
                                            </Grid.ColumnDefinitions>

                                            <TextBlock Grid.Column="0" Style="{StaticResource infoTag}" Text="Access Password:"/>
                                            <TextBox Grid.Column="1" Margin="10,0,10,0" VerticalAlignment="Center"
                                                     Text="{Binding Path=AccessPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
                                        </Grid>

                                        <Grid Grid.Row="3">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="50"/>
                                                <ColumnDefinition Width="200"/>
                                                <ColumnDefinition Width="*"/>
                                            </Grid.ColumnDefinitions>

                                            <TextBlock Grid.Column="0" Style="{StaticResource infoTag}" Text="Text:"/>
                                            <TextBox Grid.Column="1" Margin="10,0,10,0" VerticalAlignment="Center"
                                                     Text="{Binding Path=Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
                                        </Grid>
                                    </Grid>

                                </Grid>
                            </TabItem>
                            <!--#endregion Read/Write-->
                            <!--#region Lock-->
                            <TabItem Header="Lock" Tag="Lock">
                                <Grid Margin="0,-3,0,0">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="100"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid Grid.Column="0">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="50"/>
                                            <RowDefinition Height="*"/>
                                        </Grid.RowDefinitions>
                                        <Button Grid.Row="0" Style="{StaticResource operationButton}" Content="Lock" CommandParameter="Lock"/>
                                    </Grid>
                                    <Grid Grid.Column="1">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="50"/>
                                            <RowDefinition Height="50"/>
                                            <RowDefinition Height="*"/>
                                        </Grid.RowDefinitions>

                                        <Grid Grid.Row="0">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="60"/>
                                                <ColumnDefinition Width="160"/>
                                                <ColumnDefinition Width="60"/>
                                                <ColumnDefinition Width="100"/>
                                                <ColumnDefinition Width="*"/>
                                            </Grid.ColumnDefinitions>
                                            <TextBlock Grid.Column="0" Style="{StaticResource infoTag}" Text="Bank:"/>
                                            <ComboBox Grid.Column="1" Margin="0,0,10,0" HorizontalAlignment="Stretch" VerticalAlignment="Center"
                                                      ItemsSource="{Binding LockBankTypes}"
                                                      SelectedItem="{Binding SelectedLockBankType}"
                                                      SelectedIndex="{Binding SelectedLockBankTypeIndex}">
                                                <ComboBox.ItemTemplate>
                                                    <DataTemplate>
                                                        <StackPanel Orientation="Horizontal">
                                                            <TextBlock Text="{Binding Path=Name}"/>
                                                        </StackPanel>
                                                    </DataTemplate>
                                                </ComboBox.ItemTemplate>
                                            </ComboBox>
                                            <TextBlock Grid.Column="2" Style="{StaticResource infoTag}" Text="Lock:"/>
                                            <ComboBox Grid.Column="3" Margin="0,0,10,0" HorizontalAlignment="Stretch" VerticalAlignment="Center"
                                                      ItemsSource="{Binding LockTypes}"
                                                      SelectedItem="{Binding SelectedLockType}"
                                                      SelectedIndex="{Binding SelectedLockTypeIndex}">
                                                <ComboBox.ItemTemplate>
                                                    <DataTemplate>
                                                        <StackPanel Orientation="Horizontal">
                                                            <TextBlock Text="{Binding Path=Name}"/>
                                                        </StackPanel>
                                                    </DataTemplate>
                                                </ComboBox.ItemTemplate>
                                            </ComboBox>
                                        </Grid>

                                        <Grid Grid.Row="1">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="150"/>
                                                <ColumnDefinition Width="120"/>
                                                <ColumnDefinition Width="70"/>
                                                <ColumnDefinition Width="*"/>
                                            </Grid.ColumnDefinitions>

                                            <TextBlock Grid.Column="0" Style="{StaticResource infoTag}" Text="Lock Password:"/>
                                            <TextBox Grid.Column="1" Margin="10,0,10,0" VerticalAlignment="Center"
                                                     Text="{Binding Path=LockPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>

                                            <TextBlock Grid.Column="2" Style="{StaticResource infoTag}" Text="Result:"/>
                                            <TextBlock Grid.Column="3" Style="{StaticResource infoData}" Text="{Binding Result}"/>
                                        </Grid>
                                    </Grid>
                                </Grid>
                            </TabItem>
                            <!--#endregion-->
                            <!--#region Kill-->
                            <TabItem Header="Kill" Tag="Kill">
                                <Grid Margin="0,-3,0,0">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="100"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid Grid.Column="0">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="50"/>
                                            <RowDefinition Height="*"/>
                                        </Grid.RowDefinitions>
                                        <Button Grid.Row="0" Style="{StaticResource operationButton}" Content="Kill" CommandParameter="Kill"/>
                                    </Grid>

                                    <Grid Grid.Column="1">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="50"/>
                                            <RowDefinition Height="*"/>
                                        </Grid.RowDefinitions>

                                        <Grid Grid.Row="0">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="120"/>
                                                <ColumnDefinition Width="120"/>
                                                <ColumnDefinition Width="70"/>
                                                <ColumnDefinition Width="*"/>
                                            </Grid.ColumnDefinitions>

                                            <TextBlock Grid.Column="0" Style="{StaticResource infoTag}" Text="Kill Password:"/>
                                            <TextBox Grid.Column="1" Margin="10,0,10,0" VerticalAlignment="Center"
                                                     Text="{Binding Path=KillPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>

                                            <TextBlock Grid.Column="2" Style="{StaticResource infoTag}" Text="Result:"/>
                                            <TextBlock Grid.Column="3" Style="{StaticResource infoData}" Text="{Binding Result}"/>
                                        </Grid>
                                    </Grid>
                                </Grid>
                            </TabItem>
                            <!--#endregion-->
                        </TabControl>
                    </DockPanel>
                </Grid>
            </Grid>
        </Grid>

    </Grid>
</Window>
