Exemplo n.º 1
0
        static void UploadImages()
        {
            var container = new ContainerRestCon();
            var fotos     = container.ListFotos();
            var 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"))
                            {
                                var asyncPhoto  = new AsyncPhotoBlob(storage);
                                var listObjects = new Java.Lang.Object[] { foto, item.SERVIDOR, false };
                                asyncPhoto.Execute(listObjects);
                            }
                        }
                        if (item.AVATAR_STATUS != (int)StatusAPI.CONCLUIDO && item.AVATAR != null)
                        {
                            var asyncPhotoProfile = new AsyncPhotoBlob(storage);
                            var listObjects       = new Java.Lang.Object[] { item.AVATAR, item.SERVIDOR, true };
                            asyncPhotoProfile.Execute(listObjects);
                            item.AVATAR_STATUS = (int)StatusAPI.CONCLUIDO;
                            model.db.AtualizaUserInfo(item);
                        }
                        MetricsManager.TrackEvent("UploadImage");
                    }
                    catch (BadRequestException) { storage = null; }
                    catch (UnauthorizedException) { storage = null; }
                    catch (ConnectException) { storage = null; }
                    catch (ArgumentNullException) { storage = null; }
                }
            }
        }
Exemplo n.º 2
0
 public AsyncPhotoBlob(AzureStorage storage)
 {
     this.storage = storage;
     container    = new ContainerRestCon();
 }