This sample demonstrates how to use the ArcGIS Runtime SDK for WPF to
playback NMEA sentences from a log file to show a location on a
map using the FileGpsCoordinateWatcher.
Download Sample Application
< UserControl x:Class = " ArcGISWPFSDK.FileGpsLayer "
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 " >
< UserControl.Resources >
< esri : FileGpsCoordinateWatcher x:Key = " fileGpsWatcher " Path = " ..\Data\GPS\campus.txt " LoopPlayback = " true " />
</ UserControl.Resources >
< Grid >
< esri : Map Extent = " -13046586.9363318,4036013.64823107,-13045676.4100906,4036832.85611 " >
< esri : ArcGISLocalTiledLayer ID = " localTiledLayer " Path = " ..\Data\TPKs\Campus.tpk " />
< esri : GpsLayer GeoPositionWatcher = " {StaticResource fileGpsWatcher} " />
</ esri : Map >
</ Grid >
</ UserControl >
using System;
using System.Windows;
using System.Windows.Controls;
namespace ArcGISWPFSDK
{
/// <summary>
/// Interaction logic for FileGpsLayer.xaml
/// </summary>
public partial class FileGpsLayer : UserControl
{
public FileGpsLayer()
{
InitializeComponent();
Application.Current.Exit += new ExitEventHandler(Current_Exit);
}
void Current_Exit(object sender, ExitEventArgs e)
{
//Cleanup GpsCoordinateWatcher resource
IDisposable fileGpsWatcher = this .TryFindResource("fileGpsWatcher" ) as IDisposable;
if (fileGpsWatcher != null )
fileGpsWatcher.Dispose();
}
}
}
Imports System.Windows
Imports System.Windows.Controls
''' <summary>
''' Interaction logic for FileGpsLayer.xaml
''' </summary>
Namespace ArcGISWPFSDK
Partial Public Class FileGpsLayer
Inherits UserControl
Public Sub New ()
InitializeComponent()
AddHandler Application.Current.[Exit ], New ExitEventHandler(AddressOf Current_Exit)
End Sub
Private Sub Current_Exit(sender As Object , e As ExitEventArgs)
'Cleanup GpsCoordinateWatcher resource
Dim fileGpsWatcher As IDisposable = TryCast(Me .TryFindResource("fileGpsWatcher" ), IDisposable)
If fileGpsWatcher IsNot Nothing Then
fileGpsWatcher.Dispose()
End If
End Sub
End Class
End Namespace
5/16/2014