Release candidate
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
/// Author : Maxime Rohmer
|
||||
/// Date : 30/05/2023
|
||||
/// Date : 09/06/2023
|
||||
/// File : DataWrapper.cs
|
||||
/// Brief : Class that is used to interface between the main Form (vue) and the Storage (wich is a class that wraps the sqlite database, so the model) its almost MVC :D
|
||||
/// Version : Alpha 1.0
|
||||
/// Version : Beta 1.0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/// Author : Maxime Rohmer
|
||||
/// Date : 30/05/2023
|
||||
/// Date : 09/06/2023
|
||||
/// File : DriverData.cs
|
||||
/// Brief : File containing classes that behave just like structures to store data about drivers
|
||||
/// Version : Alpha 1.0
|
||||
/// Version : Beta 1.0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/// Author : Maxime Rohmer
|
||||
/// Date : 30/05/2023
|
||||
/// Date : 09/06/2023
|
||||
/// File : DriverDrsWindow.cs
|
||||
/// Brief : Window containing DRS related method and infos
|
||||
/// Version : Alpha 1.0
|
||||
/// Version : Beta 1.0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/// Author : Maxime Rohmer
|
||||
/// Date : 30/05/2023
|
||||
/// Date : 09/06/2023
|
||||
/// File : DriverLapTimeWindow
|
||||
/// Brief : Window containing infos about the lap time of a driver
|
||||
/// Version : Alpha 1.0
|
||||
/// Version : Beta 1.0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/// Author : Maxime Rohmer
|
||||
/// Date : 30/05/2023
|
||||
/// Date : 09/06/2023
|
||||
/// File : DriverNameWindow
|
||||
/// Brief : Window containing infos about the name of the driver
|
||||
/// Version : Alpha 1.0
|
||||
/// Version : Beta 1.0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/// Author : Maxime Rohmer
|
||||
/// Date : 30/05/2023
|
||||
/// Date : 09/06/2023
|
||||
/// File : DriverPositionWindow.cs
|
||||
/// Brief : Window containing infos about the position of a driver.
|
||||
/// Version : Alpha 1.0
|
||||
/// Version : Beta 1.0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/// Author : Maxime Rohmer
|
||||
/// Date : 30/05/2023
|
||||
/// Date : 09/06/2023
|
||||
/// File : DriverSectorWindow.cs
|
||||
/// Brief : Window containing infos about a driver sector time. Can be the first second or third, does not matter.
|
||||
/// Version : Alpha 1.0
|
||||
/// Version : Beta 1.0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/// Author : Maxime Rohmer
|
||||
/// Date : 30/05/2023
|
||||
/// Date : 09/06/2023
|
||||
/// File : DriverTyresWindow.cs
|
||||
/// Brief : Window containing infos about a driver's tyre
|
||||
/// Version : Alpha 1.0
|
||||
/// Version : Beta 1.0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/// Author : Maxime Rohmer
|
||||
/// Date : 30/05/2023
|
||||
/// Date : 09/06/2023
|
||||
/// File : F1TVEmulator.cs
|
||||
/// Brief : Class that contains methods to emulate a browser and navigate the F1TV website
|
||||
/// Version : Alpha 1.0
|
||||
/// Version : Beta 1.0
|
||||
|
||||
using OpenQA.Selenium;
|
||||
using OpenQA.Selenium.Firefox;
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
using System;
|
||||
/// Author : Maxime Rohmer
|
||||
/// Date : 09/06/2023
|
||||
/// File : Form1.cs
|
||||
/// Brief : Class that controls the main view of the app
|
||||
/// Version : Beta 1.0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
@@ -15,7 +21,6 @@ namespace TrackTrends
|
||||
{
|
||||
public partial class Main : Form
|
||||
{
|
||||
//private Reader Reader = null;
|
||||
private F1TVEmulator Emulator = null;
|
||||
private DataWrapper Wrapper = null;
|
||||
private bool cancelRequested = false;
|
||||
@@ -47,7 +52,10 @@ namespace TrackTrends
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public async void RefreshUI()
|
||||
/// <summary>
|
||||
/// Will update everything that is not data related
|
||||
/// </summary>
|
||||
public void RefreshUI()
|
||||
{
|
||||
if (Directory.Exists(ConfigurationTool.CONFIGS_FOLDER_NAME))
|
||||
{
|
||||
@@ -55,7 +63,12 @@ namespace TrackTrends
|
||||
lsbPresets.DataSource = Directory.GetFiles(ConfigurationTool.CONFIGS_FOLDER_NAME);
|
||||
}
|
||||
}
|
||||
private async void btnSettings_Click(object sender, EventArgs e)
|
||||
/// <summary>
|
||||
/// Opens the settings page. Also disposes of the browser if there is one opened and all thos things
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btnSettings_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Emulator != null)
|
||||
Emulator.ResetDriver();
|
||||
@@ -88,6 +101,7 @@ namespace TrackTrends
|
||||
}
|
||||
else
|
||||
{
|
||||
//Should technically never show up but we never know
|
||||
MessageBox.Show("The config file has not been found please return to the config and change it");
|
||||
}
|
||||
}
|
||||
@@ -97,7 +111,11 @@ namespace TrackTrends
|
||||
//MessageBox.Show("There is no URL for the Grand Prix you want to decode. Please return to the config and add a valid one");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will do everything that needs to be done at the first start of the app
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private async void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
//Those are the default values but they will need to be changed later when the configuration has been done
|
||||
@@ -136,7 +154,11 @@ namespace TrackTrends
|
||||
|
||||
RefreshUI();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will start or stop the process of decoding
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private async void btnUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
cancelRequested = false;
|
||||
@@ -194,18 +216,32 @@ namespace TrackTrends
|
||||
btnSettings.Enabled = true;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Will display the overtakes in the overtakes list box
|
||||
/// </summary>
|
||||
private void DisplayOvertakes()
|
||||
{
|
||||
Wrapper.DisplayOvertakes(lsbOvertakes);
|
||||
}
|
||||
/// <summary>
|
||||
/// Will display the battles in the battles pannel
|
||||
/// </summary>
|
||||
private void DisplayBattles()
|
||||
{
|
||||
Wrapper.DisplayBattles(pnlBattles, this);
|
||||
}
|
||||
/// <summary>
|
||||
/// Will display the time differences in the faster and slowest pannels
|
||||
/// </summary>
|
||||
private void DisplayDeltas()
|
||||
{
|
||||
Wrapper.DisplayTimesDeltas(pnlFastest, pnlSlowest, this);
|
||||
}
|
||||
/// <summary>
|
||||
/// Will try to stop the emulator (usually does not work please do not count on it)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (Emulator != null)
|
||||
@@ -213,6 +249,12 @@ namespace TrackTrends
|
||||
Emulator.Stop();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Will display the live ranking on the live ranking pannel. Its called like this because historically it was the method that just recovered the bare results from the OCR
|
||||
/// </summary>
|
||||
/// <param name="errorCode"></param>
|
||||
/// <param name="sw"></param>
|
||||
/// <param name="screen"></param>
|
||||
private void DisplayResults(int errorCode, Stopwatch sw, Bitmap screen)
|
||||
{
|
||||
if (errorCode != 0)
|
||||
@@ -226,6 +268,11 @@ namespace TrackTrends
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will stop the data recovering operation and resets some buttons and text
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btnStopUpdating_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Set the cancellation flag
|
||||
@@ -234,6 +281,11 @@ namespace TrackTrends
|
||||
btnResetEmulator.Enabled = false;
|
||||
btnStopUpdating.Text = "Stopping";
|
||||
}
|
||||
/// <summary>
|
||||
/// Will start the F1TVEmulator, again this name is historical because back at the start of this project this button did not have a name
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private async void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
lsbOvertakes.Items.Clear();
|
||||
@@ -303,6 +355,11 @@ namespace TrackTrends
|
||||
btnStartDecoding.Enabled = true;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Silly way to remove borders from groupbox and make them look like pannels with titles
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void removeBorders(object sender, PaintEventArgs e)
|
||||
{
|
||||
GroupBox gpbx = (GroupBox)sender;
|
||||
@@ -319,17 +376,31 @@ namespace TrackTrends
|
||||
e.Graphics.DrawString(gpbx.Text, gpbx.Font, brush, textPosition);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Will change the preset to use when starting the emulator
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void lsbPresets_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (lsbPresets.SelectedIndex >= 0)
|
||||
ConfigFile = lsbPresets.Items[lsbPresets.SelectedIndex].ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will change the URL the emulator will use, historical name again
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void textBox1_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (tbxGpUrl.Text != "")
|
||||
GpUrl = tbxGpUrl.Text;
|
||||
}
|
||||
/// <summary>
|
||||
/// This is called by the automatically generated buttons. Its here to fill in the driver info tab whenever the user clicks on a button that contains the name of a driver
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
public void btnDriver_Click(object sender, EventArgs e)
|
||||
{
|
||||
//Removes the cover
|
||||
@@ -383,6 +454,11 @@ namespace TrackTrends
|
||||
break;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// This is supposed to be called by an automatically generated button. It should be any button with a laptime info on it
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
public void btnLapTime_Click(object sender, EventArgs e)
|
||||
{
|
||||
//Happens when a lapTime has been clicked
|
||||
@@ -390,7 +466,11 @@ namespace TrackTrends
|
||||
string[] parts = btn.Name.Split('_');
|
||||
Wrapper.DisplayLapTimeInfos(parts[0], Convert.ToInt32(parts[1]), btn.Text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will trigger responsive calculation everytime the form changes size
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Main_Resize(object sender, EventArgs e)
|
||||
{
|
||||
int xDiff = this.Width - oldSize.Width;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/// Author : Maxime Rohmer
|
||||
/// Date : 30/05/2023
|
||||
/// Date : 09/06/2023
|
||||
/// File : OcrImage.cs
|
||||
/// Brief : Class containing all the methods used to enhance images for OCR
|
||||
/// Version : Alpha 1.0
|
||||
/// Version : Beta 1.0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/// Author : Maxime Rohmer
|
||||
/// Date : 30/05/2023
|
||||
/// Date : 09/06/2023
|
||||
/// File : Reader.cs
|
||||
/// Brief : Class used to Read the config file for the OCR
|
||||
/// Version : Alpha 1.0
|
||||
/// Version : Beta 1.0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
2
TrackTrends/Settings.Designer.cs
generated
2
TrackTrends/Settings.Designer.cs
generated
@@ -294,7 +294,6 @@
|
||||
this.pbxPreview.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.pbxPreview.TabIndex = 0;
|
||||
this.pbxPreview.TabStop = false;
|
||||
this.pbxPreview.Click += new System.EventHandler(this.pbxMain_Click);
|
||||
this.pbxPreview.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbxMain_MouseClick);
|
||||
//
|
||||
// btnCreatZone
|
||||
@@ -337,7 +336,6 @@
|
||||
this.pbxWindowPreview.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.pbxWindowPreview.TabIndex = 0;
|
||||
this.pbxWindowPreview.TabStop = false;
|
||||
this.pbxWindowPreview.Click += new System.EventHandler(this.pbxDriverZone_Click);
|
||||
this.pbxWindowPreview.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pbxDriverZone_MouseClick);
|
||||
//
|
||||
// btnLoadPreset
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
using System;
|
||||
/// Author : Maxime Rohmer
|
||||
/// Date : 09/06/2023
|
||||
/// File : Settings.cs
|
||||
/// Brief : Class that controls the settings view
|
||||
/// Version : Beta 1.0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
@@ -48,6 +54,9 @@ namespace TrackTrends
|
||||
InitializeComponent();
|
||||
Load();
|
||||
}
|
||||
/// <summary>
|
||||
/// This methods regroups all the actions that the forms need to be doing at the first launch
|
||||
/// </summary>
|
||||
private void Load()
|
||||
{
|
||||
RefreshUI();
|
||||
@@ -61,6 +70,7 @@ namespace TrackTrends
|
||||
btnDeletePreset.Enabled = false;
|
||||
btnSavePreset.Enabled = false;
|
||||
|
||||
// I prefered regrouping all the tooltips here to make it easier to edit (there is 100% of thoses sentences containing typos so if you see one dont hesitate to edit those messages)
|
||||
tip1.SetToolTip(btnCreatZone, "After clicking you can select two points in the image to set the bounds of the important data");
|
||||
tip1.SetToolTip(btnCreateWindow, "After clicking this you will have to select all the windows that are important on the lower image. Refer to the documentation for more infos");
|
||||
tip1.SetToolTip(btnRefresh, "Starts the emulator or refreshes the images if its already running");
|
||||
@@ -70,6 +80,10 @@ namespace TrackTrends
|
||||
tip1.SetToolTip(pbxPreview, "What the emulator returns");
|
||||
tip1.SetToolTip(pbxWindowPreview, "One of the driver zones that the program managed to slice from the main zone");
|
||||
}
|
||||
/// <summary>
|
||||
/// This is the main method that will be called anytime something changes on the view
|
||||
/// It can be called at any time and will adapt the UI taking into account the state of the app
|
||||
/// </summary>
|
||||
private void RefreshUI()
|
||||
{
|
||||
lsbDrivers.DataSource = null;
|
||||
@@ -120,12 +134,21 @@ namespace TrackTrends
|
||||
pbxWindowPreview.Image = Config.MainZone.Zones[0].Draw();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// This will create a new zone but will require two points (one at each opposing sides and corners)
|
||||
/// </summary>
|
||||
/// <param name="p1">The first corner (usually top left)</param>
|
||||
/// <param name="p2">The second corner (usually bottom right)</param>
|
||||
private void CreateNewZone(Point p1, Point p2)
|
||||
{
|
||||
Rectangle dimensions = CreateAbsoluteRectangle(p1, p2);
|
||||
Config = new ConfigurationTool((Bitmap)pbxPreview.Image, dimensions);
|
||||
RefreshUI();
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates all the windows with an array of rectangles
|
||||
/// </summary>
|
||||
/// <param name="dimensions">An array that contains all the windows bounds and position (expects 9)</param>
|
||||
private void CreateWindows(List<Rectangle> dimensions)
|
||||
{
|
||||
if (Config != null)
|
||||
@@ -133,11 +156,20 @@ namespace TrackTrends
|
||||
Config.AddWindows(dimensions);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Will just change the main URL
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void tbxGpUrl_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
GrandPrixUrl = tbxGpUrl.Text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a driver into the driver list
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btnAddDriver_Click(object sender, EventArgs e)
|
||||
{
|
||||
string newDriver = tbxDriverName.Text;
|
||||
@@ -145,7 +177,11 @@ namespace TrackTrends
|
||||
tbxDriverName.Text = "";
|
||||
RefreshUI();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a driver from the drivers list
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btnRemoveDriver_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (lsbDrivers.SelectedIndex >= 0)
|
||||
@@ -154,6 +190,9 @@ namespace TrackTrends
|
||||
}
|
||||
RefreshUI();
|
||||
}
|
||||
/// <summary>
|
||||
/// Will change everything that needs to be changed for when the users starts or stops creating a zone
|
||||
/// </summary>
|
||||
private void SwitchZoneCreation()
|
||||
{
|
||||
if (CreatingZone)
|
||||
@@ -184,6 +223,9 @@ namespace TrackTrends
|
||||
}
|
||||
RefreshUI();
|
||||
}
|
||||
/// <summary>
|
||||
/// Will change everything that needs to be changed for when the users starts or stops creating a window
|
||||
/// </summary>
|
||||
private void SwitchWindowCreation()
|
||||
{
|
||||
if (CreatingWindow)
|
||||
@@ -215,6 +257,11 @@ namespace TrackTrends
|
||||
{
|
||||
SwitchWindowCreation();
|
||||
}
|
||||
/// <summary>
|
||||
/// If the user is supposed to create a zone, will record the position of the clicks
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void pbxMain_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (CreatingZone && pbxPreview.Image != null)
|
||||
@@ -240,10 +287,11 @@ namespace TrackTrends
|
||||
RefreshUI();
|
||||
}
|
||||
}
|
||||
private void pbxMain_Click(object sender, EventArgs e)
|
||||
{
|
||||
//Not the right one to use visibly
|
||||
}
|
||||
/// <summary>
|
||||
/// If the user is supposed to create a window, will record the position of the clicks
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void pbxDriverZone_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (CreatingWindow && pbxWindowPreview.Image != null)
|
||||
@@ -280,15 +328,18 @@ namespace TrackTrends
|
||||
RefreshUI();
|
||||
}
|
||||
}
|
||||
private void pbxDriverZone_Click(object sender, EventArgs e)
|
||||
{
|
||||
//Not the right one to use visibly
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a rectangle without caring about the order of the points.
|
||||
/// </summary>
|
||||
/// <param name="p1">First point. Can be top left or bottom right</param>
|
||||
/// <param name="p2">Second point. Can be top left or bottom right</param>
|
||||
/// <returns></returns>
|
||||
private Rectangle CreateAbsoluteRectangle(Point p1, Point p2)
|
||||
{
|
||||
Point newP1 = new Point();
|
||||
Point newP2 = new Point();
|
||||
|
||||
|
||||
//Kind of a pain to have to do this but this lets the user do stupid things without the app crashing
|
||||
if (p1.X < p2.X)
|
||||
{
|
||||
newP1.X = p1.X;
|
||||
@@ -312,7 +363,11 @@ namespace TrackTrends
|
||||
}
|
||||
return new Rectangle(newP1.X, newP1.Y, newP2.X - newP1.X, newP2.Y - newP1.Y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will refresh the emulator and will controll some of the controls
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private async void btnRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
btnRefresh.Enabled = false;
|
||||
@@ -393,7 +448,11 @@ namespace TrackTrends
|
||||
}
|
||||
btnRefresh.Enabled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will try to close the headless browser so the main form can launch a new one safely
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Settings_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (Emulator != null)
|
||||
@@ -403,7 +462,11 @@ namespace TrackTrends
|
||||
Emulator = null;
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will reset the drivers
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btnResetDriver_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Emulator != null)
|
||||
@@ -411,7 +474,11 @@ namespace TrackTrends
|
||||
Emulator.ResetDriver();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the current presets as a new JSON file
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btnSavePreset_Click(object sender, EventArgs e)
|
||||
{
|
||||
string presetName = tbxPresetName.Text;
|
||||
@@ -421,13 +488,21 @@ namespace TrackTrends
|
||||
}
|
||||
RefreshUI();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will change the selected preset. Usefull if you close this page because then the main form will keep in memory your last choice
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void lsbPresets_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (lsbPresets.SelectedIndex >= 0)
|
||||
SelectedConfigFile = (string)lsbPresets.Items[lsbPresets.SelectedIndex];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will load an existing presets
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btnLoadPreset_Click(object sender, EventArgs e)
|
||||
{
|
||||
//MessageBox.Show(lsbPresets.SelectedIndex.ToString());
|
||||
@@ -450,7 +525,11 @@ namespace TrackTrends
|
||||
RefreshUI();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This will be called everytime the form resizes. Here we are making the form responsive
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void Settings_Resize(object sender, EventArgs e)
|
||||
{
|
||||
int xDiff = this.Width - oldSize.Width;
|
||||
@@ -461,7 +540,11 @@ namespace TrackTrends
|
||||
pbxPreview.Size = new Size(oldPbxPreviewSize.Width + xDiff, oldPbxPreviewSize.Height + yDiff);
|
||||
pbxWindowPreview.Size = new Size(oldPbxWindowPreviewSize.Width + xDiff, oldPbxWindowPreviewSize.Height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will delete an existing preset
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btnDeletePreset_Click(object sender, EventArgs e)
|
||||
{
|
||||
int selectedIndex = lsbPresets.SelectedIndex;
|
||||
@@ -479,7 +562,11 @@ namespace TrackTrends
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sketchy method that is used to remove the borders from groupboxes... Yes its dumb but I dont think there is any other way
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void removeBorders(object sender, PaintEventArgs e)
|
||||
{
|
||||
GroupBox gpbx = (GroupBox)sender;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/// Author : Maxime Rohmer
|
||||
/// Date : 30/05/2023
|
||||
/// Date : 09/08/2023
|
||||
/// File : SqliteStorage.cs
|
||||
/// Brief : Class that controls the sqlite database
|
||||
/// Version : Alpha 1.0
|
||||
/// Version : Beta 1.0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/// Author : Maxime Rohmer
|
||||
/// Date : 30/05/2023
|
||||
/// Date : 09/06/2023
|
||||
/// File : Window.cs
|
||||
/// Brief : Default Window object that is mainly expected to be inherited.
|
||||
/// Version : Alpha 1.0
|
||||
/// Version : Beta 1.0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/// Author : Maxime Rohmer
|
||||
/// Date : 30/05/2023
|
||||
/// Date : 09/06/2023
|
||||
/// File : Zone.cs
|
||||
/// Brief : Class that contains all the methods and infos for a zone. This is designed to be potentially be inherited.
|
||||
/// Version : Alpha 1.0
|
||||
/// Version : Beta 1.0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
Reference in New Issue
Block a user