Abbozzata gestione recupero immagini in modalità task.parallel (+ veloce?)
This commit is contained in:
@@ -1026,6 +1026,45 @@ namespace MConnectSDK
|
||||
UserData _newUser;
|
||||
Image userImg = null;
|
||||
// recupero effettivi dati utente e restituisco...
|
||||
|
||||
Parallel.ForEach(resp.result, item =>
|
||||
{
|
||||
// se richiesto aggiungo immagine...
|
||||
if (getImages)
|
||||
{
|
||||
userImg = null;
|
||||
try
|
||||
{
|
||||
// creo obj userData... SE HO immagine...
|
||||
if (item.Image_Url != "")
|
||||
{
|
||||
var imgRes = Task.Run(() => Utils.getImageAsync(pageUrlImgDownload, item.Image_Url));
|
||||
imgRes.Wait();
|
||||
if (imgRes.Result != null)
|
||||
{
|
||||
userImg = imgRes.Result;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
_newUser = new UserData
|
||||
{
|
||||
UserId = item.Id,
|
||||
IsAdmin = item.IsAdmin,
|
||||
Username = item.Username,
|
||||
Email = item.Email,
|
||||
Cognome = item.Lastname,
|
||||
Nome = item.Firstname,
|
||||
UserImage = userImg
|
||||
};
|
||||
answ.Add(_newUser);
|
||||
});
|
||||
|
||||
|
||||
#if false
|
||||
foreach (var item in resp.result)
|
||||
{
|
||||
// se richiesto aggiungo immagine...
|
||||
@@ -1060,8 +1099,8 @@ namespace MConnectSDK
|
||||
UserImage = userImg
|
||||
};
|
||||
answ.Add(_newUser);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
return answ;
|
||||
}
|
||||
|
||||
@@ -1187,11 +1226,6 @@ namespace MConnectSDK
|
||||
var taskCliInfo = Task.Run(() => GetClientStatusAsync());
|
||||
taskCliInfo.Wait();
|
||||
_currStatus = taskCliInfo.Result;
|
||||
#if false1
|
||||
// SOLO SE E' tutot ok come connessione procedo...
|
||||
if (_currStatus.CloudStatusOk)
|
||||
{
|
||||
#endif
|
||||
// parto pessimista...
|
||||
bool userOk = false;
|
||||
// variabili accessorie
|
||||
@@ -1365,13 +1399,6 @@ namespace MConnectSDK
|
||||
}
|
||||
_currStatus.Error = errore;
|
||||
}
|
||||
#if false
|
||||
}
|
||||
else
|
||||
{
|
||||
_currStatus.Payload.Message = "Errore: manca connessione a cloud";
|
||||
}
|
||||
#endif
|
||||
reqStatus = _currStatus;
|
||||
});
|
||||
return _currStatus;
|
||||
|
||||
@@ -8,5 +8,5 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyCopyright("Copyright © Steamware 2019")]
|
||||
[assembly: AssemblyTrademark("_")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: AssemblyVersion("1.1.1904.69")]
|
||||
[assembly: AssemblyFileVersion("1.1.1904.69")]
|
||||
[assembly: AssemblyVersion("1.1.1904.71")]
|
||||
[assembly: AssemblyFileVersion("1.1.1904.71")]
|
||||
|
||||
Reference in New Issue
Block a user