Range contains two properties Min and Max which defines the range of values. Either property can be set to null. When Min is null it means the range has no lower bound or the range is less than or equal to the Max. When Max is null it means the range has no upper bound or the range is greater than or equal to the Min.
public Task<List<ArcGIS.Desktop.Mapping.Range>> GetInterpolatedMapRanges()
{
//Return the collection representing the map time for each frame in animation.
return QueuedTask.Run(() =>
{
var mapView = MapView.Active;
if (mapView != null || mapView.Animation == null)
returnnull;
var animation = mapView.Map.Animation;
var ranges = new List<ArcGIS.Desktop.Mapping.Range>();
//We will use ticks here rather than milliseconds to get the highest precision possible.
var ticksPerFrame = Convert.ToInt64(animation.Duration.Ticks / (animation.NumberOfFrames - 1));
for (int i = 0; i < animation.NumberOfFrames; i++)
{
var time = TimeSpan.FromTicks(i * ticksPerFrame);
//Because of rounding for ticks the last calculated time may be greeting than the duration.
if (time > animation.Duration)
time = animation.Duration;
ranges.Add(mapView.Animation.GetCurrentRangeAtTime(time));
}
return ranges;
});
}