Corretta gestione jwd vuoto
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user