Preference Menu Dropdown
The Preference dropdown holds the application's display settings, and it is on the Main Panel. The server-backed ones are service-wide rather than per-account: one UserService singleton holds one UserConfig, saved to a single UserConfig.xml resolved against the process working directory, so every browser signed in to that service reads and writes the same values. The sign-in cookie carries a user-name claim that nothing outside the authentication endpoints reads, and no preference endpoint is keyed on an account.
In the WPF application the menu binds UserService, whose UserConfig holds the persisted values. In the web application the dropdown has two models: Language and Show Physics Options bind the appState store, hydrated from and written back through /api/preference/*, where the server keeps them on UserConfig; the CSV / CL Controller checkboxes bind the device-local useViewPrefs singleton, persisted in the browser's localStorage and never sent to the server.
Layout
- Preference Menu Dropdown
- Step Present Preference Button
- WPF application: the first entry of the menu, opening the Step Present window.
- Web application: the editor belongs to the Execution page's Step Info column, where a small icon button in the Step Properties panel header opens it as a modal next to the list it configures.
- Graphic-Cache Dropdown
- WPF application: a nested menu of cache fields inside the dropdown.
- Web application: an entry of the Execution page's extended tool bar, under
Meshed Geom ▾, which gathers the workpiece rendering-cache settings. - Its write is the one preference write that does not persist.
POST /api/preference/graphic-cacheclamps the requested size between the stored limits, assigns the three fields on the liveUserConfigand returns, without callingUserService.SaveUserConfig(). The new value is service-wide and takes effect at once, but it reaches the file only when some later preference save writes the config out.
- Language Selection SubMenu
- The persisted value is
UserConfig.LanguageCode; the web application reaches it throughGET/POST /api/preference/language, whose response also names the language codes the server supports. - In the web application the parent row captions the current language and the sub-menu marks the active code. A successful switch flips the interface text at once, so the confirmation toast already reads in the just-picked language.
- The persisted value is
- CSV Controller CheckBox
- Web application only. The model is
useViewPrefs().showCsvController— device-local, stored in the browser'slocalStorage, not inUserConfig. It is off by default. - Checking it adds the
CSV Controllernode to the General Setup page's Control Tree; unchecking removes it, moving the selection away first when that node is the selected one. - The caption under the box says whether the loaded project plays CSV —
This project plays CSV, orNot used by this project— read from thereferencedflag ofGET /api/mech/csv-runner. Opening the dropdown fetches both runner snapshots in parallel, but the fetch is guarded on a loaded project: with none, neither request is made and both captions are cleared to blank. A snapshot that fails to arrive leaves its caption blank as well, so a blank caption states nothing about the project. The guard reaches the captions only — neither checkbox is disabled by it.
- Web application only. The model is
- CL Controller CheckBox
- The same, for
useViewPrefs().showClController, theCL ControllerControl Tree node andGET /api/mech/cl-runner.
- The same, for
- Show Physics Options CheckBox
- The model is
UserConfig.ShowPhysicsOptions, reached in the web application throughGET/POST /api/preference/show-physics-options. - The checkbox is disabled and unchecked if
UserService.IsPhysicsLicensedis false: the GET returns the flag ANDed with the licence and the POST forcesfalsewithout it.
- The model is
- Show Log Button
- See Message Section.
- It is not a Preference-dropdown entry on either platform: the WPF application puts it on the bottom message bar, and the web application puts it on the menu bar's right side as an always-visible button that opens the Log Viewer page.
- Step Present Preference Button
So the web application's Preference dropdown carries the Language submenu, the CSV Controller and CL Controller visibility checkboxes, and the Show Physics Options checkbox.
A server write that fails raises a negative toast and rolls the item back in appState, so the dropdown never shows a language or a physics flag the server did not take.
Source Code Path
See HiNC App Anatomy for git repository links.
wwwroot-src/src/components/AppMenuBar.vue— thePreference ▾dropdown itself and the menu bar'sShow Logbutton.wwwroot-src/src/stores/appState.ts— the model of the two server-backed items, with the boot-time hydration and the write-back actions.wwwroot-src/src/composables/useViewPrefs.ts— the device-locallocalStoragesingleton behind the two controller checkboxes.wwwroot-src/src/api/preference.ts— typed wrapper over/api/preference/languageand/api/preference/show-physics-options.wwwroot-src/src/api/csvRunner.ts,wwwroot-src/src/api/clRunner.ts— thereferencedflag each controller caption reports.wwwroot-src/src/components/controlTree/useControlTreeHost.ts— builds or omits the two controller nodes and rebuilds the tree when either checkbox flips.wwwroot-src/src/i18n/en/menu.ts— the dropdown's labels and captions.wwwroot-src/src/pages/LogViewerPage.vue— the page theShow Logbutton routes to.Environments/PreferenceController.cs— the endpoints. The step-present, show-physics-options, language and execution-layout writes persist throughUserService.SaveUserConfig(); the graphic-cache write is the exception, and returns without one.Environments/UserConfig.cs— the persistedLanguageCodeandShowPhysicsOptionsproperties.Environments/UserService.cs— owns the singleUserConfigthe service holds, writes it toUserConfigPath, and answers the physics licence check.Program.cs— the oneUserServiceregistration behind every server-backed item here, and the configuration path it resolves against the process working directory.
See Also
- Main Panel — the menu bar this dropdown sits on
- Language Selection SubMenu — the only sub-menu this dropdown nests
- Graphic-Cache SubMenu — one of the two entries the web client hosts elsewhere
- Step Present Preference Page — the other entry the web client hosts elsewhere
- Log Viewer Page — the log screen this menu's namesake route serves
- Hidden Controller Branches — the two equipment nodes the CSV and CL entries reveal, and what a link to one does while its box is off