Corretta gestione jwd vuoto

This commit is contained in:
Annamaria Sassi
2026-03-06 15:06:51 +01:00
parent b6991be6bc
commit 5c3506b0fd
7 changed files with 43 additions and 24 deletions
+2 -2
View File
@@ -21,7 +21,7 @@
</div>
</div>
}
@* else if (listErrLink != null && listErrLink.Count > 0)
else if (listErrLink != null && listErrLink.Count > 0)
{
<div class="alert alert-danger">
<div class="fs-3">Errore configurazione:</div>
@@ -34,7 +34,7 @@
</ul>
</div>
</div>
} *@
}
else
{
<div class="d-flex flex-column">
+17 -14
View File
@@ -410,7 +410,7 @@ namespace WebWindowComplex
DataSave dataSave = new DataSave()
{
currJwd = CurrJwd,
Dosave = false,
ForceSave = false,
};
return EC_OnClose.InvokeAsync(dataSave);
}
@@ -572,7 +572,7 @@ namespace WebWindowComplex
DataSave dataSave = new DataSave()
{
currJwd = CurrJwd,
Dosave = true,
ForceSave = true,
};
return EC_OnClose.InvokeAsync(dataSave);
}
@@ -603,11 +603,11 @@ namespace WebWindowComplex
{
isLoading = true;
// SOLO SE sono presenti...
listErrLink = new Dictionary<string, string>();
if (ListPayload.IsPopulated() && LiveData.IsValid())
{
bool updRequested = false;
listErrPre = new Dictionary<string, string>();
listErrLink = new Dictionary<string, string>();
listWarnings = new Dictionary<string, string>();
// controllo elenchi BasePayload siano validi...
if (ListPayload.IsValid())
@@ -634,6 +634,8 @@ namespace WebWindowComplex
try
{
WindowFromJson = JsonConvert.DeserializeObject<JsonWindow>(LiveData.CurrJwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", "");
if (WindowFromJson == null || WindowFromJson.AreaList == null || WindowFromJson.AreaList.Count == 0)
WindowFromJson = BuildFrameDefault();
UpdateInputList(WindowFromJson);
setCurrWindow(WindowFromJson);
//SOLO SE non sono in edit...
@@ -648,7 +650,8 @@ namespace WebWindowComplex
listErrLink.Add("Window", $"Deserializing Error:{Environment.NewLine}{ex}");
Log.Error($"Errore nel deserializzare jwd: {ex.Message}");
// uso un oggetto "basico" per non fermarmi
await BuildFrameDefault();
WindowFromJson =BuildFrameDefault();
await DoPreviewSvg(true);
}
}
else
@@ -696,7 +699,9 @@ namespace WebWindowComplex
}
else
{
await BuildFrameDefault();
JsonWindow WindowFromJson = new JsonWindow("", "", "", "");
WindowFromJson = BuildFrameDefault();
await DoPreviewSvg(true);
}
}
else
@@ -707,7 +712,7 @@ namespace WebWindowComplex
}
}
private Task BuildFrameDefault()
private JsonWindow BuildFrameDefault()
{
// Costruisco window e setto i parametri
Window window = new Window();
@@ -746,9 +751,7 @@ namespace WebWindowComplex
frame.AreaList.Add(fill);
JsonWindow jsonWindow = window.Serialize();
string jwd = JsonConvert.SerializeObject(jsonWindow);
JsonWindow WindowFromJson = JsonConvert.DeserializeObject<JsonWindow>(jwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", "");
setCurrWindow(WindowFromJson);
return DoPreviewSvg(true);
return JsonConvert.DeserializeObject<JsonWindow>(jwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", "");
}
/// <summary>
@@ -761,9 +764,9 @@ namespace WebWindowComplex
List<int> groupIdList = new List<int>();
SearchInWindow(window.AreaList.First(), groupIdList);
var duplicati = groupIdList.GroupBy(x => x)
.Where(g => g.Count() > 1)
.Select(g => g.Key)
.ToList();
.Where(g => g.Count() > 1)
.Select(g => g.Key)
.ToList();
if (duplicati.Count > 0)
return false;
else
@@ -782,7 +785,7 @@ namespace WebWindowComplex
}
m_CurrWindow = WindowFromJson.Deserialize();
groupIdOK = CheckGroupId(m_CurrWindow);
if (m_CurrWindow.AreaList != null && m_CurrWindow.AreaList.Count > 0 && groupIdOK)
if (groupIdOK)
{
FrameWindow = m_CurrWindow.AreaList[0];
if (m_PreviousWindow != null)
@@ -1957,6 +1960,6 @@ namespace WebWindowComplex
public class DataSave
{
public string currJwd { get; set; } = "";
public bool Dosave { get; set; } = true;
public bool ForceSave { get; set; } = true;
}
}
+3 -1
View File
@@ -6,7 +6,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>3.1.3.611</Version>
<Version>3.1.3.615</Version>
<Authors>Annamaria Sassi</Authors>
<Company>Egalware</Company>
<Description>Componente gestione Configurazioni avanzate Window per LUX</Description>
@@ -298,6 +298,8 @@