Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion RaceOverlay/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
namespace RaceOverlay;

/// <summary>
/// Interaction logic for App.xaml
/// Entry point for the RaceOverlay application.
/// Initializes application settings, checks for first run, and starts the API service.
///
/// </summary>
public partial class App : Application
{
Expand All @@ -32,6 +34,9 @@ public App()

}

/// <summary>
/// Check if the application config file and folder is existing and create it if not.
/// </summary>
private void CheckAppSettings()
{
// Get the local AppData path
Expand Down Expand Up @@ -67,6 +72,9 @@ private void CheckAppSettings()
}
}

/// <summary>
/// Checks if this is the first run of the application by reading settings.json.
/// </summary>
private void CheckForFirstRun()
{
string settingsFilePath = Path.Combine(App.AppDataPath, "settings.json");
Expand All @@ -81,6 +89,10 @@ private void CheckForFirstRun()
}
}

/// <summary>
/// Stops the API service when the application exits for an orderly shutdown.
/// </summary>
/// <param name="e"></param>
protected override async void OnExit(ExitEventArgs e)
{
if (_apiHost != null)
Expand All @@ -92,6 +104,9 @@ protected override async void OnExit(ExitEventArgs e)
base.OnExit(e);
}

/// <summary>
/// Check if the SetupHider image exists in the AppData folder and copy the default Image if no image is avialble.
/// </summary>
private void InitSetupHiderImage()
{
// Define the path to settings.json
Expand All @@ -107,6 +122,9 @@ private void InitSetupHiderImage()
}
}

/// <summary>
/// Creating a new thread to start the API service decoupled from the UI threads.
/// </summary>
public static void StartApiService()
{
Thread apiThread = new(() => _apiHost = StartAPI.StartApiServer());
Expand Down
11 changes: 10 additions & 1 deletion RaceOverlay/FirstStartPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ public FirstStartPage()
InitializeComponent();
LoadLicense();
}


/// <summary>
/// Loads the LICENSE and Manual resources from the assembly and displays them in the respective text blocks.
/// </summary>
private void LoadLicense()
{
try
Expand Down Expand Up @@ -58,6 +61,12 @@ private void LoadLicense()
}
}

/// <summary>
/// Handle the click event of the Accept button.
/// Safes the settings to indicate that the first run has been completed
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void On_Accept_Button(object sender, RoutedEventArgs e)
{
string settingsFilePath = Path.Combine(App.AppDataPath, "settings.json");
Expand Down
9 changes: 9 additions & 0 deletions RaceOverlay/Internals/Configs/CheckBoxElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@

namespace RaceOverlay.Internals.Configs;

/// <summary>
/// Element which contains a Label and a CheckBox for simple Checkbox configs.
/// </summary>
/// <returns>This is an extended Grid class and can be used as Grid by default</returns>
public class CheckBoxElement: Grid
{
public CustomLabel Label { get; set; }
public CustomCheckBox CheckBox { get; set; }

/// <summary>
/// Constructor for CheckBoxElement.
/// </summary>
/// <param name="text">The text which will be shown as label for the checkbox</param>
/// <param name="isChecked">Value which is used for the checkbox if it's checked on show</param>
public CheckBoxElement(String text, bool isChecked)
{

Expand Down
10 changes: 10 additions & 0 deletions RaceOverlay/Internals/Configs/InputElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,21 @@

namespace RaceOverlay.Internals.Configs;

/// <summary>
/// Element which contains a Label and a Text field for text configs. <br/>
/// To use it you need to add some eventhandlers on the InputField to get the text changes and validate those. <br/>
/// </summary>
/// <returns>This is an extended Grid class and can be used as Grid by default</returns>
public class InputElement: Grid
{
public CustomLabel Label { get; set; }
public CustomInputField InputField { get; set; }

/// <summary>
/// Constructor for InputElement.
/// </summary>
/// <param name="labelText">Label Text which is shown in front of the TextInput.</param>
/// <param name="inputFieldText">Text which is set at the Field at create time.</param>
public InputElement(String labelText, String inputFieldText)
{
ColumnDefinitions.Add(new ColumnDefinition());
Expand Down
Loading
Loading