using Microsoft.AspNetCore.Components; using Microsoft.CodeAnalysis.VisualBasic.Syntax; using WebDoorCreator.Data.DbModels; using WebDoorCreator.Data.Services; namespace WebDoorCreator.UI.Components.FilesMan { public partial class FilesRefresh { [Inject] protected WebDoorCreatorService WDCService { get; set; } = null!; [Parameter] public string lang { get; set; } = ""; protected Dictionary>? vocLemmas { get; set; } = null; protected Dictionary vocLemmas2Dict { get; set; } = new Dictionary(); protected Dictionary>? vocLemmasTEMP { get; set; } = null; protected Dictionary vocLemmasTEMP2Dict { get; set; } = new Dictionary(); protected bool showList { get; set; } = false; protected async override Task OnParametersSetAsync() { var rawVoc = await WDCService.VocLemmaGetAll(); if (rawVoc != null) { vocLemmas = rawVoc.Where(x => x.Key == lang).ToDictionary(x => x.Key, x => x.Value); if(vocLemmas != null) { foreach(var kvp in vocLemmas) { foreach(var item in kvp.Value) { vocLemmas2Dict.Add(item.Key, item.Value); } } } } } protected async Task refreshVoc() { vocLemmasTEMP = null; await Task.Delay(1); list2Mod = await WDCService.VocLemmaInsertPrepare(@$"{defaultPath}"); if (list2Mod != null) { //bool ok = await WDCService.VocLemmaInsert(); var k = await WDCService.VocLemmaTEMPGetAll(); if (k != null) { vocLemmasTEMP = k.Where(x => x.Key == lang).ToDictionary(x => x.Key, x => x.Value); if (vocLemmasTEMP != null) { foreach (var kvp in vocLemmasTEMP) { foreach (var item in kvp.Value) { vocLemmasTEMP2Dict.Add(item.Key, item.Value); } } } } } showList = true; } List list2Mod = new List(); protected string defaultPath { get; set; } = ""; } }