You can now click on a driver to see its stats

This commit is contained in:
2023-05-24 09:31:03 +02:00
parent 5c6e3c5b2b
commit e4edd71adc
3 changed files with 104 additions and 6 deletions
+31 -2
View File
@@ -29,7 +29,36 @@ namespace Test_Merge
{
Reader.ChangeImage(image);
}
public void DisplayLiveRanking(Panel pnl)
public DriverData GetFullDriverData(string driverName,Panel lastFiveLapsPanel)
{
DriverData result = new DriverData();
foreach (DriverData data in LiveDriverDataLogs[LiveDriverDataLogs.Count - 1])
{
if (data.Name == driverName)
result = data;
}
if(result.Name != "")
{
lastFiveLapsPanel.Controls.Clear();
Size labelDimensions = new Size(lastFiveLapsPanel.Width,lastFiveLapsPanel.Height / 5);
List<(int LapTime, int Lap)> lapsInfos = Storage.GetDriverLaptimes(driverName,5);
foreach ((int LapTime, int Lap) lapData in lapsInfos)
{
Button newButton = new Button();
newButton.Name = driverName + "_" + lapData.Lap;
newButton.Text = Reader.ConvertMsToTime(lapData.LapTime);
lastFiveLapsPanel.Controls.Add(newButton);
}
}
return result;
}
public void DisplayLiveRanking(Panel pnl, Form1 form1)
{
if(LiveDriverDataLogs.Count > 0)
{
@@ -67,7 +96,7 @@ namespace Test_Merge
newButton.Name = liveData[driverCount].Name;
newButton.TextAlign = ContentAlignment.MiddleLeft;
newButton.Click += Form1.btnDriver_Click;
newButton.Click += form1.btnDriver_Click;
buttons[driverCount] = newButton;
}