UI layer
Purpose
Mnemo.UI is the Avalonia desktop shell: windows, controls, view models, feature modules, themes, and navigation. It references Infrastructure only for composition and typed services injected into VMs.
Code location
| Area | Path |
|---|---|
| App entry | Mnemo.UI/App.axaml.cs |
| Composition root | Mnemo.UI/Services/Bootstrapper.cs |
| Root shell | Mnemo.UI/Views/MainWindow.axaml(.cs) |
| Modules | Mnemo.UI/Modules/** |
| Shared components | Mnemo.UI/Components/**, Mnemo.UI/Themes/** |
Main interfaces / classes
MainWindowViewModel— sidebar, top bar, navigation host, right sidebar VM wiring.NavigationService/INavigationService— resolves which view model occupies workspace (MainWindowbindsNavigation.CurrentViewModel).IModuleimplementations — one class per feature package (Notes, Flashcards, Path, …).
Startup / registration flow
App.OnFrameworkInitializationCompleted calls Bootstrapper.Build(), assigns MainWindow.DataContext, sets desktop.MainWindow. Modules already ran inside Bootstrapper before the window appears—see Startup flow.
MainWindow (user-visible summary)
MainWindow is the root window: left Sidebar, Topbar, central WorkspaceKeybindHost hosting Navigation.CurrentViewModel, optional RightSidebar, and ToastHost. Global keybind tunneling hooks live in code-behind for chords that must work shell-wide.
How to extend
- Prefer adding or extending an
IModuleinstead of editingBootstrapperfor every route—keep bootstrap for cross-cutting singletons only. - New controls: place under
Components/with AXAML + code-behind partials matching existing patterns.
Gotchas
- Avalonia layout:
StackPanel/Griddo not support padding or corner radius on the panel itself—use Margin or wrap inBorder(team rule). - Theme resources are dynamic—avoid hard-coded brushes in feature views when a theme key exists.
Related: Module system, overview