@using Microsoft.AspNetCore.Components
@using Microsoft.AspNetCore.Http
@using Radzen.Blazor
@inherits LayoutComponentBase
@inject ThemeState ThemeState
@inject ExampleService ExampleService
@inject MenuService MenuService
@inject NavigationManager UriHelper
@inject IJSRuntime JSRuntime
@inject IHttpContextAccessor httpContextAccessor
@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
@if (Theme != "default.css")
{
}
@Body
@*
*@
@foreach (var mentry in CompanyMenu)
{
@if (mentry.Children != null)
{
@foreach (var child in mentry.Children)
{
if (child.Children != null)
{
@foreach (var subchild in child.Children)
{
}
}
else
{
}
}
}
}
@foreach (var mentry in TeacherMenu)
{
@if (mentry.Children != null)
{
@foreach (var child in mentry.Children)
{
if (child.Children != null)
{
@foreach (var subchild in child.Children)
{
}
}
else
{
}
}
}
}
@foreach (var mentry in AdminMenu)
{
@if (mentry.Children != null)
{
@foreach (var child in mentry.Children)
{
if (child.Children != null)
{
@foreach (var subchild in child.Children)
{
}
}
else
{
}
}
}
}
@*
@foreach (var category in examples)
{
@if (category.Children != null)
{
@foreach (var example in category.Children)
{
if (example.Children != null)
{
@foreach (var child in example.Children)
{
}
}
else
{
}
}}
}
*@
@code {
RadzenSidebar sidebar0;
RadzenBody body0;
bool sidebarExpanded = true;
bool bodyExpanded = false;
dynamic themes = new[]
{
new { Text = "Default", Value = "default"},
new { Text = "Dark", Value="dark" },
new { Text = "Software", Value = "software"},
new { Text = "Humanistic", Value = "humanistic" },
new { Text = "Fluent", Value = "fluent" }
};
//public List AdminMenu = new List();
IEnumerable AdminMenu;
IEnumerable CompanyMenu;
IEnumerable TeacherMenu;
string Theme
{
get
{
return $"{ThemeState.CurrentTheme}.css";
}
}
protected override void OnInitialized()
{
if (httpContextAccessor != null && httpContextAccessor.HttpContext != null &&
httpContextAccessor.HttpContext.Request != null && httpContextAccessor.HttpContext.Request.Headers.ContainsKey("User-Agent"))
{
var userAgent = httpContextAccessor.HttpContext.Request.Headers["User-Agent"].FirstOrDefault();
if (!string.IsNullOrEmpty(userAgent))
{
if (userAgent.Contains("iPhone") || userAgent.Contains("Android") || userAgent.Contains("Googlebot"))
{
sidebarExpanded = false;
bodyExpanded = true;
}
}
}
AdminMenu = MenuService.MenuAdmin;
CompanyMenu = MenuService.MenuComapny;
TeacherMenu = MenuService.MenuTeacher;
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
}
public Task authenticationStateTask { get; set; }
void ChangeTheme(object value)
{
ThemeState.CurrentTheme = value.ToString();
UriHelper.NavigateTo(UriHelper.ToAbsoluteUri(UriHelper.Uri).ToString());
}
}