Serial Port GPS Layer

This sample demonstrates how to use the SerialPortGpsCoordinateWatcher to search for a serial port with a connected GPS receiver and to show the reported location on a map.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.SerialPortGpsLayer"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:esri="http://schemas.esri.com/arcgis/client/2009"
             Unloaded="UserControl_Unloaded">
    <Grid>
        <Grid.Resources>
            <LinearGradientBrush x:Key="PanelGradient" EndPoint="0.5,1" StartPoint="0.5,0">
                <LinearGradientBrush.RelativeTransform>
                    <TransformGroup>
                        <ScaleTransform CenterY="0.5" CenterX="0.5"/>
                        <SkewTransform CenterY="0.5" CenterX="0.5"/>
                        <RotateTransform Angle="176" CenterY="0.5" CenterX="0.5"/>
                        <TranslateTransform/>
                    </TransformGroup>
                </LinearGradientBrush.RelativeTransform>
                <GradientStop Color="#FF145787" Offset="0.16"/>
                <GradientStop Color="#FF3D7FAC" Offset="0.502"/>
                <GradientStop Color="#FF88C5EF" Offset="0.984"/>
            </LinearGradientBrush>

        </Grid.Resources>
        <esri:Map Extent="-13046586.9363318,4036013.64823107,-13045676.4100906,4036832.85611">
            <esri:ArcGISTiledMapServiceLayer ID="arcGISTiledMapServiceLayer" Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" />
            <esri:GpsLayer x:Name="gpsLayer"/>
        </esri:Map>
        <Border Background="#995C90B2" BorderThickness="1" CornerRadius="5"
            HorizontalAlignment="Center"  VerticalAlignment="Center"
            Visibility="{Binding ElementName=txtInfo, Path=Visibility}"
            Margin="20" Padding="5" BorderBrush="Black">
            <TextBlock x:Name="txtInfo" Visibility="Collapsed" Text="Looking for GPS device..."/>
        </Border>

        <Grid HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,10,10,0" >
            <Rectangle Fill="{StaticResource PanelGradient}" Stroke="Gray"  RadiusX="10" RadiusY="10" Margin="0,0,0,5">
                <Rectangle.Effect>
                    <DropShadowEffect/>
                </Rectangle.Effect>
            </Rectangle>
            <Rectangle Fill="#DDFFFFFF" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="5,5,5,10" />
            <StackPanel>
            <TextBlock x:Name="Instructions" Text="Click Start to search for a GPS device attached to a serial port and click Stop to cancel the search." 
                       Width="200" TextAlignment="Left" Margin="15,15,15,5" TextWrapping="Wrap" Foreground="Black" />
                <Button Width="100" Margin="15,5,15,20" Content="Start"  x:Name="btnGps"  Click="btnGps_Click"/>
            </StackPanel>
        </Grid>

    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014