Commit c8349dd4 authored by Martin Tvarožek's avatar Martin Tvarožek
Browse files

docs: app.axaml.cs and apppaths documentation

parent 10119bbc
Loading
Loading
Loading
Loading
+28 −1
Original line number Diff line number Diff line
@@ -25,6 +25,10 @@ public partial class App : Application
        AvaloniaXamlLoader.Load(this);
    }
    
    /// <summary>
    /// Called when the framework initialization is completed. Sets up services, launches the main window,
    /// and initializes the launcher asynchronously.
    /// </summary>
    public override void OnFrameworkInitializationCompleted()
    {
        IServiceProvider services = ConfigureServices();
@@ -44,6 +48,11 @@ public partial class App : Application
        ViewLocator.MainVm = mainViewModel;
    }
    
    /// <summary>
    /// Asynchronously initializes core launcher services.
    /// </summary>
    /// <param name="services">The <see cref="IServiceProvider"/> used to resolve required services.</param>
    /// <returns>A task representing the asynchronous operation.</returns>
    private async Task InitializeLauncherAsync(IServiceProvider services)
    {
        var dbService = services.GetRequiredService<IDatabaseService>();
@@ -62,6 +71,14 @@ public partial class App : Application
        await FetchAndUpdateTagsAsync(kafeService, mainPage);
    }   
    
    /// <summary>
    /// Verifies all games in the library and displays a popup if invalid games are found.
    /// Updates the <see cref="IGameManagerService.InvalidGameIds"/> property.
    /// </summary>
    /// <param name="gameManager">The game manager service.</param>
    /// <param name="popupService">The popup service for user notifications.</param>
    /// <param name="page">The library page view model to filter out invalid game data in.</param>
    /// <returns>A task representing the asynchronous operation.</returns>
    private static async Task VerifyGames(IGameManagerService gameManager, IPopupService popupService, LibraryPageViewModel page)
    {
        var invalidGames = await gameManager.GetInvalidGamesAsync();
@@ -76,6 +93,12 @@ public partial class App : Application
        await page.FetchData();
    }
    
    /// <summary>
    /// Fetches genre tags from the Kafe service and updates the local cache and view model.
    /// </summary>
    /// <param name="kafe">The Kafe service for fetching game metadata.</param>
    /// <param name="page">The library page view model to update tags.</param>
    /// <returns>A task representing the asynchronous operation.</returns>
    private static async Task FetchAndUpdateTagsAsync(IKafeService kafe, LibraryPageViewModel page)
    {
        var tags = await kafe.GetGenreTagsAsync();
@@ -95,6 +118,10 @@ public partial class App : Application
        page.UpdateGenreTags();
    }
    
    /// <summary>
    /// Configures dependency injection for all services, view models, and routers.
    /// </summary>
    /// <returns>A <see cref="ServiceProvider"/> containing all registered services.</returns>
    private static ServiceProvider ConfigureServices()
    {
        var services = new ServiceCollection();
+5 −0
Original line number Diff line number Diff line
using System;
using System.IO;
using GarrigueGamesLauncher.Interfaces;

namespace GarrigueGamesLauncher.Utils;

/// <summary>
/// Provides constant paths in the launcher, including the settings, database, and cached tags files.
/// The currently selected game data directory is provided by <see cref="ISettingsService"/> instead.
/// </summary>
public static class AppPaths
{
    public static readonly string AppDataPath = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "GarrigueGames");