本文整理汇总了C#中GeoPositionChangedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# GeoPositionChangedEventArgs类的具体用法?C# GeoPositionChangedEventArgs怎么用?C# GeoPositionChangedEventArgs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GeoPositionChangedEventArgs类属于命名空间,在下文中一共展示了GeoPositionChangedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: watcher_PositionChanged
private void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
Logger.Log(String.Format("Position changed: Unknown: {2}, Lat: {0}, Long: {1}", e.Position.Location.Latitude.ToString(), e.Position.Location.Longitude.ToString(), e.Position.Location.IsUnknown));
this.currentGeoLocation = e.Position.Location;
OnNewLocationAvailable();
}
示例2: GeoWatcherPositionChanged
private void GeoWatcherPositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
var accuracy = e.Position.Location.HorizontalAccuracy;
loadData(e.Position.Location.Latitude.ToString(), e.Position.Location.Longitude.ToString());
_geoWatcher.Stop();
}
示例3: watcher_PositionChanged
void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
tb_Latitude.Text = e.Position.Location.Latitude.ToString();
tb_Longitude.Text = e.Position.Location.Longitude.ToString();
}
示例4: WatcherOnPositionChanged
private void WatcherOnPositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
try
{
if (DateTime.Now.TimeOfDay.Subtract(_lastTimeSend) >= _minSendTime)
{
_geozoneRequest.Lat = e.Position.Location.Latitude;
_geozoneRequest.Lon = e.Position.Location.Longitude;
WebClient webClient = new WebClient();
webClient.UploadStringCompleted += (o, args) =>
{
if (args.Error == null)
{
JObject jRoot = JObject.Parse(args.Result);
if (JsonHelpers.GetStatusCode(jRoot) == 200)
{
double dist = jRoot["response"].Value<double>("distance");
if (dist > 0)
LazyWatcher.MovementThreshold = dist / 2;
}
}
};
string request = string.Format("{{\"request\":{0}}}", JsonConvert.SerializeObject(_geozoneRequest));
webClient.UploadStringAsync(Constants.GeozoneUrl, request);
_lastTimeSend = DateTime.Now.TimeOfDay;
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("Error when handling position change: " + ex.ToString());
}
}
示例5: MyPositionChanged
void MyPositionChanged(GeoPositionChangedEventArgs<GeoCoordinate> e)
{
// Update the TextBlocks to show the current location
//textBlock4.Text = e.Position.Location.Latitude.ToString("0.000000000");
//textBlock5.Text = e.Position.Location.Longitude.ToString("0.000000000");
map1.Center = new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude);
pin1.Location = e.Position.Location;
map1.SetView(pin1.Location, 18);
//textBox4.Text = e.Position.Location.VerticalAccuracy.ToString();
if (e.Position.Location.HorizontalAccuracy < 30 && e.Position.Location.VerticalAccuracy < 30)
{
textBlock3.Text = "GPS Locked, Press Start to Begin";
locked = true;
}
else
{
if (locked==false)
textBlock3.Text = "Please Wait, GPS Locking";
}
if (start == true)
{
_joggingPolyLine.Locations.Add(new Location() { Latitude = e.Position.Location.Latitude, Longitude = e.Position.Location.Longitude });
path = path + var;
if (speed < e.Position.Location.Speed)
speed = e.Position.Location.Speed;
textBlock1.Text = "Distance: " + path.ToString() + " m";
}
}
示例6: _watcher_PositionChanged
void _watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
var position = e.Position.Location;
lblLatidude.Text = position.Latitude.ToString("0.0000");
lblLongitude.Text = position.Longitude.ToString("0.0000");
}
示例7: _watcher_PositionChanged
//What to do if position change is tracked.
private void _watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
TrackPosition(e);
GetKilometres();
GetCalories();
GetMoney();
}
示例8: watcher_PositionChanged
void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
latitudeTextBlock.Text = e.Position.Location.Latitude.ToString("0.000");
longitudeTextBlock.Text = e.Position.Location.Longitude.ToString("0.000");
MyMap.Center = new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude);
MyMap.ZoomLevel = 5;
}
示例9: geoWatcher_PositionChanged
void geoWatcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
Dispatcher.BeginInvoke(() =>
{
map1.Center = e.Position.Location;
});
}
示例10: watcher_PositionChanged
private void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> args)
{
if (LocationChanged != null)
LocationChanged(sender, new LocationChangedEventArgs(
new Location(args.Position.Location.Latitude, args.Position.Location.Longitude, args.Position.Timestamp)
));
}
示例11: watcher_PositionChanged
void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
if (e.Position.Location.IsUnknown)
{
MessageBox.Show("Please wait while your prosition is determined....");
return;
}
this.map.Center = new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude);
if (this.map.Children.Count != 0)
{
var pushpin = map.Children.FirstOrDefault(p => (p.GetType() == typeof(Pushpin) && ((Pushpin)p).Tag == "locationPushpin"));
if (pushpin != null)
{
this.map.Children.Remove(pushpin);
}
}
Pushpin locationPushpin = new Pushpin();
locationPushpin.Background = new SolidColorBrush(Colors.Purple);
locationPushpin.Content = "You are here";
locationPushpin.Tag = "locationPushpin";
locationPushpin.Location = watcher.Position.Location;
this.map.Children.Add(locationPushpin);
this.map.SetView(watcher.Position.Location, 10.0);
locationPushpin.Location = new GeoCoordinate(8.570515, 8.308844);
}
示例12: Watcher_PositionChanged
private void Watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
var coord = new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude);
if (_line.Path.Count > 0)
{
var previousPoint = _line.Path.Last();
var distance = coord.GetDistanceTo(previousPoint);
var millisPerKilometer = (1000.0 / distance) * (System.Environment.TickCount - _previousPositionChangeTick);
_kilometres += distance / 1000.0;
paceLabel.Text = TimeSpan.FromMilliseconds(millisPerKilometer).ToString(@"mm\:ss");
distanceLabel.Text = string.Format("{0:f2} km", _kilometres);
caloriesLabel.Text = string.Format("{0:f0}", _kilometres * 65); // an average of 65 calories burned per kilometer
PositionHandler handler = new PositionHandler();
var heading = handler.CalculateBearing(new Position(previousPoint), new Position(coord));
Map.SetView(coord, Map.ZoomLevel, heading, MapAnimationKind.Parabolic);
ShellTile.ActiveTiles.First().Update(new IconicTileData()
{
Title = "WP8Runner",
WideContent1 = string.Format("{0:f2} km", _kilometres),
WideContent2 = string.Format("{0:f0} calories", _kilometres * 65), // an average of 65 calories burned per kilometer
});
}
else
{
Map.Center = coord;
}
_line.Path.Add(coord);
_previousPositionChangeTick = System.Environment.TickCount;
}
示例13: watcher_PositionChanged
private void watcher_PositionChanged(object sender,
GeoPositionChangedEventArgs<GeoCoordinate> e)
{
var location = e.Position.Location;
var lat = location.Latitude;
var lon = location.Longitude;
}
示例14: watcher_PositionChanged
void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
if (e.Position.Location.IsUnknown)
{
MessageBox.Show("Please wait while your prosition is determined....");
return;
}
this.map.Center = new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude);
if (this.map.Children.Count != 0)
{
var pushpin = map.Children.FirstOrDefault(p => (p.GetType() == typeof(Pushpin) && ((Pushpin)p).Tag == "locationPushpin"));
if (pushpin != null)
{
this.map.Children.Remove(pushpin);
}
}
Pushpin locationPushpin = new Pushpin();
locationPushpin.Background = new SolidColorBrush(Colors.Purple);
locationPushpin.Content = "You are here";
locationPushpin.Tag = "locationPushpin";
locationPushpin.Location = watcher.Position.Location;
this.map.Children.Add(locationPushpin);
this.map.SetView(watcher.Position.Location, 10.0);
Pushpin hospitalPushpin = new Pushpin();
Pushpin hospital_Pushpin = new Pushpin();
Pushpin hospital__Pushpin = new Pushpin();
//hospitalPushpin.Location = watcher.Position.Location;
String phoneNo = "07069779250";
hospitalPushpin.Content = "Bingham University Clinic"+"\n"+phoneNo;
hospitalPushpin.Location = new GeoCoordinate(8.957914, 7.699131);
//hospitalPushpin.Template = (ControlTemplate)(this.Resources["images/MapPin.png"]);
hospitalPushpin.MouseLeftButtonUp += new MouseButtonEventHandler(hospitalPushpin_MouseLeftButtonUp);
this.map.Children.Add(hospitalPushpin);
String phone_No = "08139698896";
hospital_Pushpin.Content = "General Hospital Wuse" + "\n" + phone_No;
hospital_Pushpin.Location = new GeoCoordinate(9.062964, 7.469072);
//hospitalPushpin.Template = (ControlTemplate)(this.Resources["images/MapPin.png"]);
hospital_Pushpin.MouseLeftButtonUp += new MouseButtonEventHandler(hospitalPushpin_MouseLeftButtonUp);
this.map.Children.Add(hospital_Pushpin);
String phone__No = "08139698896";
hospital__Pushpin.Content = "General Hospital Karu" + "\n" + phone__No;
hospital__Pushpin.Location = new GeoCoordinate(9.026158, 7.61304);
//hospitalPushpin.Template = (ControlTemplate)(this.Resources["images/MapPin.png"]);
hospital__Pushpin.MouseLeftButtonUp += new MouseButtonEventHandler(hospitalPushpin_MouseLeftButtonUp);
this.map.Children.Add(hospital__Pushpin);
}
示例15: watcher_PositionChanged
private void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
if (!e.Position.Location.IsUnknown)
{
CurrentPosition = e.Position.Location;
Watcher.Stop();
}
}