Laptimes and sectors are now fixed
This commit is contained in:
@@ -47,6 +47,7 @@ namespace Test_Merge
|
|||||||
|
|
||||||
List<(int LapTime, int Lap)> lapsInfos = Storage.GetDriverLaptimes(driverName, 5);
|
List<(int LapTime, int Lap)> lapsInfos = Storage.GetDriverLaptimes(driverName, 5);
|
||||||
|
|
||||||
|
int id = 0;
|
||||||
foreach ((int LapTime, int Lap) lapData in lapsInfos)
|
foreach ((int LapTime, int Lap) lapData in lapsInfos)
|
||||||
{
|
{
|
||||||
Button newButton = new Button();
|
Button newButton = new Button();
|
||||||
@@ -55,6 +56,8 @@ namespace Test_Merge
|
|||||||
newButton.Text = Reader.ConvertMsToTime(lapData.LapTime);
|
newButton.Text = Reader.ConvertMsToTime(lapData.LapTime);
|
||||||
newButton.Size = labelDimensions;
|
newButton.Size = labelDimensions;
|
||||||
newButton.Click += form1.btnLapTime_Click;
|
newButton.Click += form1.btnLapTime_Click;
|
||||||
|
newButton.Location = new Point(0, id * newButton.Height);
|
||||||
|
id++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,8 +155,6 @@ namespace Test_Merge
|
|||||||
{
|
{
|
||||||
List<int> sectors = Storage.GetSectorsFromLapTime(driverName, Lap);
|
List<int> sectors = Storage.GetSectorsFromLapTime(driverName, Lap);
|
||||||
string message = "Lap time infos" + Environment.NewLine;
|
string message = "Lap time infos" + Environment.NewLine;
|
||||||
if (sectors.Count() == 3)
|
|
||||||
{
|
|
||||||
message += LapTime + Environment.NewLine;
|
message += LapTime + Environment.NewLine;
|
||||||
if (sectors.Count > 0)
|
if (sectors.Count > 0)
|
||||||
message += "Sector 1 : " + Reader.ConvertMsToTime(sectors[0]) + Environment.NewLine;
|
message += "Sector 1 : " + Reader.ConvertMsToTime(sectors[0]) + Environment.NewLine;
|
||||||
@@ -161,7 +162,6 @@ namespace Test_Merge
|
|||||||
message += "Sector 2 : " + Reader.ConvertMsToTime(sectors[1]) + Environment.NewLine;
|
message += "Sector 2 : " + Reader.ConvertMsToTime(sectors[1]) + Environment.NewLine;
|
||||||
if (sectors.Count > 2)
|
if (sectors.Count > 2)
|
||||||
message += "Sector 3 : " + Reader.ConvertMsToTime(sectors[2]) + Environment.NewLine;
|
message += "Sector 3 : " + Reader.ConvertMsToTime(sectors[2]) + Environment.NewLine;
|
||||||
}
|
|
||||||
MessageBox.Show(message);
|
MessageBox.Show(message);
|
||||||
}
|
}
|
||||||
public void DisplayLiveRanking(Panel pnl, Form1 form1)
|
public void DisplayLiveRanking(Panel pnl, Form1 form1)
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ namespace Test_Merge
|
|||||||
public List<int> GetSectorsFromLapTime(string driverName,int lap)
|
public List<int> GetSectorsFromLapTime(string driverName,int lap)
|
||||||
{
|
{
|
||||||
int driverId = GetDriverID(driverName);
|
int driverId = GetDriverID(driverName);
|
||||||
string selectQuery = "SELECT Sector1,Sector2,Sector3 FROM Stats WHERE DriverID = @driverID AND Lap = @Lap";
|
string selectQuery = "SELECT Sector1,Sector2,Sector3 FROM Stats WHERE DriverID = @driverID AND Lap = @lap";
|
||||||
List<int> result = new List<int>();
|
List<int> result = new List<int>();
|
||||||
using (var command = new SQLiteCommand(selectQuery, Connection))
|
using (var command = new SQLiteCommand(selectQuery, Connection))
|
||||||
{
|
{
|
||||||
@@ -131,8 +131,9 @@ namespace Test_Merge
|
|||||||
SQLiteDataReader reader = command.ExecuteReader();
|
SQLiteDataReader reader = command.ExecuteReader();
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
int sectorTime = reader.GetInt32(0);
|
result.Add(reader.GetInt32(0));
|
||||||
result.Add(sectorTime);
|
result.Add(reader.GetInt32(1));
|
||||||
|
result.Add(reader.GetInt32(2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
|||||||
Reference in New Issue
Block a user