# d3nhatv0lam/ctuschedule architecture

> Architecture diagram of the GitHub repository d3nhatv0lam/ctuschedule, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/d3nhatv0lam/ctuschedule
- Repository: https://github.com/d3nhatv0lam/ctuschedule

## Overview

##### Project type and purpose
- This is a Windows desktop scheduling application built on .NET 8.0 with Avalonia UI (AXAML files), following the MVVM (Model-View-ViewModel) pattern.
- Purpose: Help CTU students fetch course data from the CTU HTQL web system, allow them to pick and store course groups, automatically build a timetable, and refresh group capacities.

##### File structure
- Top-level: CTUschedule solution and project, assets folder (fonts, images, styles), README, and application executable manifest.
- CTUschedule folder layers:
- App.axaml & Program.cs: Application bootstrap / entry point.
- Views (AXAML + code-behind): UI definitions.
- ViewModels: Presentation logic and data binding.
- Models: Domain entities (CourseNode, ScheduleCell, etc.).
- Converter: ValueConverters for XAML bindings.
- Utilities: Infrastructure and helpers (web driver to CTU HTQL, Internet checker, binary search, disposal behaviors).
- Resources/Dialogs: Reusable dialog interfaces and views.
- ViewLocator.cs: MVVM wiring.
- No internal database – data flows in memory and possibly saved in local storage or simple files (not shown here).

##### README
- Confirms MVVM desktop app, requires internet, logs into CTU’s system via student account, fetches and updates group capacities.
- Future features include export to Excel/images and auto-registration.

a. Main components:
- Presentation Layer:
– Views (AXAML + code-behind)
– Styles & Fonts in Assets
- Presentation Logic:
– ViewModels
– Converters (for data formatting in XAML)
– ViewLocator (resolves views ↔ viewmodels)
- Domain Layer:
– Models (CourseListData, ScheduleCell, CourseNode, etc.)
- Infrastructure Layer:
– Utilities (CTU_HTQLWebDriver for HTTP/WebDriver calls, CheckerInternetHelper, CourseNodeBinarySearch, DisposeBehavior)
– Dialog infrastructure (INotificationPopup, NotificationPopup.axaml)
- External System: CTU HTQL web service (authentication, course group data endpoints)

b. Relationships & data flow:
1. User action in a View (e.g., click “Fetch Groups”)
2. Command bound to a ViewModel method
3. ViewModel invokes Utilities.CTU_HTQLWebDriver → sends HTTP/webdriver request to CTU HTQL, awaiting response
4. Response parsed into Domain Models
5. ViewModel updates Models, raises PropertyChanged → View updates via data binding and Converters
6. On “Save” or “Refresh”, ViewModel triggers another utility call to push data back to CTU HTQL
7. NotificationPopup shown via Dialog infrastructure on success/failure

c. Architectural patterns & principles:
- MVVM for clear separation: Views ←→ ViewModels ←→ Models
- Dependency injection likely via ViewLocator or service locators
- Single Responsibility: Converters only format data, Utilities only handle I/O
- Layered architecture: Presentation / Domain / Infrastructure

d. Technologies/frameworks/libraries:
- .NET 8.0, Avalonia UI (AXAML)
- C#
- WebDriver or HttpClient (in CTU_HTQLWebDriver)
- INotifyPropertyChanged for ViewModelBase

##### Detail
- Essential subsystems: Converters, Dialogs, Utilities.
- Important classes (ViewLocator, Program.cs) showing startup flow.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User Interaction
    User((User)):::actor

    %% Application Bootstrap
    subgraph "Application Bootstrap"
        App["App.axaml & App.axaml.cs"]:::bootstrap
        Program["Program.cs"]:::bootstrap
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        Views["Views\n(AXAML + code-behind)"]:::ui
        Styles["Styles\nSignInStyle.axaml"]:::ui
        Fonts["Fonts"]:::ui
    end

    %% Presentation Logic
    subgraph "Presentation Logic"
        VMs["ViewModels"]:::logic
        Converters["Converters"]:::logic
        ViewLocator["ViewLocator.cs"]:::logic
    end

    %% Domain Layer
    subgraph "Domain Layer"
        Models["Models"]:::domain
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        Utilities["Utilities"]:::infra
        Dialogs["Dialogs\n(INotificationPopup & NotificationPopup)"]:::infra
    end

    %% External System
    External["CTU HTQL Web Service"]:::external

    %% Data Flows & Dependencies
    User -->|"interacts with"| Views
    Styles -->|"used by"| Views
    Fonts -->|"used by"| Views
    Program -->|"starts"| App
    App -->|"bootstraps via"| ViewLocator
    ViewLocator -->|"resolves"| Views
    ViewLocator -->|"resolves"| VMs
    Views <-->|"binds to"| VMs
    VMs -->|"uses"| Converters
    VMs -->|"updates/reads"| Models
    VMs -->|"calls I/O"| Utilities
    Utilities -->|"requests"| External
    External -->|"responds to"| Utilities
    Utilities -->|"returns data"| VMs
    VMs -->|"triggers"| Dialogs
    Dialogs -->|"displays"| Views

    %% Click Events
    click Views "https://github.com/d3nhatv0lam/ctuschedule/tree/master/CTUschedule/Views"
    click Styles "https://github.com/d3nhatv0lam/ctuschedule/blob/master/CTUschedule/Assets/Styles/SignInStyle.axaml"
    click Fonts "https://github.com/d3nhatv0lam/ctuschedule/tree/master/CTUschedule/Assets/Fonts"
    click App "https://github.com/d3nhatv0lam/ctuschedule/blob/master/CTUschedule/App.axaml"
    click App "https://github.com/d3nhatv0lam/ctuschedule/blob/master/CTUschedule/App.axaml.cs"
    click Program "https://github.com/d3nhatv0lam/ctuschedule/blob/master/CTUschedule/Program.cs"
    click VMs "https://github.com/d3nhatv0lam/ctuschedule/tree/master/CTUschedule/ViewModels"
    click Converters "https://github.com/d3nhatv0lam/ctuschedule/tree/master/CTUschedule/Converter"
    click ViewLocator "https://github.com/d3nhatv0lam/ctuschedule/blob/master/CTUschedule/ViewLocator.cs"
    click Models "https://github.com/d3nhatv0lam/ctuschedule/tree/master/CTUschedule/Models"
    click Utilities "https://github.com/d3nhatv0lam/ctuschedule/tree/master/CTUschedule/Utilities"
    click Utilities "https://github.com/d3nhatv0lam/ctuschedule/blob/master/CTUschedule/Utilities/CTU_HTQLWebDriver.cs"
    click Utilities "https://github.com/d3nhatv0lam/ctuschedule/blob/master/CTUschedule/Utilities/CheckerInternetHelper.cs"
    click Utilities "https://github.com/d3nhatv0lam/ctuschedule/blob/master/CTUschedule/Utilities/CourseNodeBinarySearch.cs"
    click Utilities "https://github.com/d3nhatv0lam/ctuschedule/blob/master/CTUschedule/Utilities/DisposeBehavior.cs"
    click Dialogs "https://github.com/d3nhatv0lam/ctuschedule/tree/master/CTUschedule/Resources/Dialogs"
    click Dialogs "https://github.com/d3nhatv0lam/ctuschedule/blob/master/CTUschedule/Resources/Dialogs/INotificationPopup.cs"
    click Dialogs "https://github.com/d3nhatv0lam/ctuschedule/blob/master/CTUschedule/Resources/Dialogs/NotificationPopup.axaml"
    click Dialogs "https://github.com/d3nhatv0lam/ctuschedule/blob/master/CTUschedule/Resources/Dialogs/NotificationPopup.cs"

    %% Styles
    classDef actor fill:#f9f,stroke:#333,stroke-width:1px
    classDef ui fill:#bbdefb,stroke:#333,stroke-width:1px
    classDef bootstrap fill:#c5e1a5,stroke:#333,stroke-width:1px
    classDef logic fill:#ffe082,stroke:#333,stroke-width:1px
    classDef domain fill:#aed581,stroke:#333,stroke-width:1px
    classDef infra fill:#ffccbc,stroke:#333,stroke-width:1px
    classDef external fill:#ef9a9a,stroke:#333,stroke-width:1px
```
