Skip to main content

Client-side configuration

Lagoon client application (Blazor WebAssembly) configuration is distributed across four locations depending on the nature of the setting. Knowing where to configure each feature saves time: this page serves as an entry point and routing table to detailed pages.

What goes where?​

LocationFileWhat it's for
Application markupApp.razor, MenuConfiguration.razor (Shared project)Visual structure: layout, zones, tabbed mode, navigation menu.
Application behaviorsMain.cs → OnConfigureBehavior(ApplicationBehavior app)Global UI settings resolved at startup (toasters, tabs, button sizes, EULA…).
Application cultureMain.cs → OnInitCulture(ApplicationCultureInfo culture)Date and number formats.
Project fileClient.csprojClient-side compilation options, notably the Service Worker (offline mode).
Markup vs behavior

Much of the layout (tab activation, header, sidebar, footer, menu) is configured in the markup App.razor, not in OnConfigureBehavior. The latter only drives global behaviors resolved by code.

Feature summary table​

FeatureLocationKey elementPage
General structure (header, sidebar, footer)App.razor<LgApp DefaultLayout ShowHeader ShowSidebar ShowFooter>Layout
Navigation menuMenuConfiguration.razorLgMenuItem, LgMenuTitle, LgMenuSeparatorMenu
Tab mode activationApp.razor<LgApp IsTabbed="true">Tabs
Tabs open at startupApp.razor<LgApp> contentTabs
Saving open tabsOnConfigureBehaviorapp.TabSavingMethodTabs
Active tab reloadOnConfigureBehaviorapp.TabReloadDisabledTabs
Mobile / Desktop renderingComponent / layoutmedia-adapted renderingMobile / Desktop
Date and number formatsOnInitCultureApplicationCultureInfoDate & Number Formats
Offline mode (Service Worker)Client.csproj<ServiceWorkerEnabled>Offline mode
Automatic Service Worker installationOnConfigureBehaviorapp.ServiceWorkerAutoInstallOffline mode
Toasters (position, duration, bar)OnConfigureBehaviorapp.Toastr.*Toasters
JavaScript interoperabilityComponent / serviceIJSRuntime or JSInteropBaseJSInterop
Themes and stylesClient/resources/styles/main.scss, theme-<name>.scss, App:ThemeThemes and styles
Loading spinnermain.scss$spinner, $sp-color, $sp-color-altSpinner
RCL pages, lazy loadingClient.csproj, Main.cs<BlazorWebAssemblyLazyLoad>, app.LazyAssemblies, OnNavigateAsyncRCL and lazy loading

Additional settings via OnConfigureBehavior​

The ApplicationBehavior object exposes other global properties useful on the client side, without a dedicated page:

PropertyEffectDefault value
app.ToolbarButtonSizeDefault size of toolbar buttons.ButtonSize.Medium
app.FrameToolbarButtonSizeSize of toolbar buttons in frames.ButtonSize.Small
app.ActionPanelToolbarButtonSizeSize of toolbar buttons in action panels.ButtonSize.Small
app.ColorPaletteList of colors offered by the color picker.built-in palette
app.EditFormDefault options for LgEditForm forms.—
app.SelectDefault options for LgSelect / LgSelectMultiple.—
app.ResetButtonConfiguration of the field reset button.—
app.RoundModeDefault rounding mode of LgNumericBox.MidpointRounding.ToEven
app.HttpClientDefaultTimeoutDefault timeout of the HTTP client.100 seconds
app.RgaaSupportEnables RGAA support for the application.false
app.DevelopedByLogoUri / app.OwnerLogoUriLogos displayed on the "About" page.—
app.RequireEulaConsent / app.EulaFromServerManagement of EULA consent.false
Cross-cutting settings

Some properties of ApplicationBehavior belong to cross-cutting topics: EULA consent is detailed in EULA, and app.DefaultAcceptHeader (JSON / MessagePack negotiation) in MessagePack.

Example Main.cs​

Typical skeleton of the Main class from the Client project, annotated by feature.

Main.cs
public class Main : LgCustomApplication
{
// Global UI behaviors resolved at startup.
protected override void OnConfigureBehavior(ApplicationBehavior app)
{
// Save open tabs to the server database.
app.TabSavingMethod = TabSavingMethod.Remote;

// Toasters: position and display duration.
app.Toastr.Position = Position.TopRight;
app.Toastr.TimeOut = 5000;

// Logos displayed on the "About" page.
app.DevelopedByLogoUri = new List<string> { LOGO_URI_DZ };
}

// Date and number formats for the application.
protected override void OnInitCulture(ApplicationCultureInfo culture)
{
base.OnInitCulture(culture);
// Format customization here (e.g., short date format).
}

// Service and root component registration.
protected override void OnInitialize(WebAssemblyHostBuilder builder)
{
builder.RootComponents.Add<Shared.App>("#app");
Services.Registry.RegisterServices(builder.Services);
}
}

See also​