# yasunosubaru/ham-win architecture

> Architecture diagram of the GitHub repository yasunosubaru/ham-win, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yasunosubaru/ham-win
- Repository: https://github.com/yasunosubaru/ham-win

## Overview

Ham for Windows is a Wuhan University campus desktop client. The main workflow is user interaction through the WPF shell, AppService coordination, optional CAS sign-in and campus-data fetching, then domain calculations and presentation; user data is persisted locally. The README also documents a WinUI 3 presentation that reuses Core and Infrastructure, with a separate real-data bus fetcher. Several feature implementations were not sampled, so those capabilities are represented at their documented module paths without speculative call wiring; Sport and Rating are models/demo-only, not live integrations.

Main entry points: [`src/Ham.App/Services/AppService.cs`](https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.App/Services/AppService.cs) (App service), [`src/Ham.App/ViewModels`](https://github.com/yasunosubaru/ham-win/tree/main/src/Ham.App/ViewModels) (Feature view models), [`src/Ham.App/App.xaml.cs`](https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.App/App.xaml.cs) (WPF shell), [`src/Ham.Infrastructure/Education/EducationClient.cs`](https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Infrastructure/Education/EducationClient.cs) (Education client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Desktop presentation"]
  node_wpf["WPF shell<br/>[App.xaml.cs]"]
  node_sections["Feature views<br/>[Views]"]
  node_viewmodels["Feature view models<br/>[ViewModels]"]
  node_winui["WinUI shell<br/>[App.xaml.cs]"]
end

subgraph group_coordination["Application coordination"]
  node_appservice["App service<br/>[AppService.cs]"]
  node_caswindow["CAS login window<br/>[CasLoginWindow.cs]"]
  node_scheduler["Reminder scheduler"]
  node_notifications["Notifications"]
end

subgraph group_domain["Domain logic"]
  node_education["Education domain<br/>[Education.cs]"]
  node_calendar["Calendar and schedule"]
  node_scores["Score calculations<br/>[ScoreCalculator.cs]"]
  node_gpa["GPA scale<br/>[GpaScale.cs]"]
  node_sport["Sport models<br/>[SportModels.cs]"]
  node_rating["Rating models<br/>[RatingModels.cs]"]
end

subgraph group_integration["Campus and local data"]
  node_busfetcher["WinUI bus fetcher<br/>[BusFetcher.cs]"]
  node_educationclient["Education client<br/>[EducationClient.cs]"]
  node_casclient["CAS client<br/>[CasClient.cs]"]
  node_http["Campus HTTP session"]
  node_libraryclient["Library client<br/>[LibraryClient.cs]"]
  node_weather["Weather client<br/>[WeatherClient.cs]"]
  node_bus["Bus data module<br/>[Campus]"]
  node_store[("Local JSON store<br/>[DataStore.cs]")]
end

node_user(("Campus user"))
node_educationservice{{"University education systems"}}
node_libraryservice{{"University library"}}
node_weatherapi{{"Open-Meteo"}}
node_busservice{{"University bus site"}}

node_user -->|"uses"| node_wpf
node_wpf -->|"initializes"| node_appservice
node_wpf -->|"creates shell"| node_viewmodels
node_sections -->|"binds to"| node_viewmodels
node_viewmodels -->|"updates and reads"| node_appservice
node_appservice -->|"loads and saves"| node_store
node_appservice -->|"authenticates"| node_casclient
node_casclient -->|"uses host login"| node_caswindow
node_casclient -->|"seeds cookies and requests"| node_http
node_appservice -->|"fetches coursework"| node_educationclient
node_educationclient -->|"sends requests"| node_http
node_educationclient -->|"queries"| node_educationservice
node_educationclient -->|"parses records"| node_education
node_viewmodels -->|"calculates results"| node_scores
node_scores -->|"uses scale"| node_gpa
node_viewmodels -->|"uses schedule rules"| node_calendar
node_appservice -->|"fetches library data"| node_libraryclient
node_libraryclient -->|"sends requests"| node_http
node_libraryclient -->|"queries"| node_libraryservice
node_appservice -->|"refreshes weather"| node_weather
node_weather -->|"fetches forecast"| node_weatherapi
node_wpf -->|"starts scheduler"| node_scheduler
node_scheduler -->|"dispatches reminders"| node_notifications
node_user -->|"uses"| node_winui
node_winui -->|"hosts bus feature"| node_busfetcher
node_busfetcher -->|"fetches bus page"| node_busservice
node_bus -.->|"provides bus data"| node_busservice

click node_wpf "https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.App/App.xaml.cs"
click node_sections "https://github.com/yasunosubaru/ham-win/tree/main/src/Ham.App/Views"
click node_viewmodels "https://github.com/yasunosubaru/ham-win/tree/main/src/Ham.App/ViewModels"
click node_winui "https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Ui/App.xaml.cs"
click node_busfetcher "https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Ui/Services/BusFetcher.cs"
click node_appservice "https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.App/Services/AppService.cs"
click node_caswindow "https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.App/Services/CasLoginWindow.cs"
click node_scheduler "https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.App/Services/ReminderScheduler.cs"
click node_notifications "https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.App/Services/NotificationService.cs"
click node_education "https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Core/Models/Education.cs"
click node_calendar "https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Core/Models/SemesterCalendar.cs"
click node_scores "https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Core/Models/ScoreCalculator.cs"
click node_gpa "https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Core/Models/GpaScale.cs"
click node_educationclient "https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Infrastructure/Education/EducationClient.cs"
click node_casclient "https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Infrastructure/Cas/CasClient.cs"
click node_http "https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Infrastructure/Net/CampusHttpClient.cs"
click node_libraryclient "https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Infrastructure/Library/LibraryClient.cs"
click node_weather "https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Infrastructure/Campus/WeatherClient.cs"
click node_bus "https://github.com/yasunosubaru/ham-win/tree/main/src/Ham.Infrastructure/Campus"
click node_sport "https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Infrastructure/Sport/Models/SportModels.cs"
click node_rating "https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Infrastructure/Rating/Models/RatingModels.cs"
click node_store "https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Infrastructure/Storage/DataStore.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_wpf,node_sections,node_viewmodels,node_winui,node_user toneBlue
class node_appservice,node_caswindow,node_scheduler,node_notifications toneAmber
class node_education,node_calendar,node_scores,node_gpa,node_sport,node_rating toneMint
class node_busfetcher,node_educationclient,node_casclient,node_http,node_libraryclient,node_weather,node_bus,node_store toneRose
class node_educationservice,node_libraryservice,node_weatherapi,node_busservice toneIndigo
```

## Components

### Desktop presentation

- [WPF shell](https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.App/App.xaml.cs): `src/Ham.App/App.xaml.cs`
- [Feature views](https://github.com/yasunosubaru/ham-win/tree/main/src/Ham.App/Views): `src/Ham.App/Views`
- [Feature view models](https://github.com/yasunosubaru/ham-win/tree/main/src/Ham.App/ViewModels): `src/Ham.App/ViewModels`
- [WinUI shell](https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Ui/App.xaml.cs): `src/Ham.Ui/App.xaml.cs`

### Application coordination

- [App service](https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.App/Services/AppService.cs): `src/Ham.App/Services/AppService.cs`
- [CAS login window](https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.App/Services/CasLoginWindow.cs): `src/Ham.App/Services/CasLoginWindow.cs`
- [Reminder scheduler](https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.App/Services/ReminderScheduler.cs): `src/Ham.App/Services/ReminderScheduler.cs`
- [Notifications](https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.App/Services/NotificationService.cs): `src/Ham.App/Services/NotificationService.cs`

### Domain logic

- [Education domain](https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Core/Models/Education.cs): `src/Ham.Core/Models/Education.cs`
- [Calendar and schedule](https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Core/Models/SemesterCalendar.cs): `src/Ham.Core/Models/SemesterCalendar.cs`
- [Score calculations](https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Core/Models/ScoreCalculator.cs): `src/Ham.Core/Models/ScoreCalculator.cs`
- [GPA scale](https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Core/Models/GpaScale.cs): `src/Ham.Core/Models/GpaScale.cs`
- [Sport models](https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Infrastructure/Sport/Models/SportModels.cs): `src/Ham.Infrastructure/Sport/Models/SportModels.cs`
- [Rating models](https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Infrastructure/Rating/Models/RatingModels.cs): `src/Ham.Infrastructure/Rating/Models/RatingModels.cs`

### Campus and local data

- [WinUI bus fetcher](https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Ui/Services/BusFetcher.cs): `src/Ham.Ui/Services/BusFetcher.cs`
- [Education client](https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Infrastructure/Education/EducationClient.cs): `src/Ham.Infrastructure/Education/EducationClient.cs`
- [CAS client](https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Infrastructure/Cas/CasClient.cs): `src/Ham.Infrastructure/Cas/CasClient.cs`
- [Campus HTTP session](https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Infrastructure/Net/CampusHttpClient.cs): `src/Ham.Infrastructure/Net/CampusHttpClient.cs`
- [Library client](https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Infrastructure/Library/LibraryClient.cs): `src/Ham.Infrastructure/Library/LibraryClient.cs`
- [Weather client](https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Infrastructure/Campus/WeatherClient.cs): `src/Ham.Infrastructure/Campus/WeatherClient.cs`
- [Bus data module](https://github.com/yasunosubaru/ham-win/tree/main/src/Ham.Infrastructure/Campus): `src/Ham.Infrastructure/Campus`
- [Local JSON store](https://github.com/yasunosubaru/ham-win/blob/main/src/Ham.Infrastructure/Storage/DataStore.cs): `src/Ham.Infrastructure/Storage/DataStore.cs`

### Other components

- **Campus user**
- **University education systems**
- **University library**
- **Open-Meteo**
- **University bus site**

## Connections

- Campus user → WPF shell: uses
- WPF shell → App service: initializes
- WPF shell → Feature view models: creates shell
- Feature views → Feature view models: binds to
- Feature view models → App service: updates and reads
- App service → Local JSON store: loads and saves
- App service → CAS client: authenticates
- CAS client → CAS login window: uses host login
- CAS client → Campus HTTP session: seeds cookies and requests
- App service → Education client: fetches coursework
- Education client → Campus HTTP session: sends requests
- Education client → University education systems: queries
- Education client → Education domain: parses records
- Feature view models → Score calculations: calculates results
- Score calculations → GPA scale: uses scale
- Feature view models → Calendar and schedule: uses schedule rules
- App service → Library client: fetches library data
- Library client → Campus HTTP session: sends requests
- Library client → University library: queries
- App service → Weather client: refreshes weather
- Weather client → Open-Meteo: fetches forecast
- WPF shell → Reminder scheduler: starts scheduler
- Reminder scheduler → Notifications: dispatches reminders
- Campus user → WinUI shell: uses
- WinUI shell → WinUI bus fetcher: hosts bus feature
- WinUI bus fetcher → University bus site: fetches bus page
- Bus data module → University bus site: provides bus data
