Viewer to Server
This commit is contained in:
48
View/Shared/MainLayout.razor.cs
Normal file
48
View/Shared/MainLayout.razor.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace OI.Metrology.View.Shared;
|
||||
|
||||
public partial class MainLayout
|
||||
{
|
||||
|
||||
private bool _IsDarkMode;
|
||||
private string? _Database;
|
||||
private string? _RequestId;
|
||||
private MudTheme? _MyCustomTheme;
|
||||
private MudThemeProvider? _MudThemeProvider;
|
||||
|
||||
[Inject] protected Models.AppSettings? AppSettings { get; set; }
|
||||
// [Inject] protected IHttpContextAccessor? HttpContextAccessor { get; set; }
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
base.OnParametersSet();
|
||||
_Database = AppSettings is not null && !AppSettings.IsDevelopment ? "test-database" : "prod-database";
|
||||
_RequestId = Activity.Current?.Id ?? string.Empty; // HttpContextAccessor?.HttpContext?.TraceIdentifier;
|
||||
_MyCustomTheme = new MudTheme()
|
||||
{
|
||||
Palette = new Palette()
|
||||
{
|
||||
Primary = "#478f7c",
|
||||
Secondary = "#AB377A",
|
||||
Success = "#AEC067",
|
||||
Info = "#928285",
|
||||
Warning = "#F07F3C",
|
||||
Error = "#E30034",
|
||||
AppbarBackground = "#478f7c",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender && _MudThemeProvider is not null && _MyCustomTheme is not null)
|
||||
{
|
||||
_IsDarkMode = await _MudThemeProvider.GetSystemPreference();
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user