本文整理汇总了C#中Windows.Devices.Geolocation.PositionChangedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# PositionChangedEventArgs类的具体用法?C# PositionChangedEventArgs怎么用?C# PositionChangedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PositionChangedEventArgs类属于Windows.Devices.Geolocation命名空间,在下文中一共展示了PositionChangedEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: myPosition_Changed
private void myPosition_Changed(Geolocator sender, PositionChangedEventArgs args)
{
Dispatcher.BeginInvoke(()=>
{
try
{
double CurrentSpeed = (double)args.Position.Coordinate.Speed;
double CurrentHeading = (double)args.Position.Coordinate.Heading;
string heading = CurrentHeading.ToString();
CurrentHeading = heading == "NaN" ? 0 : CurrentHeading;
mainMap.Heading = CurrentHeading;
mainMap.Center.Longitude = args.Position.Coordinate.Longitude;
mainMap.Center.Latitude = args.Position.Coordinate.Latitude;
mainMap.Center.Altitude = (double)args.Position.Coordinate.Altitude;
MyCoordinate.Longitude = mainMap.Center.Longitude;
MyCoordinate.Latitude = mainMap.Center.Latitude;
MyCoordinate.Altitude = mainMap.Center.Altitude;
mainMap.ZoomLevel = 13;
if (Car.Content == null)
{
Car.Content = CarPolygon;
}
Car.GeoCoordinate = new GeoCoordinate(args.Position.Coordinate.Latitude, args.Position.Coordinate.Longitude);
if (routepoints!= null && routepoints.Count > 0)
{
double distMeters = GeoMath.Distance(Car.GeoCoordinate.Longitude, Car.GeoCoordinate.Latitude, routepoints[0].Geo_Coordinate.Longitude, routepoints[0].Geo_Coordinate.Latitude, GeoMath.MeasureUnits.Kilometers);
distMeters = distMeters * 1000;
}
}
catch (Exception ex)
{
}
});
}
开发者ID:kluesman,项目名称:Freeway,代码行数:35,代码来源:MainPage.xaml.cs
示例2: Geolocator_PositionChanged
async private void Geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args) {
try {
// Carry out the operation
Geoposition pos = await sender.GetGeopositionAsync();
latTB.Text = pos.Coordinate.Latitude.ToString();
longTB.Text = pos.Coordinate.Longitude.ToString();
coordinateLabel.Text = "Accuracy: " + pos.Coordinate.Accuracy.ToString();
coordinateLabel.Text += " Time: " + pos.Coordinate.Timestamp.ToString("HH:mm:ss");
if (pos.Coordinate.Altitude != null) {
coordinateLabel.Text += " Altitude: " + pos.Coordinate.Altitude.ToString();
}
if (pos.Coordinate.Heading != null) {
coordinateLabel.Text += " Heading: " + pos.Coordinate.Heading.ToString();
}
if (pos.Coordinate.Speed != null) {
coordinateLabel.Text += " Speed: " + pos.Coordinate.Speed.ToString();
}
addressLabel.Text = "Country: " + pos.CivicAddress.Country;
if (!String.IsNullOrEmpty(pos.CivicAddress.City)) {
addressLabel.Text += " City: " + pos.CivicAddress.City;
}
} catch (System.UnauthorizedAccessException) {
statusLabel.Text = "No data";
} catch (TaskCanceledException) {
statusLabel.Text = "Cancelled";
}
}
开发者ID:banec,项目名称:GPS-Test,代码行数:30,代码来源:MainForm.cs
示例3: OnPositionChanged
private void OnPositionChanged(Geolocator sender, PositionChangedEventArgs args)
{
if (PositionChanged != null)
{
PositionChanged(this, new CustomPositionChangedEventArgs(args.Position.Coordinate.Speed));
}
}
开发者ID:LimmaPaulus,项目名称:Taksari,代码行数:7,代码来源:GPSTracker_WP.cs
示例4: geolocator_PositionChanged
void geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
{
if (!isTracking)
return;
else
lastKnownPosition = args.Position;
}
开发者ID:jleh,项目名称:WP-RGTracker,代码行数:7,代码来源:MainPage.xaml.cs
示例5: geolocator_PositionChanged
private async void geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
{
var pos = await geolocator.GetGeopositionAsync();
path.Update(
pos.Coordinate.Latitude,
pos.Coordinate.Longitude);
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
if(UserState.UseOldUnits)
{
DistanceDisplay.Text = "Distance: " + path.Distance + " miles";
}
else
{
DistanceDisplay.Text = "Distance: " + (path.Distance/3.0) + " leagues";
}
Map.Visibility = Windows.UI.Xaml.Visibility.Visible;
Map.Center = new Geopoint(path.Last());
MapPolyline poly = new MapPolyline();
poly.Path = new Geopath(path.Coordinates);
poly.StrokeColor = Color.FromArgb(255, 120, 220, 140);
poly.StrokeThickness = 5.0;
poly.Visible = true;
Map.MapElements.Clear();
Map.MapElements.Add(poly);
});
}
开发者ID:tblue1994,项目名称:SoftwareEngineeringProject2015,代码行数:30,代码来源:GatherActivityPage.xaml.cs
示例6: locator_PositionChanged
void locator_PositionChanged(Geolocator sender, PositionChangedEventArgs args) {
var position = args.Position;
currentLocation = position.Coordinate.Point;
string longiNew = position.Coordinate.Point.Position.Longitude.ToString();
string latiNew = position.Coordinate.Point.Position.Latitude.ToString();
//this.currentLocation = position.Coordinate.Point;
//Zbog prčkanja po UI threadu
Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync
(Windows.UI.Core.CoreDispatcherPriority.Normal, () => {
if (longi != longiNew || lati != latiNew) {
UpdateMap(); //Ažuriraj poziciju na mapi
UpdateUICoords(); //ažuriraj prikaz na sučelju
UpdateFile(); //Ažuriraj poziciju u fajl
}
if (longi != longiNew) longi = longiNew;
if (lati != latiNew) lati = latiNew;
});
}
开发者ID:zeljkom,项目名称:nn,代码行数:25,代码来源:MainPage.xaml.cs
示例7: OnPositionChanged
private void OnPositionChanged(Geolocator geolocator, PositionChangedEventArgs args)
{
if(App.RunningInBackground)
{
var toast = new Microsoft.Phone.Shell.ShellToast
{
Content = args.Position.Coordinate.Latitude.ToString("0.00"),
Title = "Standort: ",
NavigationUri = new Uri("/MainPage.xaml", UriKind.Relative)
};
toast.Show();
}
else
{
Dispatcher.BeginInvoke(() =>
{
Latitude.Text = args.Position.Coordinate.Latitude.ToString("F5");
Longitude.Text = args.Position.Coordinate.Longitude.ToString("F5");
_polyline.Path.Add(args.Position.ToGeoCoodinate());
Map.SetView(args.Position.ToGeoCoodinate(), 16);
});
}
}
开发者ID:GregOnNet,项目名称:WP8BookSamples,代码行数:26,代码来源:MainPage.xaml.cs
示例8: Geolocator_PositionChanged
void Geolocator_PositionChanged( Geolocator sender, PositionChangedEventArgs args )
{
RemainingDuration -= SamplingRate;
if ( RemainingDuration <= 0 )
{
Geolocator.PositionChanged -= Geolocator_PositionChanged;
Geolocator = null;
RecordingButton.Content = "Start Recording";
}
UnsavedData.Add( new GpxCoordinate( args.Position.Coordinate, DateTime.Now ) );
TimeSpan timeSinceLastSave = DateTime.Now - UnsavedData[0].Time;
if ( timeSinceLastSave.Minutes >= 1 )
{
IList<IGpxSerializable> unsavedData = UnsavedData;
UnsavedData = new List<IGpxSerializable>();
if ( !Records.Contains( RecordName ) )
{
Records.Add( RecordName );
}
GpxFiles.WriteToGpxFile( RecordName, unsavedData );
}
}
开发者ID:BradleyMarie,项目名称:LocationRecorder,代码行数:29,代码来源:MainPage.xaml.cs
示例9: OnPositionChanged
async private void OnPositionChanged(Geolocator sender, PositionChangedEventArgs e)
{
await getDispatcher().RunAsync(CoreDispatcherPriority.Normal, () =>
{
setLocation(e.Position.Coordinate.Point);
});
}
开发者ID:JabX,项目名称:velobster,代码行数:7,代码来源:LocationProvider.cs
示例10: sortArray
public double[] sortArray(int order, Geolocator sender, PositionChangedEventArgs args)
{
double[][] inputArray;
inputArray = new double[5][];
output = new double[5][];
finalArray = new double[5];
inputArray = arrayOfDistances(sender, args);
for (int counter = 0; counter < 5; counter++)
{
finalArray[counter] = inputArray[counter][1];
}
quickSort(finalArray, 0, finalArray.Length);
for (int counter = 0; counter < 5; counter++)
{
for (int counter2 = 0; counter2 < 5; counter2++)
{
if (finalArray[counter] == inputArray[counter2][1]) output[counter] = inputArray[counter2];
}
}
//finalArray =
return output[order];
}
开发者ID:vladk1,项目名称:Kaizen,代码行数:30,代码来源:SelectBuildings.cs
示例11: watcher_PositionChanged
async void watcher_PositionChanged(Geolocator sender, PositionChangedEventArgs e)
{
lastPosition = await sender.GetGeopositionAsync();
if (lastPosition != null && lastPosition.Coordinate.AltitudeAccuracy.HasValue)
{
getLocationListener().locationUpdated(convert(lastPosition));
}
}
开发者ID:sannysanoff,项目名称:CodenameOne,代码行数:8,代码来源:LocationManager.cs
示例12: GPSPositionChanged
// :GPS events
void GPSPositionChanged(Geolocator sender, PositionChangedEventArgs args)
{
DateTime currentTime = DateTime.Now;
// Extern
if (GPSLocationChanged != null)
GPSLocationChanged(args.Position.Coordinate.Latitude, args.Position.Coordinate.Longitude, currentTime);
}
开发者ID:Zaixu,项目名称:Runup,代码行数:9,代码来源:GPSService.cs
示例13: glocator_PositionChanged
//Async Execution of the event
async void glocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
{
await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, new DispatchedHandler(
() =>
{
GetMyPosition(this, args);
}));
}
开发者ID:dotnetcurry,项目名称:bingmaps-win8-store,代码行数:9,代码来源:MainPage.xaml.cs
示例14: Locator_PositionChanged
private static async void Locator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
{
if (Dispatcher == null) return;
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () =>
{
OnLocationChanged();
});
}
开发者ID:AlexKven,项目名称:OneAppAway-RTM,代码行数:8,代码来源:LocationManager.cs
示例15: _geolocator_PositionChanged
private async void _geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
{
await DispatcherHelper.RunAsync(() =>
{
Coordinates =
$"{args.Position.Coordinate.Point.Position.Latitude}, {args.Position.Coordinate.Point.Position.Longitude}";
});
}
开发者ID:liqinghuang,项目名称:UWP-MVVMSamples,代码行数:8,代码来源:MainViewModel.cs
示例16: geolocator_PositionChanged
async void geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
{
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
Geoposition geoPosition = args.Position;
textGPS.Text = "GPS coordinates: " + geoPosition.Coordinate.Point.Position.Latitude.ToString("0.0000") + " : " + geoPosition.Coordinate.Point.Position.Longitude.ToString("0.0000");
});
}
开发者ID:FruFru01,项目名称:HetSys,代码行数:8,代码来源:MainPage.xaml.cs
示例17: geoLocator_PositionChanged
void geoLocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
{
Dispatcher.BeginInvoke(() =>
{
tbLatitud.Text = args.Position.Coordinate.Latitude.ToString();
tbLongitud.Text = args.Position.Coordinate.Longitude.ToString();
tbVelocidad.Text = args.Position.Coordinate.Speed.HasValue ? args.Position.Coordinate.Speed.ToString() : "UNKNOWN";
});
}
开发者ID:rwecho,项目名称:Windows-Phone-Samples,代码行数:9,代码来源:MainPage.xaml.cs
示例18: locator_PositionChanged
async void locator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
{
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
Location start = args.Position.ToLocation();
MapLayer.SetPosition(currentLocationPushpin, start);
myMap.SetView(start, 15);
});
}
开发者ID:yeenfei,项目名称:samples,代码行数:9,代码来源:MainPage.xaml.cs
示例19: WatcherOnPositionChanged
private async void WatcherOnPositionChanged(Geolocator sender, PositionChangedEventArgs e)
{
if (DateTime.Now.TimeOfDay.Subtract(_lastTimeSend) >= _minSendTime)
{
_geozoneRequest.Lat = e.Position.Coordinate.Latitude;
_geozoneRequest.Lon = e.Position.Coordinate.Longitude;
var webRequest = (HttpWebRequest)HttpWebRequest.Create(Constants.GeozoneUrl);
webRequest.Method = "POST";
webRequest.ContentType = "application/x-www-form-urlencoded";
string request = String.Format("{{ \"request\":{0}}}", JsonConvert.SerializeObject(_geozoneRequest));
byte[] requestBytes = System.Text.Encoding.UTF8.GetBytes(request);
// Write the channel URI to the request stream.
Stream requestStream = await webRequest.GetRequestStreamAsync();
requestStream.Write(requestBytes, 0, requestBytes.Length);
try
{
// Get the response from the server.
WebResponse response = await webRequest.GetResponseAsync();
StreamReader requestReader = new StreamReader(response.GetResponseStream());
String webResponse = requestReader.ReadToEnd();
string errorMessage = String.Empty;
Debug.WriteLine("Response: " + webResponse);
JObject jRoot = JObject.Parse(webResponse);
int code = JsonHelpers.GetStatusCode(jRoot);
if (JsonHelpers.GetStatusCode(jRoot) == 200)
{
double dist = jRoot["response"].Value<double>("distance");
if (dist > 0)
_watcher.MovementThreshold = dist / 2;
}
else
errorMessage = JsonHelpers.GetStatusMessage(jRoot);
if (!String.IsNullOrEmpty(errorMessage) && OnError != null)
{
Debug.WriteLine("Error: " + errorMessage);
OnError(this, new CustomEventArgs<string> { Result = errorMessage });
}
}
catch( Exception ex)
{
Debug.WriteLine("Error: " + ex.Message);
OnError(this, new CustomEventArgs<string> { Result = ex.Message });
}
_lastTimeSend = DateTime.Now.TimeOfDay;
}
}
开发者ID:niiwoz,项目名称:push-notifications-sdk,代码行数:57,代码来源:GeozoneService.cs
示例20: geo_PositionChanged
private async void geo_PositionChanged(Geolocator sender, PositionChangedEventArgs e)
{
await Control.GetInstance().ThreadsToNotify[0].Dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
{
currentLocation.Latitude = e.Position.Coordinate.Point.Position.Latitude;
currentLocation.Longitude = e.Position.Coordinate.Point.Position.Longitude;
CurrentLocationString = currentLocation.ToString();
});
Control.GetInstance().MainPage.ChangeUserIconPosition();
}
开发者ID:Kraegon,项目名称:GTec,代码行数:10,代码来源:LocationServiceProviderCaller.cs
注:本文中的Windows.Devices.Geolocation.PositionChangedEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论