0% found this document useful (0 votes)
12 views3 pages

GPS Location Tracking in C# Application

Uploaded by

trongly
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

GPS Location Tracking in C# Application

Uploaded by

trongly
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

using System;

using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];

namespace ShowGPS
{
public partial class Form1 : Form
{
private Gps gps;
public Form1()
{
InitializeComponent();
gps = new Gps();
}

private void menuItem1_Click(object sender, EventArgs e)


{
if (![Link])
{
[Link] += new
DeviceStateChangedEventHandler(gps_DeviceStateChanged);
[Link] += new
LocationChangedEventHandler(gps_LocationChanged);
[Link]();
}

else
{
[Link] -= gps_DeviceStateChanged;
[Link] -= gps_LocationChanged;
[Link]();
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
}
[Link] = [Link] ? "GPS Off" : "GPS On";

}
private void menuItem2_Click(object sender, EventArgs e)
{
}

void gps_LocationChanged(object sender, LocationChangedEventArgs args)


{
ControlUpdater cu = UpdateControl;

GpsPosition position = [Link];

if ([Link])
Invoke(cu, tbLatitude, [Link]());
if ([Link])
Invoke(cu, tbLongitude, [Link]());
if ([Link])
Invoke(cu, tbHeading, [Link]());
if ([Link])
Invoke(cu, tbSatellites,
[Link]());
}

void gps_DeviceStateChanged(object sender, DeviceStateChangedEventArgs


args)
{
ControlUpdater cu = UpdateControl;

GpsDeviceState device = [Link];

Invoke(cu, tbGPSDevice, [Link]);


Invoke(cu, tbGPSDeviceState, [Link]());
Invoke(cu, tbGPSServiceState, [Link]());
}

private delegate void ControlUpdater(Control c, string s);

private void UpdateControl(Control c, string s)


{
[Link] = s;
}

private void Form1_Closing(object sender, CancelEventArgs e)


{
if ([Link])
{
[Link] -= gps_DeviceStateChanged;
[Link] -= gps_LocationChanged;

[Link]();
}
}
private void Form1_Load(object sender, EventArgs e)
{
[Link] += new
DeviceStateChangedEventHandler(gps_DeviceStateChanged);
[Link] += new
LocationChangedEventHandler(gps_LocationChanged);
[Link]();
}

private void timer1_Tick(object sender, EventArgs e)


{
[Link] = new
Uri("[Link] + [Link] +
"&longitude=" + [Link]);

private void menuItem3_Click(object sender, EventArgs e)


{
[Link] = true;
}

private void menuItem4_Click(object sender, EventArgs e)


{
[Link] -= gps_DeviceStateChanged;
[Link] -= gps_LocationChanged;
[Link]();
[Link]();
}
}
}

You might also like