<Window x:Class="Skyffer.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:src="clr-namespace:Skyffer"
        Title="Skyffer" Height="605" Width="735" Closed="Window_Closed" Loaded="Window_Loaded">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto"></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
            <RowDefinition Height="auto"></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0" Grid.Column="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"></RowDefinition>
                <RowDefinition Height="auto"></RowDefinition>
                <RowDefinition Height="auto"></RowDefinition>
                <RowDefinition Height="auto"></RowDefinition>
                <RowDefinition Height="auto"></RowDefinition>
                <RowDefinition Height="auto"></RowDefinition>
                <RowDefinition Height="auto"></RowDefinition>
            </Grid.RowDefinitions>
            <Label Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" FontWeight="Bold" FontSize="18">Skyffer</Label>
            <Grid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Button Grid.Row="0" Grid.Column="0" Margin="0,10" Click="Start_Click" Name="btnStart">Štart</Button>
                <Button Grid.Row="0" Grid.Column="1" Margin="0,10" Click="Stop_Click" Name="btnStop" IsEnabled="False">Stop</Button>
            </Grid>
            <Label Grid.Row="2" Height="26" VerticalAlignment="Bottom" Margin="0,10">Sieťové rozhranie:</Label>
            <ComboBox Grid.Row="2" Grid.Column="1" Name="cboDevices" Margin="0,10"></ComboBox>
            <Label Grid.Row="3" Grid.Column="0" Margin="0,10">Port:</Label>
            <TextBox Grid.Row="3" Grid.Column="1" MaxLength="5" Name="txtPort" Margin="0,10">32586</TextBox>
            <Label Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" Foreground="Red" Visibility="Collapsed" Name="lblPortError">Zadajte číslo v rozmedzí 1 - 65535</Label>
            <Label Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,10">Manuálne vloženie IP adresy:</Label>
            <TextBox Grid.Row="6" Grid.Column="0" Name="txtManualIP" Margin="0,10"></TextBox>
            <Button Grid.Row="6" Grid.Column="1" Margin="0,10" Click="Lokalizuj_Click">Lokalizuj</Button>
        </Grid>
        <Grid Grid.Column="1" Grid.Row="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
            </Grid.RowDefinitions>
            <WrapPanel Grid.Row="0">
                <Button Tag="gmap" Click="MapChange" Margin="5,5">Google Map</Button>
                <Button Tag="gterr" Click="MapChange" Margin="5,5">Google Terrain</Button>
                <Button Tag="ghybrid" Click="MapChange" Margin="5,5">Google Satellite</Button>
            </WrapPanel>
            <src:Map Grid.Row="1" x:Name="MainMap" Zoom="13" MaxZoom="24" MinZoom="1" />
        </Grid>
        <GridSplitter Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Height="3" ResizeDirection="Rows" HorizontalAlignment="Stretch"></GridSplitter>
        <Grid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2">
            <DataGrid Name="grdIPs" CanUserAddRows="False" CanUserDeleteRows="False" AutoGenerateColumns="False">
                <DataGrid.Columns>
                    <DataGridTextColumn Header="Dátum" IsReadOnly="True" Binding="{Binding Path=FirstSeen, StringFormat={}{0:d.M.yyyy}}"></DataGridTextColumn>
                    <DataGridTextColumn Header="Od" IsReadOnly="True" Binding="{Binding Path=FirstSeen, StringFormat={}{0:HH:mm:ss}}"></DataGridTextColumn>
                    <DataGridTextColumn Header="Do" IsReadOnly="True" Binding="{Binding Path=LastSeen, StringFormat={}{0:HH:mm:ss}}"></DataGridTextColumn>
                    <DataGridTextColumn Header="IP adresa" IsReadOnly="True" Binding="{Binding Path=IP}"></DataGridTextColumn>
                    <DataGridTextColumn Header="Zem. šírka" IsReadOnly="True" Binding="{Binding Path=Lat}"></DataGridTextColumn>
                    <DataGridTextColumn Header="Zem. dĺžka" IsReadOnly="True" Binding="{Binding Path=Lon}"></DataGridTextColumn>
                    <DataGridTextColumn Header="Adresa" IsReadOnly="True" Binding="{Binding Path=LocationDesc}"></DataGridTextColumn>
                    <DataGridCheckBoxColumn Header="Zobraziť" IsReadOnly="False" Binding="{Binding Path=IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></DataGridCheckBoxColumn>
                    <DataGridTemplateColumn>
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Button Click="DeleteIP_Click">Odstrániť</Button>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                </DataGrid.Columns>
                <DataGrid.RowStyle>
                    <Style TargetType="DataGridRow">
                        <Setter Property="Background" Value="{Binding BackColor}"></Setter>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding BackColor}" Value="Gold">
                                <Setter Property="FontWeight" Value="ExtraBold"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </DataGrid.RowStyle>
            </DataGrid>
        </Grid>
    </Grid>
</Window>
