From 3371a4440ca5b0a5e6b6571a772b6acee80288f1 Mon Sep 17 00:00:00 2001
From: ConnorMolz <114417919+ConnorMolz@users.noreply.github.com>
Date: Tue, 27 May 2025 14:26:02 +0200
Subject: [PATCH 1/3] Add docu too the main ui's
---
RaceOverlay/App.xaml.cs | 20 ++++-
RaceOverlay/FirstStartPage.xaml.cs | 11 ++-
RaceOverlay/MainWindow.xaml.cs | 121 ++++++++++++++++++++++++++---
3 files changed, 141 insertions(+), 11 deletions(-)
diff --git a/RaceOverlay/App.xaml.cs b/RaceOverlay/App.xaml.cs
index b3c62b4..bbf4e19 100644
--- a/RaceOverlay/App.xaml.cs
+++ b/RaceOverlay/App.xaml.cs
@@ -12,7 +12,9 @@
namespace RaceOverlay;
///
-/// Interaction logic for App.xaml
+/// Entry point for the RaceOverlay application.
+/// Initializes application settings, checks for first run, and starts the API service.
+///
///
public partial class App : Application
{
@@ -32,6 +34,9 @@ public App()
}
+ ///
+ /// Check if the application config file and folder is existing and create it if not.
+ ///
private void CheckAppSettings()
{
// Get the local AppData path
@@ -67,6 +72,9 @@ private void CheckAppSettings()
}
}
+ ///
+ /// Checks if this is the first run of the application by reading settings.json.
+ ///
private void CheckForFirstRun()
{
string settingsFilePath = Path.Combine(App.AppDataPath, "settings.json");
@@ -81,6 +89,10 @@ private void CheckForFirstRun()
}
}
+ ///
+ /// Stops the API service when the application exits for an orderly shutdown.
+ ///
+ ///
protected override async void OnExit(ExitEventArgs e)
{
if (_apiHost != null)
@@ -92,6 +104,9 @@ protected override async void OnExit(ExitEventArgs e)
base.OnExit(e);
}
+ ///
+ /// Check if the SetupHider image exists in the AppData folder and copy the default Image if no image is avialble.
+ ///
private void InitSetupHiderImage()
{
// Define the path to settings.json
@@ -107,6 +122,9 @@ private void InitSetupHiderImage()
}
}
+ ///
+ /// Creating a new thread to start the API service decoupled from the UI threads.
+ ///
public static void StartApiService()
{
Thread apiThread = new(() => _apiHost = StartAPI.StartApiServer());
diff --git a/RaceOverlay/FirstStartPage.xaml.cs b/RaceOverlay/FirstStartPage.xaml.cs
index b5d4e89..ce6db89 100644
--- a/RaceOverlay/FirstStartPage.xaml.cs
+++ b/RaceOverlay/FirstStartPage.xaml.cs
@@ -12,7 +12,10 @@ public FirstStartPage()
InitializeComponent();
LoadLicense();
}
-
+
+ ///
+ /// Loads the LICENSE and Manual resources from the assembly and displays them in the respective text blocks.
+ ///
private void LoadLicense()
{
try
@@ -58,6 +61,12 @@ private void LoadLicense()
}
}
+ ///
+ /// Handle the click event of the Accept button.
+ /// Safes the settings to indicate that the first run has been completed
+ ///
+ ///
+ ///
private void On_Accept_Button(object sender, RoutedEventArgs e)
{
string settingsFilePath = Path.Combine(App.AppDataPath, "settings.json");
diff --git a/RaceOverlay/MainWindow.xaml.cs b/RaceOverlay/MainWindow.xaml.cs
index bc8f5df..1e4ec32 100644
--- a/RaceOverlay/MainWindow.xaml.cs
+++ b/RaceOverlay/MainWindow.xaml.cs
@@ -25,7 +25,8 @@
namespace RaceOverlay;
///
-/// Interaction Printing for MainWindow.xaml
+/// Main Window for the RaceOverlay application.
+/// This window initializes the iRacing SDK, sets up overlays, and handles user interactions.
///
#pragma warning disable CA2211 // Non-constant fields should not be visible
@@ -39,6 +40,9 @@ public partial class MainWindow : Window
public static bool ShutdownIsTriggerd = false;
+ ///
+ /// Initializes a new instance of the class.
+ ///
public MainWindow()
{
InitializeComponent();
@@ -49,6 +53,9 @@ public MainWindow()
}
+ ///
+ /// Add all overlays to the OverlayList and StreamOverlays to the StreamOverlayList.
+ ///
private void _initOverlays()
{
// Overlay
@@ -92,6 +99,9 @@ private void _initOverlays()
}
+ ///
+ /// Init the iRacing SDK and set up event handlers for telemetry data and session info.
+ ///
private void _initIRacingData()
{
Debug.Print( "Initializing iRacing data..." );
@@ -111,40 +121,52 @@ private void _initIRacingData()
// let's go!
IrsdkSharper.Start();
}
-
- private void Window_Closing( object sender, CancelEventArgs e )
- {
- IrsdkSharper.Stop();
- }
+ ///
+ /// Throws an exception if the iRacing SDK encounters an error.
+ ///
+ ///
private static void OnException( Exception exception )
{
Debug.Print( "OnException() fired!" );
}
+ ///
+ /// Send Debug info when the iRacing SDK is connected.
+ ///
private static void OnConnected()
{
Debug.Print( "OnConnected() fired!" );
}
+ ///
+ /// Sends Debug info when the iRacing SDK is disconnected.
+ ///
private static void OnDisconnected()
{
Debug.Print( "OnDisconnected() fired!" );
-
-
}
+ ///
+ /// When the session info is received, this method is called and present Debug info about the track name.
+ ///
private static void OnSessionInfo()
{
var trackName = IrsdkSharper.Data.SessionInfo.WeekendInfo.TrackName;
Debug.Print( $"OnSessionInfo fired! Track name is {trackName}." );
}
+ ///
+ /// Method to map the telemetry data from the iRacing SDK to the iRacingData model.
+ ///
private static void OnTelemetryData()
{
IRacingData = Mapper.MapData(IrsdkSharper);
}
+ ///
+ /// Stops data mapping and resets the iRacingData model when the iRacing SDK stops. (User closed iRacing)
+ ///
private static void OnStopped()
{
Debug.Print( "OnStopped() fired!" );
@@ -154,7 +176,11 @@ private static void OnStopped()
}
-
+ ///
+ /// Method to toggle the overlay of the selected item in the OverlayList.
+ ///
+ ///
+ ///
private void Toggle_Overlay(object sender, RoutedEventArgs e)
{
Overlay? selectedOverlay = OverlayList.SelectedItem as Overlay;
@@ -166,6 +192,10 @@ private void Toggle_Overlay(object sender, RoutedEventArgs e)
}
+ ///
+ /// Method to close the application when the window is closed.
+ ///
+ ///
protected override void OnClosed(EventArgs e)
{
base.OnClosed(e);
@@ -175,6 +205,12 @@ protected override void OnClosed(EventArgs e)
Application.Current.Shutdown();
}
+ ///
+ /// Change the shown content to the selected overlay in the OverlayList. (Conflict with StreamOverlayList if both
+ /// are selected, this remove the selection from the other list)
+ ///
+ ///
+ ///
private void OverlaySelectionChanged(object sender, SelectionChangedEventArgs e)
{
Overlay? selectedOverlay = OverlayList.SelectedItem as Overlay;
@@ -201,16 +237,31 @@ private void OverlaySelectionChanged(object sender, SelectionChangedEventArgs e)
}
}
+ ///
+ /// Custom Minimize Button to minimize the window.
+ ///
+ ///
+ ///
private void minimizeButton_Click(object sender, RoutedEventArgs e)
{
WindowState = WindowState.Minimized;
}
+ ///
+ /// Custom Close button.
+ ///
+ ///
+ ///
private void closeButton_Click(object sender, RoutedEventArgs e)
{
Close();
}
+ ///
+ /// This Method open the information and License page.
+ ///
+ ///
+ ///
private void goToInfoButton_Click(object sender, RoutedEventArgs e)
{
MainPage.Visibility = Visibility.Hidden;
@@ -224,6 +275,11 @@ private void goToInfoButton_Click(object sender, RoutedEventArgs e)
}
+ ///
+ /// This method is called when the user clicks the "Go to Main" button on the InfoPage.
+ ///
+ ///
+ ///
private void goToMainButton_Click(object sender, RoutedEventArgs e)
{
MainPage.Visibility = Visibility.Visible;
@@ -235,11 +291,19 @@ private void goToMainButton_Click(object sender, RoutedEventArgs e)
InfoPage.Visibility = Visibility.Hidden;
}
+ ///
+ /// This method allows the user to drag the window by clicking and holding the left mouse button anywhere on the window.
+ ///
+ ///
+ ///
private void MainWindow_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
DragMove();
}
+ ///
+ /// Loading the LICENSE and Quick Guide from the embedded resources.
+ ///
private void _loadLicenseAndQuickGuide()
{
try
@@ -285,6 +349,12 @@ private void _loadLicenseAndQuickGuide()
}
}
+ ///
+ /// Method to handle the value change of the ScaleSlider and scale the selected overlay accordingly.
+ /// (This method is triggered by the ScaleInput_TextChanged event as well, so it will update the text box value if the slider is changed manually.)
+ ///
+ ///
+ ///
private void ScaleSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
{
double scale = ScaleSlider.Value;
@@ -303,6 +373,12 @@ private void ScaleSlider_ValueChanged(object sender, RoutedPropertyChangedEventA
ScaleInput.TextChanged += ScaleInput_TextChanged;
}
+ ///
+ /// This method is called when the text in the ScaleInput TextBox changes and change the scale of the selected overlay accordingly.
+ /// (This method is triggered by the ScaleSlider_ValueChanged event as well, so it will update the slider value if the text is changed manually.)
+ ///
+ ///
+ ///
private void ScaleInput_TextChanged(object sender, TextChangedEventArgs e)
{
if (ConfigGrid.Visibility != Visibility.Visible)
@@ -330,11 +406,21 @@ private void ScaleInput_TextChanged(object sender, TextChangedEventArgs e)
}
}
+ ///
+ /// Static getter to get iRacingSdk instance to safe resources.
+ ///
+ ///
public static IRacingSdk getRSDK()
{
return IrsdkSharper;
}
+ ///
+ /// This method is called when the value of the OpacitySlider changes and updates the opacity of the selected overlay accordingly.
+ /// (This method is triggered by the OpacityInput_TextChanged event as well, so it will update the text box value if the slider is changed manually.)
+ ///
+ ///
+ ///
private void OpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
{
double opacity = OpacitySlider.Value;
@@ -353,6 +439,12 @@ private void OpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEven
OpacityInput.TextChanged += OpacityInput_TextChanged;
}
+ ///
+ /// This method is called when the text in the OpacityInput TextBox changes and updates the opacity of the selected overlay accordingly.
+ /// (This method is triggered by the OpacitySlider_ValueChanged event as well, so it will update the slider value if the text is changed manually.)
+ ///
+ ///
+ ///
private void OpacityInput_TextChanged(object sender, TextChangedEventArgs e)
{
if (ConfigGrid.Visibility != Visibility.Visible)
@@ -380,6 +472,12 @@ private void OpacityInput_TextChanged(object sender, TextChangedEventArgs e)
}
}
+ ///
+ /// Change the shown content to the selected stream overlay in the StreamOverlayList. (Conflict with OverlayList if both
+ /// are selected, this remove the selection from the other list)
+ ///
+ ///
+ ///
private void StreamOverlayList_OnSelectionChangedOverlaySelectionChanged(object sender, SelectionChangedEventArgs e)
{
Internals.StreamOverlay? selectedOverlay = StreamOverlayList.SelectedItem as Internals.StreamOverlay;
@@ -403,6 +501,11 @@ private void StreamOverlayList_OnSelectionChangedOverlaySelectionChanged(object
}
}
+ ///
+ /// Handle the click event of the CopyLinkButton to copy the link from the LinkTextBox to the clipboard.
+ ///
+ ///
+ ///
private void CopyLinkButtonMethod(object sender, RoutedEventArgs e)
{
Console.WriteLine("Hello");
From 2cc8afbc258ee05e799be11b67c7ea69c4e0cdf7 Mon Sep 17 00:00:00 2001
From: ConnorMolz <114417919+ConnorMolz@users.noreply.github.com>
Date: Tue, 27 May 2025 15:02:41 +0200
Subject: [PATCH 2/3] Add docu and remove used redundant method
---
RaceOverlay/Internals/Overlay.cs | 247 +++++++++++++++---
.../Overlays/PitstopInfo/PitstopInfo.xaml.cs | 4 +-
.../Overlays/WeatherInfo/WeatherInfo.xaml.cs | 6 +-
3 files changed, 218 insertions(+), 39 deletions(-)
diff --git a/RaceOverlay/Internals/Overlay.cs b/RaceOverlay/Internals/Overlay.cs
index d0234c0..dc54553 100644
--- a/RaceOverlay/Internals/Overlay.cs
+++ b/RaceOverlay/Internals/Overlay.cs
@@ -13,52 +13,65 @@ namespace RaceOverlay.Internals;
public abstract class Overlay: Window, INotifyPropertyChanged
{
+ // Window size, scaling, opacity
private int _windowWidth = 300;
private int _windowHeight = 200;
- protected bool _devMode = false;
+
protected double _scale = 1;
protected double _opacity = 1;
+
+ // Controlling visibility and state
protected bool _windowIsActive;
protected bool _inCar = false;
+
+ // Specific properties for the overlay in development cases
protected bool _isTest = false;
+ protected bool _devMode = false;
+
+ // Variables for drag and drop functionality
+ public Grid DragGrid { get; set; }
+ private MouseButtonEventHandler _dragMoveHandler;
+
+ ///
+ /// Overlay name which is used to identify the overlay in settings and UI.
+ ///
public String OverlayName { get; set; }
+ ///
+ /// Description of the overlay, used for display purposes.
+ ///
public String OverlayDescription { get; set; }
+
+ ///
+ /// Status which is used to lock the position of the overlay and prevent it from being moved by the user.
+ ///
public bool PositionIsLocked { get; set; } = true;
+ ///
+ /// Method to update the overlay window.
+ ///
public abstract void _updateWindow();
+
+ ///
+ /// Method which will get the data for the overlay from the mapped iRacing Data
+ ///
public abstract void _getData();
+
+ ///
+ /// Method which should be implemented to load the configuration for the overlay if needed.
+ /// Scaling and opacity are handled by the base class and should not be loaded here.
+ ///
protected virtual void _getConfig(){}
-
- public virtual void UpdateThreadMethod()
- {
-
- while (true)
- {
- try
- {
- _getData();
- if (IsVisible)
- {
-
- // Use Dispatcher to update UI from background thread
- Dispatcher.Invoke(() => { _updateWindow(); });
- }
-
- // Add a small delay to prevent high CPU usage
- Thread.Sleep(16); // ~60 updates per second
- }
- catch (Exception e)
- {
- Debug.WriteLine(e);
- }
- }
-
- }
- public Grid DragGrid { get; set; }
- private MouseButtonEventHandler _dragMoveHandler;
- // Declare the event using EventHandler
-
+ ///
+ /// Method for Overlays.
+ /// Following Method need to be implemented:
+ /// - _updateWindow()
+ /// - _getData()
+ /// - _scaleWindow(double scale)
+ ///
+ /// Overlay name which will identify the overlay
+ /// Description to tell the user what the overlay will do
+ /// For Unit testing purpose to not loading Config from non existing file
public Overlay(String overlayName, String overlayDescription, bool? isTest = null)
{
AllowsTransparency = true;
@@ -144,13 +157,54 @@ public Overlay(String overlayName, String overlayDescription, bool? isTest = nul
ScaleValueChanges(_scale);
}
-}
+ }
+
+ ///
+ /// Method which will be run in a separate thread to update the overlay window.
+ /// Edit this method if needed to change the update frequency or logic.
+ /// Has no exit purposely, as it should run until the application is closed.
+ ///
+ public virtual void UpdateThreadMethod()
+ {
+
+ while (true)
+ {
+ try
+ {
+ _getData();
+ if (IsVisible)
+ {
+ // Use Dispatcher to update UI from background thread
+ Dispatcher.Invoke(() => { _updateWindow(); });
+ }
+
+ // Add a small delay to prevent high CPU usage
+ Thread.Sleep(16); // ~60 updates per second
+ }
+ catch (Exception e)
+ {
+ Debug.WriteLine(e);
+ }
+ }
+
+ }
+
+
+ ///
+ /// Getting the Scale of the overlay window (defined in the config).
+ ///
+ /// Scale value
public double getScale()
{
return _scale;
}
+ ///
+ /// Set window size to binding values in the xaml file and not hardcoding values there.
+ ///
+ /// Window Width
+ /// Window Height
protected void _setWindowSize(int width, int height)
{
_windowWidth = width;
@@ -160,15 +214,39 @@ protected void _setWindowSize(int width, int height)
Height = _windowHeight;
}
+ ///
+ /// Needs to be implemented in the derived class to scale the window.
+ /// Example code:
+ ///
+ /// try
+ /// {
+ /// ContentScaleTransform.ScaleX = scale;
+ /// ContentScaleTransform.ScaleY = scale;
+ /// }
+ /// catch (Exception e)
+ /// {
+ /// Debug.WriteLine(e);
+ /// }
+ ///
+ ///
+ /// Scale value is provided by or
protected abstract void _scaleWindow(double scale);
+ ///
+ /// Method which should return a Grid with the configuration options for the overlay.
+ /// Is shown after Overlay is selected in the MainWindow.
+ ///
public virtual Grid GetConfigs()
{
return new Grid();
}
- protected virtual void _loadConfig(){}
-
+
+ ///
+ /// Method to change the opacity of the window.
+ /// Example code:
+ ///
+ /// Scale value is provided by or
public void OpacityValueChanges(double newOpacity)
{
_setDoubleConfig("_opacity", newOpacity);
@@ -179,12 +257,20 @@ public void OpacityValueChanges(double newOpacity)
}
}
+ ///
+ /// Method to set the opacity of the window.
+ /// Example code:
+ ///
+ /// Scale value is provided by or
private void _setOpacity(double newOpacity)
{
_opacity = newOpacity;
Opacity = _opacity;
}
+ ///
+ /// Method to change the scale of the window.
+ ///
public void ScaleValueChanges(double newScale)
{
_setDoubleConfig("_scale", newScale);
@@ -195,12 +281,22 @@ public void ScaleValueChanges(double newScale)
}
}
+
+ ///
+ /// Mehtod to set the scale of the window.
+ ///
+ ///
private void _scaleWindowSize(double scale)
{
Width = _windowWidth * scale;
Height = _windowHeight * scale;
}
+ ///
+ /// Mehtod to get a string configuration value from the settings.json file.
+ ///
+ /// Json key which will be used to save and load the config value
+ /// String which is saved by the user or an empty string
protected string _getStringConfig(string key)
{
string settingsFilePath = Path.Combine(App.AppDataPath, "settings.json");
@@ -233,6 +329,11 @@ protected string _getStringConfig(string key)
return "";
}
+ ///
+ /// Method to set a string configuration value in the settings.json file.
+ ///
+ /// Json key which will be used to safe and load the config value
+ /// Value which will set into the config
protected void _setStringConfig(string key, string value)
{
string settingsFilePath = Path.Combine(App.AppDataPath, "settings.json");
@@ -243,6 +344,11 @@ protected void _setStringConfig(string key, string value)
File.WriteAllText(settingsFilePath, settingsObject.ToString());
}
+ ///
+ /// Method to get an integer configuration value from the settings.json file.
+ ///
+ /// Json key which will be used to save and load the config value
+ /// Int which is saved by the user or 0
protected int _getIntConfig(string key)
{
string settingsFilePath = Path.Combine(App.AppDataPath, "settings.json");
@@ -275,6 +381,11 @@ protected int _getIntConfig(string key)
return 0;
}
+ ///
+ /// Method to set an integer configuration value in the settings.json file.
+ ///
+ /// Json key which will be used to safe and load the config value
+ /// Value which will set into the config
protected void _setIntConfig(string key, int value)
{
string settingsFilePath = Path.Combine(App.AppDataPath, "settings.json");
@@ -285,6 +396,11 @@ protected void _setIntConfig(string key, int value)
File.WriteAllText(settingsFilePath, settingsObject.ToString());
}
+ ///
+ /// Method to get a float configuration value from the settings.json file.
+ ///
+ /// Json key which will be used to save and load the config value
+ /// float which is saved by the user or 0
protected float _getFloatConfig(string key)
{
string settingsFilePath = Path.Combine(App.AppDataPath, "settings.json");
@@ -317,6 +433,11 @@ protected float _getFloatConfig(string key)
return 0;
}
+ ///
+ /// Method to set a float configuration value in the settings.json file.
+ ///
+ /// Json key which will be used to safe and load the config value
+ /// Value which will set into the config
protected void _setFloatConfig(string key, float value)
{
string settingsFilePath = Path.Combine(App.AppDataPath, "settings.json");
@@ -327,6 +448,11 @@ protected void _setFloatConfig(string key, float value)
File.WriteAllText(settingsFilePath, settingsObject.ToString());
}
+ ///
+ /// Method to get a double configuration value from the settings.json file.
+ ///
+ /// Json key which will be used to save and load the config value
+ /// Double which is saved by the user or 0
protected double _getDoubleConfig(string key)
{
string settingsFilePath = Path.Combine(App.AppDataPath, "settings.json");
@@ -359,6 +485,11 @@ protected double _getDoubleConfig(string key)
return 0;
}
+ ///
+ /// Method to set a double configuration value in the settings.json file.
+ ///
+ /// Json key which will be used to safe and load the config value
+ /// Value which will set into the config
protected void _setDoubleConfig(string key, double value)
{
string settingsFilePath = Path.Combine(App.AppDataPath, "settings.json");
@@ -369,6 +500,11 @@ protected void _setDoubleConfig(string key, double value)
File.WriteAllText(settingsFilePath, settingsObject.ToString());
}
+ ///
+ /// Method to get a boolean configuration value from the settings.json file.
+ ///
+ /// Json key which will be used to save and load the config value
+ /// Bool which is saved by the user or false
protected bool _getBoolConfig(string key)
{
string settingsFilePath = Path.Combine(App.AppDataPath, "settings.json");
@@ -401,6 +537,11 @@ protected bool _getBoolConfig(string key)
return false;
}
+ ///
+ /// Method to set a boolean configuration value in the settings.json file.
+ ///
+ /// Json key which will be used to safe and load the config value
+ /// Value which will set into the config
protected void _setBoolConfig(string key, bool value)
{
string settingsFilePath = Path.Combine(App.AppDataPath, "settings.json");
@@ -413,6 +554,9 @@ protected void _setBoolConfig(string key, bool value)
+ ///
+ /// Method to toggle the visibility of the overlay and save the state of it.
+ ///
public void ToggleOverlay()
{
string settingsFilePath = Path.Combine(App.AppDataPath, "settings.json");
@@ -445,6 +589,11 @@ public void ToggleOverlay()
File.WriteAllText(settingsFilePath, settingsObject.ToString());
}
+ ///
+ /// Method to handle the key down event for the overlay window.
+ ///
+ ///
+ ///
private void Overlay_KeyDown(object sender, KeyEventArgs e)
{
// Check if F12 key was pressed
@@ -455,6 +604,9 @@ private void Overlay_KeyDown(object sender, KeyEventArgs e)
}
}
+ ///
+ /// Mehtod to toggle the position lock of the overlay window and save it to the config.
+ ///
private void TogglePositionLock()
{
if(PositionIsLocked)
@@ -478,6 +630,10 @@ private void TogglePositionLock()
}
+ ///
+ /// Method to handle the closing event of the overlay window.
+ ///
+ ///
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
@@ -498,11 +654,18 @@ protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
}
}
+ ///
+ /// Method to turn the application off by hiding the overlay window.
+ ///
public void TurnAppOff()
{
Hide();
}
+ ///
+ /// Method to handle the content rendered event of the overlay window.
+ ///
+ ///
protected override void OnContentRendered(EventArgs e)
{
base.OnContentRendered(e);
@@ -515,6 +678,9 @@ protected override void OnContentRendered(EventArgs e)
}
}
+ ///
+ /// Method to show the overlay window on telemetry data.
+ ///
public void ShowOnTelemetry()
{
if (_windowIsActive)
@@ -523,6 +689,9 @@ public void ShowOnTelemetry()
}
}
+ ///
+ /// Method to hide the overlay window when telemetry data is not available or the window is closed.
+ ///
public void HideOnClosed()
{
if (_windowIsActive)
@@ -531,6 +700,9 @@ public void HideOnClosed()
}
}
+ ///
+ /// Variable to track the inCar status of the overlay.
+ ///
// Property to track the _inCar status
public bool InCar
{
@@ -546,6 +718,9 @@ public bool InCar
}
}
+ ///
+ /// Event handler for when the inCar status changes.
+ ///
protected virtual void OnInCarChanged()
{
if (_inCar && _windowIsActive)
@@ -562,6 +737,10 @@ protected virtual void OnInCarChanged()
// Add INotifyPropertyChanged implementation
public event PropertyChangedEventHandler? PropertyChanged;
+ ///
+ /// Rerender Window when a property changes. Need to be called for this
+ ///
+ ///
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
diff --git a/RaceOverlay/Overlays/PitstopInfo/PitstopInfo.xaml.cs b/RaceOverlay/Overlays/PitstopInfo/PitstopInfo.xaml.cs
index fe38a7a..58126d1 100644
--- a/RaceOverlay/Overlays/PitstopInfo/PitstopInfo.xaml.cs
+++ b/RaceOverlay/Overlays/PitstopInfo/PitstopInfo.xaml.cs
@@ -40,7 +40,7 @@ public partial class PitstopInfo : Overlay
_setWindowSize(240, 370);
- _loadConfig();
+ _getConfig();
Thread updateThread = new Thread(UpdateThreadMethod);
updateThread.IsBackground = true;
@@ -191,7 +191,7 @@ void ParseUntilYellowInput(object sender, TextChangedEventArgs e)
return grid;
}
- protected override void _loadConfig()
+ protected override void _getConfig()
{
_enableTyreInfo = _getBoolConfig("_enableTyreInfo");
_marginLaps = _getFloatConfig("_marginLaps");
diff --git a/RaceOverlay/Overlays/WeatherInfo/WeatherInfo.xaml.cs b/RaceOverlay/Overlays/WeatherInfo/WeatherInfo.xaml.cs
index eec2fc3..649a25f 100644
--- a/RaceOverlay/Overlays/WeatherInfo/WeatherInfo.xaml.cs
+++ b/RaceOverlay/Overlays/WeatherInfo/WeatherInfo.xaml.cs
@@ -37,8 +37,8 @@ public partial class WeatherInfo : Overlay
Thread blinkAnimationThread = new Thread(BlinkAnimationMethod);
blinkAnimationThread.IsBackground = true;
blinkAnimationThread.Start();
-
- _loadConfig();
+
+ _getConfig();
}
public override void _getData()
@@ -179,7 +179,7 @@ public override Grid GetConfigs()
return grid;
}
- protected override void _loadConfig()
+ protected override void _getConfig()
{
_blinkingIsActiv = _getBoolConfig("_blinkingIsActiv");
}
From 29c48a9aeb242e9888211f2a195640a072ac1832 Mon Sep 17 00:00:00 2001
From: ConnorMolz <114417919+ConnorMolz@users.noreply.github.com>
Date: Tue, 27 May 2025 16:00:25 +0200
Subject: [PATCH 3/3] Add Docu to all Internals
---
RaceOverlay/Internals/Configs/CheckBoxElement.cs | 9 +++++++++
RaceOverlay/Internals/Configs/InputElement.cs | 10 ++++++++++
RaceOverlay/Internals/Overlay.cs | 7 +++++++
RaceOverlay/Internals/StreamOverlay.cs | 9 +++++++++
4 files changed, 35 insertions(+)
diff --git a/RaceOverlay/Internals/Configs/CheckBoxElement.cs b/RaceOverlay/Internals/Configs/CheckBoxElement.cs
index 725564f..4ac9493 100644
--- a/RaceOverlay/Internals/Configs/CheckBoxElement.cs
+++ b/RaceOverlay/Internals/Configs/CheckBoxElement.cs
@@ -3,11 +3,20 @@
namespace RaceOverlay.Internals.Configs;
+///
+/// Element which contains a Label and a CheckBox for simple Checkbox configs.
+///
+/// This is an extended Grid class and can be used as Grid by default
public class CheckBoxElement: Grid
{
public CustomLabel Label { get; set; }
public CustomCheckBox CheckBox { get; set; }
+ ///
+ /// Constructor for CheckBoxElement.
+ ///
+ /// The text which will be shown as label for the checkbox
+ /// Value which is used for the checkbox if it's checked on show
public CheckBoxElement(String text, bool isChecked)
{
diff --git a/RaceOverlay/Internals/Configs/InputElement.cs b/RaceOverlay/Internals/Configs/InputElement.cs
index c3c473d..9dbeda2 100644
--- a/RaceOverlay/Internals/Configs/InputElement.cs
+++ b/RaceOverlay/Internals/Configs/InputElement.cs
@@ -3,11 +3,21 @@
namespace RaceOverlay.Internals.Configs;
+///
+/// Element which contains a Label and a Text field for text configs.
+/// To use it you need to add some eventhandlers on the InputField to get the text changes and validate those.
+///
+/// This is an extended Grid class and can be used as Grid by default
public class InputElement: Grid
{
public CustomLabel Label { get; set; }
public CustomInputField InputField { get; set; }
+ ///
+ /// Constructor for InputElement.
+ ///
+ /// Label Text which is shown in front of the TextInput.
+ /// Text which is set at the Field at create time.
public InputElement(String labelText, String inputFieldText)
{
ColumnDefinitions.Add(new ColumnDefinition());
diff --git a/RaceOverlay/Internals/Overlay.cs b/RaceOverlay/Internals/Overlay.cs
index dc54553..25840bf 100644
--- a/RaceOverlay/Internals/Overlay.cs
+++ b/RaceOverlay/Internals/Overlay.cs
@@ -11,6 +11,13 @@
namespace RaceOverlay.Internals;
+///
+/// Method for Overlays.
+/// Following Method need to be implemented:
+/// - _updateWindow()
+/// - _getData()
+/// - _scaleWindow(double scale)
+///
public abstract class Overlay: Window, INotifyPropertyChanged
{
// Window size, scaling, opacity
diff --git a/RaceOverlay/Internals/StreamOverlay.cs b/RaceOverlay/Internals/StreamOverlay.cs
index 8361030..0301654 100644
--- a/RaceOverlay/Internals/StreamOverlay.cs
+++ b/RaceOverlay/Internals/StreamOverlay.cs
@@ -1,11 +1,20 @@
namespace RaceOverlay.Internals;
+///
+/// StreamOverlay is only for UI Reasons currently used.
+///
public abstract class StreamOverlay
{
public string Title { get; set; }
public string Description { get; set; }
public string Link { get; set; }
+ ///
+ /// StreamOverlay is only for UI Reasons currently used.
+ ///
+ /// Title for UI.
+ /// Description for UI.
+ /// Link which the User will copy for use the stream overlay in streaming software like OBS
public StreamOverlay(string title, string description, string link)
{
Title = title;