Added System.Device.Location GeoCoordinate event for Updated Location
This commit is contained in:
25
GpsClient/EventArguments/GeoCoordinatesChangedEventArgs.cs
Normal file
25
GpsClient/EventArguments/GeoCoordinatesChangedEventArgs.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Device.Location;
|
||||
using KollNet.Lib.Models;
|
||||
|
||||
namespace KollNet.Lib.EventArguments {
|
||||
public class GeoCoordinatesChangedEventArgs : EventArgs {
|
||||
public GeoCoordinate Coordinate { get; set; }
|
||||
|
||||
public GeoCoordinatesChangedEventArgs() { }
|
||||
public GeoCoordinatesChangedEventArgs(GeoCoordinate gc) { Coordinate = gc; }
|
||||
public GeoCoordinatesChangedEventArgs(GpsCoordinates gc) {
|
||||
Coordinate = new GeoCoordinate() {
|
||||
Latitude = gc.Latitude,
|
||||
Longitude = gc.Longitude,
|
||||
Speed = gc.Speed,
|
||||
Course = gc.Course,
|
||||
Altitude = gc.Altitude
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,8 +20,12 @@ namespace KollNet.Lib {
|
||||
#region "Public Events"
|
||||
internal static void OnSatellitesUpdated(SatellitesUpdatedEventArgs e) { SatellitesUpdated?.Invoke(null, e); }
|
||||
public static event EventHandler<SatellitesUpdatedEventArgs> SatellitesUpdated;
|
||||
internal static void OnPositionChanged(GpsCoordinatesChangedEventArgs e) { PositionChanged?.Invoke(null, e); }
|
||||
internal static void OnPositionChanged(GpsCoordinatesChangedEventArgs e) {
|
||||
PositionChanged?.Invoke(null, e);
|
||||
GeoPositionChanged?.Invoke(null, new GeoCoordinatesChangedEventArgs(e.Coordinates));
|
||||
}
|
||||
public static event EventHandler<GpsCoordinatesChangedEventArgs> PositionChanged;
|
||||
public static event EventHandler<GeoCoordinatesChangedEventArgs> GeoPositionChanged;
|
||||
internal static void OnConnected() { Connected?.Invoke(null, EventArgs.Empty); }
|
||||
public static event EventHandler Connected;
|
||||
internal static void OnDisconnected() { Disconnected?.Invoke(null, EventArgs.Empty); }
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Device" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@@ -41,6 +42,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="EventArguments\GeoCoordinatesChangedEventArgs.cs" />
|
||||
<Compile Include="EventArguments\GpsCoordinatesChangedEventArgs.cs" />
|
||||
<Compile Include="EventArguments\NmeaReceivedEventArgs.cs" />
|
||||
<Compile Include="EventArguments\SatellitesUpdatedEventArgs.cs" />
|
||||
|
||||
Reference in New Issue
Block a user