# jonaffrye/trainsimulatorwpf architecture

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

- Interactive diagram: https://gitdiagram.com/jonaffrye/trainsimulatorwpf
- Repository: https://github.com/jonaffrye/trainsimulatorwpf

## Overview

Train Simulator is a WPF desktop railway-driving simulator. The user selects a station, departure schedule and train in the main screen, then completes the cabin startup sequence before entering the driving dashboard. Dashboard controls update the selected train’s velocity and position, which are reflected in performance displays. The README also describes Belgian stations, train variants and Davis-equation physics. The graph follows the sampled event wiring and model calls; unsampled XAML and runtime behavior are not inferred.

Main entry points: [`TrainSimulatorWPF/View/CenterPanel/MainScreenxaml.cs`](https://github.com/jonaffrye/trainsimulatorwpf/blob/main/TrainSimulatorWPF/View/CenterPanel/MainScreenxaml.cs) (Journey selection), [`TrainSimulatorWPF/View/CenterPanel/Screen.xaml.cs`](https://github.com/jonaffrye/trainsimulatorwpf/blob/main/TrainSimulatorWPF/View/CenterPanel/Screen.xaml.cs) (Driving dashboard), [`TrainSimulatorWPF/MainWindow.xaml.cs`](https://github.com/jonaffrye/trainsimulatorwpf/blob/main/TrainSimulatorWPF/MainWindow.xaml.cs) (Main window), [`TrainSimulatorWPF/View/LeftPanel/LeftPan.xaml.cs`](https://github.com/jonaffrye/trainsimulatorwpf/blob/main/TrainSimulatorWPF/View/LeftPanel/LeftPan.xaml.cs) (Navigation panel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["Selection and navigation"]
  node_window["Main window<br/>[MainWindow.xaml.cs]"]
  node_selection["Journey selection<br/>[MainScreenxaml.cs]"]
end

subgraph group_controls["Cabin controls"]
  node_left["Navigation panel<br/>[LeftPan.xaml.cs]"]
  node_bottom["Cabin controls<br/>[BottomPan.xaml.cs]"]
  node_right["Regulator slider<br/>[RightPan.xaml.cs]"]
end

subgraph group_simulation["Driving simulation"]
  node_dashboard["Driving dashboard<br/>[Screen.xaml.cs]"]
end

subgraph group_domain["Railway domain"]
  node_station["Station<br/>[Station.cs]"]
  node_schedule["Schedule<br/>[Schedule.cs]"]
  node_train["Train model<br/>[Train.cs]"]
end

node_user(("Driver"))

node_user -->|"uses"| node_window
node_window -->|"hosts"| node_selection
node_window -->|"hosts"| node_dashboard
node_user -->|"presses"| node_left
node_user -->|"operates"| node_bottom
node_user -->|"adjusts"| node_right
node_left -->|"raises events"| node_selection
node_left -->|"raises events"| node_dashboard
node_bottom -->|"raises events"| node_selection
node_right -->|"raises events"| node_dashboard
node_selection -->|"builds choices"| node_station
node_selection -->|"builds choices"| node_schedule
node_selection -->|"builds choices"| node_train
node_selection -->|"notifies selection"| node_dashboard
node_dashboard -->|"updates motion"| node_train
node_train -->|"supplies telemetry"| node_dashboard
node_station -->|"holds departures"| node_schedule

click node_window "https://github.com/jonaffrye/trainsimulatorwpf/blob/main/TrainSimulatorWPF/MainWindow.xaml.cs"
click node_left "https://github.com/jonaffrye/trainsimulatorwpf/blob/main/TrainSimulatorWPF/View/LeftPanel/LeftPan.xaml.cs"
click node_bottom "https://github.com/jonaffrye/trainsimulatorwpf/blob/main/TrainSimulatorWPF/View/BottomPanel/BottomPan.xaml.cs"
click node_right "https://github.com/jonaffrye/trainsimulatorwpf/blob/main/TrainSimulatorWPF/View/RightPanel/RightPan.xaml.cs"
click node_selection "https://github.com/jonaffrye/trainsimulatorwpf/blob/main/TrainSimulatorWPF/View/CenterPanel/MainScreenxaml.cs"
click node_station "https://github.com/jonaffrye/trainsimulatorwpf/blob/main/TrainSimulatorWPF/Models/Station.cs"
click node_schedule "https://github.com/jonaffrye/trainsimulatorwpf/blob/main/TrainSimulatorWPF/Models/Schedule.cs"
click node_train "https://github.com/jonaffrye/trainsimulatorwpf/blob/main/TrainSimulatorWPF/Models/Train.cs"
click node_dashboard "https://github.com/jonaffrye/trainsimulatorwpf/blob/main/TrainSimulatorWPF/View/CenterPanel/Screen.xaml.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_window,node_selection toneBlue
class node_left,node_bottom,node_right toneAmber
class node_dashboard toneMint
class node_station,node_schedule,node_train toneRose
class node_user toneIndigo
```

## Components

### Selection and navigation

- [Main window](https://github.com/jonaffrye/trainsimulatorwpf/blob/main/TrainSimulatorWPF/MainWindow.xaml.cs): `TrainSimulatorWPF/MainWindow.xaml.cs`
- [Journey selection](https://github.com/jonaffrye/trainsimulatorwpf/blob/main/TrainSimulatorWPF/View/CenterPanel/MainScreenxaml.cs): `TrainSimulatorWPF/View/CenterPanel/MainScreenxaml.cs`

### Cabin controls

- [Navigation panel](https://github.com/jonaffrye/trainsimulatorwpf/blob/main/TrainSimulatorWPF/View/LeftPanel/LeftPan.xaml.cs): `TrainSimulatorWPF/View/LeftPanel/LeftPan.xaml.cs`
- [Cabin controls](https://github.com/jonaffrye/trainsimulatorwpf/blob/main/TrainSimulatorWPF/View/BottomPanel/BottomPan.xaml.cs): `TrainSimulatorWPF/View/BottomPanel/BottomPan.xaml.cs`
- [Regulator slider](https://github.com/jonaffrye/trainsimulatorwpf/blob/main/TrainSimulatorWPF/View/RightPanel/RightPan.xaml.cs): `TrainSimulatorWPF/View/RightPanel/RightPan.xaml.cs`

### Driving simulation

- [Driving dashboard](https://github.com/jonaffrye/trainsimulatorwpf/blob/main/TrainSimulatorWPF/View/CenterPanel/Screen.xaml.cs): `TrainSimulatorWPF/View/CenterPanel/Screen.xaml.cs`

### Railway domain

- [Station](https://github.com/jonaffrye/trainsimulatorwpf/blob/main/TrainSimulatorWPF/Models/Station.cs): `TrainSimulatorWPF/Models/Station.cs`
- [Schedule](https://github.com/jonaffrye/trainsimulatorwpf/blob/main/TrainSimulatorWPF/Models/Schedule.cs): `TrainSimulatorWPF/Models/Schedule.cs`
- [Train model](https://github.com/jonaffrye/trainsimulatorwpf/blob/main/TrainSimulatorWPF/Models/Train.cs): `TrainSimulatorWPF/Models/Train.cs`

### Other components

- **Driver**

## Connections

- Driver → Main window: uses (evidence: `README.md`)
- Main window → Journey selection: hosts (evidence: `TrainSimulatorWPF/MainWindow.xaml.cs`)
- Main window → Driving dashboard: hosts (evidence: `TrainSimulatorWPF/MainWindow.xaml.cs`)
- Driver → Navigation panel: presses (evidence: `README.md`)
- Driver → Cabin controls: operates (evidence: `README.md`)
- Driver → Regulator slider: adjusts (evidence: `README.md`)
- Navigation panel → Journey selection: raises events
- Navigation panel → Driving dashboard: raises events
- Cabin controls → Journey selection: raises events
- Regulator slider → Driving dashboard: raises events
- Journey selection → Station: builds choices (evidence: `TrainSimulatorWPF/View/CenterPanel/MainScreenxaml.cs`)
- Journey selection → Schedule: builds choices (evidence: `TrainSimulatorWPF/View/CenterPanel/MainScreenxaml.cs`)
- Journey selection → Train model: builds choices (evidence: `TrainSimulatorWPF/View/CenterPanel/MainScreenxaml.cs`)
- Journey selection → Driving dashboard: notifies selection (evidence: `TrainSimulatorWPF/View/CenterPanel/MainScreenxaml.cs`)
- Driving dashboard → Train model: updates motion (evidence: `TrainSimulatorWPF/View/CenterPanel/Screen.xaml.cs`)
- Train model → Driving dashboard: supplies telemetry (evidence: `TrainSimulatorWPF/View/CenterPanel/Screen.xaml.cs`)
- Station → Schedule: holds departures (evidence: `TrainSimulatorWPF/Models/Station.cs`)
