static void UploadImages() { var container = new ContainerRestCon(); var fotos = container.ListFotos(); var infoUser = new List <TB_USUARIO>(); infoUser = model.db.SelectInfoDeUsuarios(); if (infoUser != null) { foreach (var item in infoUser) { try { if (storage == null) { storage = new AzureStorage(); } if (storage.clientAzureStorage == null) { storage = new AzureStorage(); } foreach (var foto in fotos) { if (foto.Contains("VISITA")) { using (var img = container.LerArquivo(foto)) { if (img != null) { storage.UploadImage(img, foto, item.SERVIDOR); container.DeleteArquivo(foto); } } } } if (item.AVATAR_STATUS != (int)StatusAPI.CONCLUIDO && item.AVATAR != null) { using (var img = container.LerArquivo(item.AVATAR)) { if (img != null) { storage.UploadImage(img, item.AVATAR, item.SERVIDOR); item.AVATAR_STATUS = (int)StatusAPI.CONCLUIDO; model.db.AtualizaUserInfo(item); } } } #if !DEBUG MetricsManager.TrackEvent("UploadImage"); #endif } catch (BadRequestException) { storage = null; } catch (UnauthorizedException) { storage = null; } catch (ArgumentNullException) { storage = null; } } } }
public static UIImage GetBitMap(string nameFile) { var container = new ContainerRestCon(); var streamFoto = container.LerArquivo(nameFile); var teste = NSData.FromStream(streamFoto); return(new UIImage(teste)); }
public Bitmap GetBitMap(string nameFile) { var container = new ContainerRestCon(); var streamFoto = container.LerArquivo(nameFile); var option = new BitmapFactory.Options { InSampleSize = 4 }; option.InPreferredConfig = Bitmap.Config.Rgb565; return(BitmapFactory.DecodeStream(streamFoto, null, option)); }
protected override Java.Lang.Object DoInBackground(params Java.Lang.Object[] @params) { try { foto = (string)@params[0]; pasta = (string)@params[1]; isAvatarProfile = (bool)@params[2]; using (var img = container.LerArquivo(foto)) { if (img != null) { storage.UploadImage(img, foto, pasta).Wait(); } } } catch (Exception) { hasError = true; } return(true); }