public void NextExtent() { if (_currentExtentIndex < _extentHistory.Count - 1) { _currentExtentIndex++; if (_currentExtentIndex == (_extentHistory.Count - 1)) { if (NavigateExtentDoneEvent != null) { NavigateExtentDoneEventArgs args = new NavigateExtentDoneEventArgs(); args.navigateExtentOn = NavigateExtentFocus.Next; args.nextEnabled = false; NavigateExtentDoneEvent(this, args); } } _newExtent = false; _map.ZoomTo(_extentHistory[_currentExtentIndex]); if (NavigateExtentDoneEvent != null) { NavigateExtentDoneEventArgs args = new NavigateExtentDoneEventArgs(); args.navigateExtentOn = NavigateExtentFocus.Previous; args.previousEnabled = true; NavigateExtentDoneEvent(this, args); } } }
void _map_ExtentChanged(object sender, ExtentEventArgs e) { ////////////////Next and previous extents handling/////////////////// if (e.OldExtent == null) { _extentHistory.Add(e.NewExtent.Clone()); return; } if (_newExtent) { _currentExtentIndex++; if (_extentHistory.Count - _currentExtentIndex > 0) { _extentHistory.RemoveRange(_currentExtentIndex, (_extentHistory.Count - _currentExtentIndex)); } _extentHistory.Add(e.NewExtent.Clone()); if (NavigateExtentDoneEvent != null) { NavigateExtentDoneEventArgs args = new NavigateExtentDoneEventArgs(); args.navigateExtentOn = NavigateExtentFocus.Both; args.nextEnabled = false; args.previousEnabled = true; NavigateExtentDoneEvent(this, args); } } else { _newExtent = true; } //////////////////////////////////////////////////////////////////////// }