Code
Code
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.WindowsMobile.Samples.Location;
using System.Reflection;
using System.Net;
using System.IO;
namespace ShowGPS
{
public partial class Form1 : Form
{
private Gps gps;
public Form1()
{
InitializeComponent();
gps = new Gps();
}
else
{
gps.DeviceStateChanged -= gps_DeviceStateChanged;
gps.LocationChanged -= gps_LocationChanged;
gps.Close();
tbGPSDevice.Text = "";
tbGPSDeviceState.Text = "";
tbGPSServiceState.Text = "";
tbHeading.Text = "";
tbLatitude.Text = "";
tbLongitude.Text = "";
tbSatellites.Text = "";
}
menuItem1.Text = gps.Opened ? "GPS Off" : "GPS On";
}
private void menuItem2_Click(object sender, EventArgs e)
{
}
if (position.LatitudeValid)
Invoke(cu, tbLatitude, position.Latitude.ToString());
if (position.LongitudeValid)
Invoke(cu, tbLongitude, position.Longitude.ToString());
if (position.HeadingValid)
Invoke(cu, tbHeading, position.Heading.ToString());
if (position.SatellitesInViewCountValid)
Invoke(cu, tbSatellites,
position.SatellitesInViewCount.ToString());
}
gps.Close();
}
}
private void Form1_Load(object sender, EventArgs e)
{
gps.DeviceStateChanged += new
DeviceStateChangedEventHandler(gps_DeviceStateChanged);
gps.LocationChanged += new
LocationChangedEventHandler(gps_LocationChanged);
gps.Open();
}