Question: accessing Session.Grid data

42 views
Skip to first unread message

Patrick O'Sullivan

unread,
Mar 22, 2013, 10:42:51 AM3/22/13
to ak-f1-...@googlegroups.com
Hi,

I've been trying to use this brilliant library to create my own live analytics for F1 in an Excel add-on. But I cannot for the life of me get data from the SessionModel.Grid object - my issue seems to be related to the fact that I can only access methods in GridModelBase, rather than the more useful GridModelBase`1 class (which would allow me to access 'Rows'). I'm not sure how to get Intellisense to realise that this is what I'm after. I presume I have to pass in the generic which would represent one of the xGridRowModels that is derived from the GridRowModelBase, but frankly, I'm just not good enough at C# to know what is going on here and to make this thing work. 

So the question is, how do I access Session.Grid.Rows?

I also see that in Timing.UI that the TimingGrid.xaml somehow manages to access data from Session.Grid.Rows with relative ease...

Is anyone able to point me in the right direction here?

F1 Looney

unread,
Mar 22, 2013, 11:00:20 AM3/22/13
to ak-f1-...@googlegroups.com
The grid model isn't really designed to be consumed, just bound to. Anyways...

There is a grid type per session type:

https://ak-f1-timing.googlecode.com/svn/trunk/src/AK.F1.Timing.Model/src/Grid/

So if it were a practice session:

var practiceGrid = (PracticeGridModel)session.Grid;

Note you can use session.SessionType property to determine the current session type.

Cheers.

Patrick O'Sullivan

unread,
Mar 22, 2013, 9:34:46 PM3/22/13
to ak-f1-...@googlegroups.com
Casting it inside an if statement works beautifully. I'll see about binding the data to an Excel range too.

Thanks - might even be able to get a test version working by the race tomorrow!
Reply all
Reply to author
Forward
0 new messages