update x dizionario optionsXML

This commit is contained in:
Samuele Locatelli
2025-10-29 12:38:46 +01:00
parent eaea52f45d
commit 3f8f97c29e
5 changed files with 85 additions and 24 deletions
+28 -6
View File
@@ -49,7 +49,7 @@ namespace Test.UI.Components.Pages
protected string currJwd = "...";
protected Dictionary<string, string> m_CurrArgs = new Dictionary<string, string>();
protected Dictionary<int, string> currGroupShape = new Dictionary<int, string>();
protected string currHwOption = "";
protected Dictionary<int, string> currHwOption = new Dictionary<int, string>();
/// <summary>
/// Configurazione elenchi anagrafiche
@@ -147,7 +147,7 @@ namespace Test.UI.Components.Pages
CurrJwd = InitialJwd,
SvgPreview = currSvg,
DictShape = currGroupShape,
OptionsXml = currHwOption
DictOptionsXml = currHwOption
};
DLService.PipeSvg.EA_NewMessage += PipeSvg_EA_NewMessage;
DLService.PipeShape.EA_NewMessage += PipeShape_EA_NewMessage;
@@ -274,10 +274,32 @@ namespace Test.UI.Components.Pages
{
if (currArgs.msgUid.StartsWith($"{hwOptionChannel}:{windowUid}"))
{
// deserializzo il dizionario delle risposte...
//var rawAns = JsonConvert.DeserializeObject<string>(currArgs.newMessage);
currHwOption = currArgs.newMessage;
CurrData.OptionsXml = currHwOption;
/*--------------------------------------
* FixMe Todo levare !!!
* - try/catch deserializzazione
* - se fallisse metto le stesse opzioni a ttuti i GroupId
**--------------------------------------*/
Dictionary<int, string> rawDict = new Dictionary<int, string>();
try
{
// deserializzo il dizionario delle risposte...
rawDict = JsonConvert.DeserializeObject<Dictionary<int, string>>(currArgs.newMessage) ?? new Dictionary<int, string>();
}
catch
{ }
if (rawDict.Count == 0)
{
//se il dizionario delle shape esiste uso quello...
if (CurrData.DictShape.Count > 0)
{
foreach (var item in CurrData.DictShape)
{
rawDict.Add(item.Key, currArgs.newMessage);
}
}
}
currHwOption = rawDict ?? new Dictionary<int, string>();
CurrData.DictOptionsXml = currHwOption;
}
await InvokeAsync(StateHasChanged);
}