DIX DESERIALIZZAZIONE

This commit is contained in:
zaccaria.majid
2023-10-02 15:35:44 +02:00
parent f05ab648c2
commit e779df1485
3 changed files with 12 additions and 4 deletions
+9 -2
View File
@@ -8,6 +8,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
namespace MP.Data.Services
@@ -396,7 +397,7 @@ namespace MP.Data.Services
{
foreach (var item in currListMSE)
{
string serVal = Newtonsoft.Json.JsonConvert.SerializeObject(item);
string serVal = JsonSerializer.Serialize(item);
await localStorage.SetItemAsync(machineMse(item.IdxMacchina), serVal);
}
}
@@ -408,7 +409,13 @@ namespace MP.Data.Services
/// <returns></returns>
public async Task<MappaStatoExpl> GetMachineMse(string idxMacchina)
{
MappaStatoExpl answ = await localStorage.GetItemAsync<MappaStatoExpl>(machineMse(idxMacchina));
MappaStatoExpl answ = new MappaStatoExpl();
//answ = await localStorage.GetItemAsync<MappaStatoExpl>(machineMse(idxMacchina));
string tryString = await localStorage.GetItemAsync<string>(machineMse(idxMacchina));
if(tryString != "")
{
answ = JsonSerializer.Deserialize<MappaStatoExpl>(tryString);
}
return answ;
}