Open Source Web Application Framework for ASP.NET Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

67 lines
2.1 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options;
using Volo.Abp.BlazoriseUI;
using Volo.Abp.SettingManagement.Localization;
namespace Volo.Abp.SettingManagement.Blazor.Pages.SettingManagement;
public partial class SettingManagement
{
[Inject]
protected IServiceProvider ServiceProvider { get; set; }
protected SettingComponentCreationContext SettingComponentCreationContext { get; set; }
[Inject]
protected IOptions<SettingManagementComponentOptions> _options { get; set; }
[Inject]
protected IStringLocalizer<AbpSettingManagementResource> L { get; set; }
protected SettingManagementComponentOptions Options => _options.Value;
protected List<RenderFragment> SettingItemRenders { get; set; } = new List<RenderFragment>();
protected string SelectedGroup;
protected List<BreadcrumbItem> BreadcrumbItems = new List<BreadcrumbItem>();
protected async override Task OnInitializedAsync()
{
BreadcrumbItems.Add(new BreadcrumbItem(LUiNavigation["Menu:Administration"].Value));
BreadcrumbItems.Add(new BreadcrumbItem(@L["Menu:Settings"].Value));
SettingComponentCreationContext = new SettingComponentCreationContext(ServiceProvider);
foreach (var contributor in Options.Contributors)
{
await contributor.ConfigureAsync(SettingComponentCreationContext);
}
SettingComponentCreationContext.Normalize();
SettingItemRenders.Clear();
if (SettingComponentCreationContext.Groups.Any())
{
SelectedGroup = GetNormalizedString(SettingComponentCreationContext.Groups.First().Id);
}
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await Task.Yield();
await InvokeAsync(StateHasChanged);
}
await base.OnAfterRenderAsync(firstRender);
}
protected virtual string GetNormalizedString(string value)
{
return value.Replace('.', '_');
}
}