<Window x:Class="GpsEmulator.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:src="clr-namespace:GpsEmulator"
        xmlns:map="clr-namespace:GpsEmulator.MapControl"
        Icon="Resources\GpsEmulator.ico"
        Title="Windows Phone GPS Emulator" Height="600" Width="800">
    <Window.Resources>
        <Style x:Key="ZoomInButton" TargetType="Button">
            <Setter Property="Width" Value="20" />
            <Setter Property="Height" Value="20" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid Width="20" Height="20">
                            <Image Source="/Resources/ZoomIn.png" Stretch="Fill" />
                            <ContentPresenter HorizontalAlignment="Center" />
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Effect">
                                    <Setter.Value>
                                        <DropShadowEffect ShadowDepth="2" />
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="ZoomOutButton" TargetType="Button">
            <Setter Property="Width" Value="20" />
            <Setter Property="Height" Value="20" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid Width="20" Height="20">
                            <Image Source="/Resources/ZoomOut.png" Stretch="Fill" />
                            <ContentPresenter HorizontalAlignment="Center" />
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Effect">
                                    <Setter.Value>
                                        <DropShadowEffect ShadowDepth="2" />
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="20"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="22"/>
        </Grid.RowDefinitions>
        <Menu Name="menu" Grid.Row="0" HorizontalAlignment="Stretch">
            <MenuItem Header="_File">
                <MenuItem Header="_New" InputGestureText="Ctrl+N" Command="New" />
                <MenuItem Header="_Open" InputGestureText="Ctrl+O" Command="Open" />
                <MenuItem Header="_Recent">
                    <MenuItem Header="..."/>
                </MenuItem>
                <MenuItem Header="_Save" InputGestureText="Ctrl+S" Command="Save" />
                <MenuItem Header="_Save As" Click="mnuSaveAs_Click" />
                <Separator/>
                <MenuItem Header="E_xit" InputGestureText="Alt+F4" Command="Close"/>
            </MenuItem>
            <MenuItem Header="_Tools">
                <MenuItem Header="_Set API Key ..." Click="mnuSetApiKey_Click"/>
                <MenuItem Header="_Options ..." Click="mnuOptions_Click" />
            </MenuItem>
            <MenuItem Header="_Help">
                <MenuItem Header="_About" Click="mnuAbout_Click"/>
            </MenuItem>
        </Menu>
        <Grid Grid.Row="1" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="230" MinWidth="230"/>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <DockPanel VerticalAlignment="Stretch" Grid.Column="0">
                <DockPanel DockPanel.Dock="Top" HorizontalAlignment="Stretch" Height="130px">
                    <Label DockPanel.Dock="Top" FontWeight="Bold" Background="AliceBlue">Waypoint</Label>
                    <DockPanel DockPanel.Dock="Top" Margin="2,2,5,2">
                        <Button Name="btnSearch" DockPanel.Dock="Right" Width="80" Margin="5,0,0,0" Click="btnSearch_Click">Search</Button>
                        <TextBox Name="tbSearchString" KeyUp="tbSearchString_KeyUp"/>
                    </DockPanel>
                    <Grid DockPanel.Dock="Right" Width="80" Margin="0,3,5,2">
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition Height="5" />
                            <RowDefinition/>
                            <RowDefinition Height="5" />
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <Button Name="btnAddPoint" Grid.Row="0" Click="btnAddPoint_Click">Add Point</Button>
                        <Button Name="btnAddRoute" Grid.Row="2" Click="btnAddRoute_Click">Add Route</Button>
                        <Button Name="btnUpdatePoint" Grid.Row="4" Click="btnUpdatePoint_Click" ToolTip="Replaces the currently selected point in the route">Update Point</Button>
                    </Grid>
                    <Border BorderBrush="LightSkyBlue" BorderThickness="1" Margin="2,0,5,0" >
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="55"/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Label Grid.Row="0" Grid.Column="0" DockPanel.Dock="Left">Lat:</Label>
                            <TextBox Name="tbPositionLat" Grid.Row="0" Grid.Column="1" Height="20" HorizontalAlignment="Stretch" Margin="0,0,5,0" TextChanged="positionTextChanged">47.6395454</TextBox>
                            <Label Grid.Row="1" Grid.Column="0" DockPanel.Dock="Left">Long:</Label>
                            <TextBox Name="tbPositionLng" Grid.Row="1" Grid.Column="1" Height="20" HorizontalAlignment="Stretch" Margin="0,0,5,0" TextChanged="positionTextChanged">-122.130699</TextBox>
                            <Label Grid.Row="2" Grid.Column="0" DockPanel.Dock="Left">Time:</Label>
                            <TextBox Name="tbTime" Grid.Row="2" Grid.Column="1" Height="20" HorizontalAlignment="Stretch" Margin="0,0,5,0" TextChanged="timeTextChanged" Text="00:00:00.00"/>
                        </Grid>
                    </Border>
                </DockPanel>
                <DockPanel DockPanel.Dock="Bottom" HorizontalAlignment="Stretch" Height="76px">
                    <Grid DockPanel.Dock="Top">
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="72" />
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Rectangle Grid.Row="0" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" Height="3" Fill="LightGray" Margin="0,0 ,0,0" />
                        <TextBlock Grid.Row="1" Grid.ColumnSpan="2" Background="AliceBlue" FontWeight="Bold" Padding="5,2,0,2" Height="26">Simulation</TextBlock>
                        <TextBlock Grid.Row="2" Grid.Column="0" Name="tbSpeed" Margin="5,0,5,0" VerticalAlignment="Center">Speed : x1</TextBlock>
                        <Slider Grid.Row="2" Grid.Column="1" HorizontalAlignment="Stretch" Name="sldSimulationSpeed" Minimum="0" Maximum="6" IsSnapToTickEnabled="True" SmallChange="1" TickPlacement="BottomRight" ToolTip="Simulation Speed" ValueChanged="sldSimulationSpeed_ValueChanged"/>
                    </Grid>
                    <Button DockPanel.Dock="Left" Name="btnStart" Margin="5,2,5,2" Click="btnStart_Click">Start</Button>
                    <Button DockPanel.Dock="Left" Name="btnReset" Margin="0,2,0,2" Click="btnReset_Click">Reset</Button>
                    <TextBlock Name="tbCurrentPosition" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
                </DockPanel>
                <DockPanel>
                    <Rectangle DockPanel.Dock="Top" HorizontalAlignment="Stretch" Height="3" Fill="LightGray" Margin="0,2,0,0" />
                    <Label DockPanel.Dock="Top" FontWeight="Bold" Background="AliceBlue">Route</Label>
                    <ListView Name="lvRoute">
                        <ListView.View>
                            <GridView  ColumnHeaderToolTip="Route Information">
                                <GridViewColumn Header="Time" DisplayMemberBinding="{Binding Path=Time}" />
                                <GridViewColumn  Header="Lat" DisplayMemberBinding="{Binding Path=Position.X}" />
                                <GridViewColumn  Header="Long"  DisplayMemberBinding="{Binding Path=Position.Y}" />
                            </GridView>
                        </ListView.View>
                    </ListView>
                </DockPanel>
            </DockPanel>
            <GridSplitter Grid.Column="1" Background="LightGray" ShowsPreview="True" Width="5" HorizontalAlignment="Stretch" />
            <Grid Grid.Column="2">
                <Grid.RowDefinitions>
                    <RowDefinition Height="25"/>
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <Label Grid.Row="0" Grid.Column="0" FontWeight="Bold" Background="AliceBlue">Map</Label>
                <StackPanel Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="1" Orientation="Horizontal" Background="AliceBlue">
                    <Label>Map Type</Label>
                    <ComboBox SelectedItem="{Binding ElementName=MapControl, Path=MapType}" FontSize="12" Name="cmbMapType" Margin="0,2,5,2" Height="27" Width="80" SelectionChanged="cmbMapType_SelectionChanged" />
                </StackPanel>
                <map:MapControl x:Name="MapControl" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"/>
                <StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="0" VerticalAlignment="Top" Margin="5,5,0,0">
                    <Button Name="btnZoomIn" Style="{StaticResource ZoomInButton}" Width="20" Height="20" Click="btnZoomIn_Click" />
                    <Label></Label>
                    <Button Name="btnZoomOut" Style="{StaticResource ZoomOutButton}" Width="20" Height="20" Click="btnZoomOut_Click"/>
                </StackPanel>
            </Grid>
        </Grid>
        <StatusBar Grid.Row="2" BorderBrush="Black" BorderThickness="0,1,0,0">
            <StatusBarItem HorizontalAlignment="Left" Width="180">
                <TextBlock Name="tbOnlineStatus">Not Connected to the Internet</TextBlock>
            </StatusBarItem>
            <Separator/>
            <StatusBarItem>
                <TextBlock Name="tbFileName">No file loaded</TextBlock>
            </StatusBarItem>
            <Separator/>
            <StatusBarItem HorizontalAlignment="Right" Width="140">
                <DockPanel>
                    <Ellipse DockPanel.Dock="Left" Name="elClientIndicator" Fill="Red" Stroke="Black" Width="14" Height="14"/>
                    <TextBlock DockPanel.Dock="Right" Name="tbClientIndicator" Margin="10,0,0,0">No client connected</TextBlock>
                </DockPanel>
            </StatusBarItem>
        </StatusBar>
    </Grid>
</Window>
