private void MapView_ViewportChanged(object sender, EventArgs e) { var zl = (int)Math.Floor(this.ZoomLevel); if (zl != this.discreteZoomLevel) { this.discreteZoomLevel = zl; this.RaiseZoomLevelChanged(this.discreteZoomLevel); } var rect = new LocationRect { NorthWest = Common.Utils.Mid(this.Center, this.Bounds.NorthWest), SouthEast = Common.Utils.Mid(this.Center, this.Bounds.SouthEast) }; if (this.previousCenter == null) { this.previousCenter = this.Center; } if (!rect.Contains(this.previousCenter)) { this.previousCenter = this.Center; this.RaiseViewportMoved(this.previousCenter); } }
private void RaiseViewportMoved(Location location) { if (this.ViewportMoved != null) { this.ViewportMoved(this, location); } }
public bool Contains(Location location) { return(this.Bounds.Contains(location)); }
private void MapView_Loaded(object sender, RoutedEventArgs e) { this.previousCenter = this.Center; this.UpdateBounds(); }