# corp-i1/win-labs architecture

> Architecture diagram of the GitHub repository corp-i1/win-labs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/corp-i1/win-labs
- Repository: https://github.com/corp-i1/win-labs

## Overview

##### Main Components
- UI Layer – This includes all the XAML-based windows and pages:
- MainWindow, StartupWindow, LoadingWindow, Inspector, SettingsWindow, and any pages deriving from BasePage or BaseWindow.
- The Themes directory (with DarkTheme.xaml, LightTheme.xaml, RainbowTheme.xaml) influences the application's look, managed by ThemeManager.
- Business Logic / Domain Layer – Core classes that handle application-specific logic:
- Cue, CueManager, PlaylistManager, PlaylistFileManager.
- Log class for centralized logging.
- Configuration and Settings Module:
- App.config (the application configuration) along with Settings (containing AppSettings, AppSettingsManager, and settings.json) that govern runtime configurations.
- Auxiliary / Utility Modules:
- ZIPManagement for importing/exporting functionality (Export.cs, Import.cs) which may be used for backup or data migration.
- Inspector and other components may represent tools for developers or power users.

##### Relationships and Interactions
- UI components (windows/pages) serve as the entry points for user interactions. They communicate with the underlying business logic – for example, MainWindow interacts with CueManager and PlaylistManager.
- The settings module (AppSettings and AppSettingsManager) is used by various UI components (e.g., SettingsWindow) to load, update, and persist user preferences.
- Themes are applied dynamically: ThemeManager coordinates the active theme (from the Themes folder) and updates the UI accordingly.
- ZIPManagement utilities likely interface with the business logic to allow export/import tasks (perhaps from cue or playlist data).
- Log class is used across layers for logging events, errors, or debugging information.

##### Architectural Patterns & Design Principles
- Layer Separation: Clearly separate user interface concerns (XAML and related code-behind files), business logic (Managers and model classes), and configuration (Settings and App.config). This modularity is visible in the directory structure.
- MVVM-like or Code-behind Patterns: The use of .xaml files along with the associated .cs files suggests that view logic is in a framework like WPF, where a separation of UI design from business logic is essential.
- Extensibility: The use of modules (such as the ZIP management and Themes) indicates a design that supports extensions or later modifications.

- Clear, well-labeled components for each of the layers: UI, Business Logic, Settings/Config, Utilities/Resources.
- Specific notes or callouts for unique features – such as the theme switch (using ThemeManager) and the ZIP management functionalities.

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% UI Layer
    subgraph "UI Layer"
        UI_MainWindow["MainWindow"]:::ui
        UI_StartupWindow["StartupWindow"]:::ui
        UI_LoadingWindow["LoadingWindow"]:::ui
        UI_Inspector["Inspector"]:::ui
        UI_SettingsWindow["SettingsWindow"]:::ui
        UI_BaseClasses["BasePage / BaseWindow"]:::ui
    end

    %% Business Logic / Domain Layer
    subgraph "Business Logic / Domain Layer"
        BL_Cue["Cue"]:::business
        BL_CueManager["CueManager"]:::business
        BL_PlaylistManager["PlaylistManager"]:::business
        BL_PlaylistFileManager["PlaylistFileManager"]:::business
        BL_Log["Log"]:::business
    end

    %% Configuration and Settings Module
    subgraph "Configuration & Settings Module"
        Config_AppConfig["App.config"]:::config
        Config_AppSettings["AppSettings"]:::config
        Config_AppSettingsManager["AppSettingsManager"]:::config
        Config_SettingsJSON["settings.json"]:::config
    end

    %% Utilities: Themes and ZIP Management
    subgraph "Utilities"
        subgraph "Themes"
            Util_DarkTheme["DarkTheme"]:::utility
            Util_LightTheme["LightTheme"]:::utility
            Util_RainbowTheme["RainbowTheme"]:::utility
            Util_ThemeManager["ThemeManager"]:::utility
        end
        subgraph "ZIP Management"
            Util_Export["Export"]:::utility
            Util_Import["Import"]:::utility
        end
    end

    %% Resources
    subgraph "Resources"
        Res_Assets["Assets & Data"]:::resources
    end

    %% Connections
    %% UI Layer interactions with Business Logic
    UI_MainWindow -->|"commands"| BL_CueManager
    UI_Inspector -->|"inspects"| BL_CueManager
    UI_SettingsWindow -->|"updates"| Config_AppSettingsManager

    %% UI Layer interacts with Themes
    UI_MainWindow -.->|"applies"| Util_ThemeManager

    %% Business Logic interactions with Configuration
    BL_CueManager -->|"reads"| Config_AppSettingsManager

    %% Business Logic interacts with ZIP Management
    BL_CueManager -->|"exports"| Util_Export
    BL_CueManager -->|"imports"| Util_Import

    %% UI Layer uses Resources
    UI_MainWindow -.->|"uses"| Res_Assets
    UI_StartupWindow -.->|"uses"| Res_Assets
    UI_LoadingWindow -.->|"uses"| Res_Assets

    %% Styles
    classDef ui fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
    classDef business fill:#A9DFBF,stroke:#27AE60,stroke-width:2px;
    classDef config fill:#AED6F1,stroke:#3498DB,stroke-width:2px;
    classDef utility fill:#F5CBA7,stroke:#E67E22,stroke-width:2px;
    classDef resources fill:#D2B4DE,stroke:#8E44AD,stroke-width:2px;

    %% Click Events for UI Layer
    click UI_MainWindow "https://github.com/corp-i1/win-labs/blob/master/MainWindow.xaml"
    click UI_StartupWindow "https://github.com/corp-i1/win-labs/blob/master/StartupWindow.xaml"
    click UI_LoadingWindow "https://github.com/corp-i1/win-labs/blob/master/LoadingWindow.xaml"
    click UI_Inspector "https://github.com/corp-i1/win-labs/blob/master/Inspector.xaml"
    click UI_SettingsWindow "https://github.com/corp-i1/win-labs/blob/master/SettingsWindow.xaml"
    click UI_BaseClasses "https://github.com/corp-i1/win-labs/blob/master/BasePage.cs"

    %% Click Events for Themes
    click Util_DarkTheme "https://github.com/corp-i1/win-labs/blob/master/Themes/DarkTheme.xaml"
    click Util_LightTheme "https://github.com/corp-i1/win-labs/blob/master/Themes/LightTheme.xaml"
    click Util_RainbowTheme "https://github.com/corp-i1/win-labs/blob/master/Themes/RainbowTheme.xaml"
    click Util_ThemeManager "https://github.com/corp-i1/win-labs/blob/master/Themes/ThemeManager.cs"

    %% Click Events for Business Logic / Domain Layer
    click BL_Cue "https://github.com/corp-i1/win-labs/blob/master/Cue.cs"
    click BL_CueManager "https://github.com/corp-i1/win-labs/blob/master/CueManager.cs"
    click BL_PlaylistManager "https://github.com/corp-i1/win-labs/blob/master/PlaylistManager.cs"
    click BL_PlaylistFileManager "https://github.com/corp-i1/win-labs/blob/master/PlaylistFileManager.cs"
    click BL_Log "https://github.com/corp-i1/win-labs/blob/master/Log.cs"

    %% Click Events for Configuration and Settings Module
    click Config_AppConfig "https://github.com/corp-i1/win-labs/blob/master/App.config"
    click Config_AppSettings "https://github.com/corp-i1/win-labs/blob/master/Settings/AppSettings.cs"
    click Config_AppSettingsManager "https://github.com/corp-i1/win-labs/blob/master/Settings/AppSettingsManager.cs"
    click Config_SettingsJSON "https://github.com/corp-i1/win-labs/blob/master/Settings/settings.json"

    %% Click Events for ZIP Management
    click Util_Export "https://github.com/corp-i1/win-labs/blob/master/ZIPManagement/Export.cs"
    click Util_Import "https://github.com/corp-i1/win-labs/blob/master/ZIPManagement/Import.cs"

    %% Click Events for Resources
    click Res_Assets "https://github.com/corp-i1/win-labs/tree/master/resources"
```
