Report post

Are you sure you want to report the post shown below? This will send an email to the ATVO administrators. Please include a short reason for reporting.

Users reporting for no reason may be locked out.


Post

Posted by Nick Thissen
on
We use the concept of "entity" which translates kind of to "entry in a race". This can be a driver, or a team with multiple drivers. To get an ID or name you don't need to know which it is, it depends on the kind of session. For example, the Name property of an entity will return the driver name in a single driver race, or the team name in a team race.

If the session is a team session, then any IEntity will actually be of type ITeam and you can get the team name from the Name and the team id from the Id properties.

If the session is a single driver race, then an entity is actuall IDriver from which you can get more detailed information like Initials, LastName, etc.

In code:
// If you bind to 'entity_object':
var entity = (IEntity)value;

// If you bind to 'entitysessionresult_object':
var result = (IEntitySessionResult)value;
var entity = result.Entity;


var id = entity.Id;
var name = entity.Name;

// If it's a team session:
// - id will be Team ID, name will be Team name

// If it's a single driver session:
// - id will be driver customer ID, name will be driver name

// Check if it's a team
if (entity is ITeam)
{
// Team object
var driver = entity.CurrentDriver;
var otherDrivers = entity.Drivers;
}
else
{
// Single driver
var driver = entity.CurrentDriver;

// or this is probably the same:
var driver = (IDriver)entity;
}