public void SetExpirationMaxAge( TimeSpan expirationMaxAge )
Public Sub SetExpirationMaxAge( _ ByVal expirationMaxAge As TimeSpan _ )
Parameters
- expirationMaxAge
- The System.TimeSpan indicating features older than this value will be removed.
public void SetExpirationMaxAge( TimeSpan expirationMaxAge )
Public Sub SetExpirationMaxAge( _ ByVal expirationMaxAge As TimeSpan _ )
| Exception | Description |
|---|---|
| ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
| System.InvalidOperationException | Stream service data connection is null. |
Note: When a stream layer is track-aware, use FeatureLayer.SetPreviousObservationsCount to set how many previous observations will be displayed on the map. Whereas SetExpirationMaxAge defines how many previous observation will be stored in memory.
{
await QueuedTask.Run(() =>
{
//Set Expiration Method and Max Expiration Age
if (streamLayer.GetExpirationMethod() != FeatureExpirationMethod.MaximumFeatureAge)
{
streamLayer.SetExpirationMethod(FeatureExpirationMethod.MaximumFeatureAge);
}
//set to 12 hours (max is 24 hours)
streamLayer.SetExpirationMaxAge(new TimeSpan(12, 0, 0));
//FYI
if (streamLayer.IsTrackAware)
{
//MaxAge is per track! otherwise for the entire layer
}
});
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)