private async Task RunAsync(CancellationToken cancellationToken) { // TODO: Replace the following with your own logic. while (!cancellationToken.IsCancellationRequested) { Trace.TraceInformation("Working"); AzureStorage storage = new AzureStorage(); storage.IngestSensorValues(); /* * IEnumerable<CloudQueueMessage> queue_messages = storage.GetDigestMessages(32); * if (queue_messages != null) * { * IEnumerable<IStorageDeviceReading> messages = * queue_messages.Select((q) => JsonConvert * .DeserializeObject<IStorageDeviceReading>(q.AsString, jss)).OrderBy( m => m.Time); * IEnumerable<IGrouping<string, IStorageDeviceReading>> message_groups = messages * .GroupBy(m => m.DeviceId.ToUrn()); * Parallel.ForEach(message_groups, message_group => * { * Log.Partition(); * foreach (IStorageDeviceReading m in message_group.OrderBy(mg => mg.Time)) * { * storage.IngestSensorValues(m); * } * }); * } **/ await Task.Delay(1000); } }
static Global() { CommitId = ConfigurationManager.AppSettings.Get("appharbor.commit_id"); var settings = LoadSettings(); var integrationPath = settings["DataPath"]; var contracts = Contracts.CreateStreamer(); var strategy = new DocumentStrategy(); if (integrationPath.StartsWith("file:")) { var path = integrationPath.Remove(0, 5); var config = FileStorage.CreateConfig(path); Docs = config.CreateNuclear(strategy).Container; Client = new WebEndpoint(new NuclearStorage(Docs), contracts, config.CreateQueueWriter(Topology.RouterQueue)); } else if (integrationPath.StartsWith("azure:")) { var path = integrationPath.Remove(0, 6); var config = AzureStorage.CreateConfig(path); Docs = config.CreateNuclear(strategy).Container; Client = new WebEndpoint(new NuclearStorage(Docs), contracts, config.CreateQueueWriter(Topology.RouterQueue)); } else { throw new InvalidOperationException("Unsupported environment"); } Forms = new FormsAuth(Docs.GetReader <UserId, LoginView>()); Auth = new WebAuth(Client); }
protected override NuclearStorage Compose(IDocumentStrategy strategy) { var dev = AzureStorage.CreateConfigurationForDev(); WipeAzureAccount.Fast(s => s.StartsWith("test-views"), dev); return(dev.CreateNuclear(strategy)); }
public JsonResult UploadImage(String filename, int id) { /*Bypass to UploadDocument*/ //UploadDocument(filename, id); // Retrieve the file and check for content type var file = Request.Files[filename]; if (!file.ContentType.StartsWith("image", StringComparison.CurrentCultureIgnoreCase)) { return(Json(new { success = false }, JsonRequestBehavior.AllowGet)); } // Create new filename to be used as blob name //keep trying to upload until we don't override another file. String newFilename = filename; int tryNum = 0; while (CheckIfFilenameExists(newFilename)) { newFilename = Path.GetFileNameWithoutExtension(filename) + tryNum + Path.GetExtension(filename); } // Upload file to the blob storage AzureStorage storage = new AzureStorage(); string newPath = storage.UploadBlob(AzureStorage.Containers.cardimages, newFilename, file.InputStream, file.ContentType); // return image name (blob name) back return(Json(new { success = true, path = newPath }, JsonRequestBehavior.AllowGet)); }
private async void LoadData() { userRoute = await usersManager.GetUserWhere(userSelect => userSelect.Id == userRoute.Id); nameLabel.Text = userRoute.Name; ageLabel.Text = "Age: " + userRoute.Age; phoneLabel.Text = "Phone: " + userRoute.Phone; descriptionLabel.Text = route.Comments; departureLabel.Text = "Departure: \n" + route.Depart_Date.ToString("dd/MMMM H:mm ") + "h"; if (!string.IsNullOrEmpty(userRoute.ResourceName)) { Uri uriImage = AzureStorage.DownloadPhoto(userRoute.ResourceName); if (uriImage != null) { profileImage.Source = ImageSource.FromUri(uriImage); } } Reservation reservation = new Reservation { Id_Route = route.Id }; List <Reservation> reservations = await reservationsManager.GetReservationsWhere(reserv => reserv.Id_Route == reservation.Id_Route); seatsLabel.Text = "Seats Available: " + (route.Capacity - reservations.Count); }
public void TestRetreivePreviousBlobs_Successful() { string uploadPath = Path.GetTempPath() + Guid.NewGuid().ToString() + ".txt"; string result = null; using (StreamWriter sw = File.CreateText(uploadPath)) { sw.WriteLine("Test file"); } AzureStorage storageTest = new AzureStorage(_connectionString, "test record"); storageTest.DeleteBlobContainerContents(); storageTest.UploadBlob(uploadPath, "directory", "UploadUser", "Comments"); storageTest.UploadBlob(uploadPath, "directory", "UploadUser", "Comments"); storageTest.UploadBlob(uploadPath, "directory", "UploadUser", "Comments"); List <FileInfo> allBlobVersions = new List <FileInfo>(); var blobName = @"directory/" + Path.GetFileName(uploadPath); try { allBlobVersions = storageTest.RetrievePreviousBlobVersions(blobName); } catch (Exception ex) { result = ex.Message; } Assert.AreEqual(allBlobVersions.Count, 3); Assert.IsNull(result); File.Delete(uploadPath); storageTest.DeleteBlobContainerContents(); }
public IActionResult Index(IFormFile file, [FromForm] BlogPost post) { var userIdCookie = GetEncryptedUserCookie("USER_ID"); if (userIdCookie == null) { //can't Blog without login return(RedirectToAction("Index", "Home")); } else { string filePath = null; using (var stream = file.OpenReadStream()) { var connectionString = _Configuration.GetConnectionString("StorageConnection"); filePath = AzureStorage.AddUpdateFile(file.FileName, stream, connectionString, "Team1"); } post.ImageUrl = filePath; _CoWork454Context.Add(post); _CoWork454Context.SaveChanges(); return(new JsonResult(post)); } }
public async Task OnPostAsync() { var user = await userManager.GetUserAsync(User); string mydir = Path.Combine(environment.WebRootPath, "imagefolder", user.Id); Directory.CreateDirectory(mydir); foreach (var file in Upload) { FileInfo f = new FileInfo(file.FileName); string originalFile = Path.Combine(mydir, file.FileName); using (var fileStream = new FileStream(originalFile, FileMode.Create)) { await file.CopyToAsync(fileStream); } using Bitmap b = new Bitmap(originalFile); string thumb = Helper.SaveResizedFile(b, originalFile, 200, 200); string resized = Helper.SaveResizedFile(b, originalFile, b.Width / 2, b.Height / 2); await AzureStorage.AddFilesAsync(originalFile, user.Id); await AzureStorage.AddFilesAsync(Path.Combine(mydir, thumb), user.Id); await AzureStorage.AddFilesAsync(Path.Combine(mydir, resized), user.Id); var myImages = new MyImages(ijpContext, user.Id); myImages.AddImageFromFile(originalFile, resized, thumb, user.Id); System.IO.File.Delete(file.FileName); } Directory.Delete(Path.Combine(environment.WebRootPath, "imagefolder", user.Id), true); }
private static void Main() { CloudStorageAccount account = CloudStorageAccount.Parse("UseDevelopmentStorage=true"); IAzureStorageConfig storageConfig = AzureStorage.CreateConfig(account); var builder = new CqrsClientBuilder(); builder.UseProtoBufSerialization(); builder.Domain(m => m.InAssemblyOf <MessageCreated>()); builder.Azure(config => config.AddAzureSender(storageConfig, Queues.MESSAGES)); builder.Storage(config => config.AtomicIsInAzure(storageConfig, s => { s.WithAssemblyOf <MessageView>(); s.CustomStaticSerializer(new AtomicStorageSerializerWithProtoBuf()); })); builder.Advanced.ConfigureContainer(b => { b.RegisterType <Program>().As <Program>(); b.RegisterInstance(storageConfig).As <IAzureStorageConfig>(); //This is solely to show the replaying of events. You wouldn't ordinarily need the eventstore in a cqrs client; b.RegisterInstance(ConfigureEventStore()).SingleInstance().As <IStoreEvents>(); }); CqrsClient cqrsClient = builder.Build(); ILifetimeScope scope = cqrsClient.Scope; scope.Resolve <Program>().Run(); }
private async Task ClearData() { var answer = await _dialogService.ShowConfirmDialog("Slett alle data i Azure?", "Vil du virkelig fjerne alle filer i Azure? Dette kan ikke reverseres!"); if (answer == false) { return; } var files = await AzureStorage.GetFilesListAsync(ContainerType.Data); foreach (var f in files) { await AzureStorage.DeleteFileAsync(ContainerType.Data, f); Info = f + " deleted from Azure"; } var images = await AzureStorage.GetFilesListAsync(ContainerType.Image); foreach (var i in images) { await AzureStorage.DeleteFileAsync(ContainerType.Image, i); Info = i + " deleted from Azure"; } Info = $"Azure data ({files.Count}) and images ({images.Count}) deleted"; }
public static IServiceCollection AddCustomMVC(this IServiceCollection services, IConfiguration configuration) { services.AddControllers(options => { options.Filters.Add(typeof(HttpGlobalExceptionFilter)); options.Filters.Add(typeof(ValidateModelStateFilter)); }).AddApplicationPart(typeof(ApartmentController).Assembly) .AddNewtonsoftJson(); services.AddCors(options => { options.AddPolicy("CorsPolicy", builder => builder .SetIsOriginAllowed((host) => true) .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials()); }); if (configuration.GetValue <bool>("AzureStorageEnabled")) { services.AddSingleton <IStorage>(serviceProvider => { var blobStorage = new AzureStorage(serviceProvider.GetService <IMediator>(), serviceProvider.GetService <ILogger <AzureStorage> >(), serviceProvider.GetService <IIdentityService>(), serviceProvider.GetService <IEventBus>(), configuration); blobStorage.InitAsync().GetAwaiter().GetResult(); return(blobStorage); }); } return(services); }
public static void Test0() { Console.WriteLine("MakeTestCatalog.Test0"); //Storage storage = new FileStorage("http://*****:*****@"c:\data\site\test"); StorageCredentials credentials = new StorageCredentials("", ""); CloudStorageAccount account = new CloudStorageAccount(credentials, true); Storage storage = new AzureStorage(account, "ver36", "catalog"); var ids = GetInitialIdList(250); //var ids = new string[] { "dotnetrdf" }; string path = @"c:\data\nuget\nuspecs"; BuildCatalogAsync(path, storage, ids).Wait(); AddDependenciesAsync(path, storage).Wait(); DistinctPackageIdCollector distinctPackageIdCollector = new DistinctPackageIdCollector(storage.ResolveUri("index.json")); distinctPackageIdCollector.Run().Wait(); Console.WriteLine(distinctPackageIdCollector.Result.Count); }
public ICollection <string> Validate() { var errors = new List <string>(); if (MongoDb != null) { MongoDb.Validate(errors); } if (Backup != null) { Backup.Validate(errors); } if (GoogleStorage != null) { GoogleStorage.Validate(errors); } if (AzureStorage != null) { AzureStorage.Validate(errors); } if (string.Equals(Storage, "GC", StringComparison.OrdinalIgnoreCase) && string.Equals(Storage, "Azure", StringComparison.OrdinalIgnoreCase)) { errors.Add("Either Google Storage or Azure Storage must be configured."); } return(errors); }
private async Task <AzureFileData> RebuildFile(RebuildFile model, string container) { var rebuiltMapped = HostingEnvironment.MapPath("~/Uploads/Temp/Rebuilt"); var localTemp = HostingEnvironment.MapPath("~/Uploads/Temp"); CreateDirectory(localTemp); CreateDirectory(rebuiltMapped); var newFile = String.Format("file_{0}{1}", Guid.NewGuid().ToString(), model.FileExtension); var allFilesExists = model.Guids.All(filePart => File.Exists(Path.Combine(localTemp, filePart))); if (!allFilesExists) { return(null); } using (var streamWriter = new StreamWriter(Path.Combine(rebuiltMapped, newFile))) { foreach (var filePart in model.Guids) { using (var streamReader = new StreamReader(Path.Combine(localTemp, filePart))) { var fileSize = (int)streamReader.BaseStream.Length; var fileBytes = new byte[fileSize]; await streamReader.BaseStream.ReadAsync(fileBytes, 0, fileSize); await streamWriter.BaseStream.WriteAsync(fileBytes, 0, fileSize); } } } var data = new AzureStorage(container, true).SaveFile(Path.Combine(rebuiltMapped, newFile)); CleanUpLocalStorage(model, rebuiltMapped, newFile, localTemp); return(data); }
public void Put(int id, IFormFile file, [FromForm] Resource model) { var existingResource = _context.Resources.Find(id); string filePath = null; if (file != null) { using (var stream = file.OpenReadStream()) { var connectionString = _configuration.GetConnectionString("StorageConnection"); filePath = AzureStorage.AddUpdateFile(file.FileName, stream, connectionString, "CoWork454Container"); } } //retain existing photo if none uploaded else if (file == null && existingResource.ResourceImage != null) { filePath = existingResource.ResourceImage; } //if nothing use default image else { filePath = "/images/resource_default.jpg"; } existingResource.ResourceName = model.ResourceName; existingResource.ResourceDescription = model.ResourceDescription; existingResource.ResourceMaxCapacity = model.ResourceMaxCapacity; existingResource.ResourceHasVC = model.ResourceHasVC; existingResource.ResourceImage = filePath; _context.Resources.Update(existingResource); _context.SaveChanges(); }
public void TestRecoverBlob_Unsuccessful() { string uploadPath = Path.GetTempPath() + Guid.NewGuid().ToString() + ".txt"; string result = null; using (StreamWriter sw = File.CreateText(uploadPath)) { sw.WriteLine("Test file"); } AzureStorage storageTest = new AzureStorage(_connectionString, "test record"); storageTest.DeleteBlobContainerContents(); var blobName = @"directory/" + Path.GetFileName(uploadPath); try { storageTest.RecoverBlob(blobName, "Recover User"); } catch (Exception ex) { result = ex.Message; } Assert.AreEqual(result, "The remote server returned an error: (404) Not Found."); storageTest.DeleteBlobContainerContents(); File.Delete(uploadPath); }
public void Put(int id, IFormFile file, [FromForm] NewsPost model) { var existingPost = _context.NewsPosts.Find(id); string filePath = null; if (file != null) { using (var stream = file.OpenReadStream()) { var connectionString = _configuration.GetConnectionString("StorageConnection"); filePath = AzureStorage.AddUpdateFile(file.FileName, stream, connectionString, "CoWork454Container"); } } //retain existing photo if none uploaded else if (file == null && existingPost.NewsPhoto != null) { filePath = existingPost.NewsPhoto; } //if nothing use default image else { filePath = "/images/news_default.jpg"; } existingPost.NewsText = model.NewsText; existingPost.NewsTitle = model.NewsTitle; existingPost.NewsTag = model.NewsTag; existingPost.AuthorId = Convert.ToInt32(GetEncryptedGenericCookie("USER_ID")); existingPost.NewsPhoto = filePath; existingPost.DateTimePosted = DateTimeOffset.Now; _context.NewsPosts.Update(existingPost); _context.SaveChanges(); }
public void CanIngestSensorValues() { CreateDeviceReadings(); AzureStorage storage = new AzureStorage(); storage.IngestSensorValues(); }
public override bool OnStart() { Trace.TraceInformation("Branch.Service.Halo4 service started"); ServicePointManager.DefaultConnectionLimit = 1; _storage = new AzureStorage(); _h4WaypointManager = new Manager(_storage, true); #region Create Tasks if they don't exist foreach (var entity in from task in _tasks let entity = _storage.Table.RetrieveSingleEntity <TaskEntity>(TaskEntity.PartitionKeyString, TaskEntity.FormatRowKey(task.Key.ToString()), _storage.Table.Halo4CloudTable) where entity == null select new TaskEntity(task.Key) { LastRun = new DateTime(1994, 8, 18), Interval = (int)task.Value.TotalSeconds }) { _storage.Table.InsertOrReplaceSingleEntity(entity, _storage.Table.Halo4CloudTable); } #endregion return(base.OnStart()); }
public IStreamingContainer GetContainer(string path) { //UseLocalFiddler(); var root = AzureStorage.CreateStreaming(CloudStorageAccount.DevelopmentStorageAccount); return(root.GetContainer(path)); }
public void CanAuthorizeFindUser() { AzureStorage storage = new AzureStorage(); Assert.Throws(typeof(System.Security.SecurityException), () => storage.FindUser("d155074f-4e85-4cb5-a597-8bfecb0dfc04".ToGuid(), "admin")); }
//[Test] public async Task UploadAndDownloadAsync() { // 정렬 string connectionString = @"set required"; //set required string container = @"test"; string destpath = @"Dest"; string srcpathname = Path.Combine(Path.GetDirectoryName(typeof(FileStorageTest).Assembly.Location), @"Storage\Sample\Dest\test.js"); FileInfo fi = new FileInfo(srcpathname); IStorage storage = new AzureStorage(connectionString); // 동작 Exception ex = null; try { await storage.UploadAsync(srcpathname, container, destpath, false, false, false); } catch (Exception e) { ex = e; } var uploadedInfo = await storage.UploadAsync(srcpathname, container, destpath, true, false); // 어설션 Assert.IsInstanceOf(typeof(DuplicateFileException), ex); Assert.IsTrue(uploadedInfo.AbsoluteUri.Contains(Path.Combine(container, destpath).Replace(@"\", @"/"))); Assert.AreEqual(fi.Length, uploadedInfo.Length); }
private async Task <AzureStorage> GetKeyVault() { try { _logger.LogInformation("GetKeyVault ==> Started"); AzureStorage azureStorage = new AzureStorage(); string url = string.Format(KeyVaultUri, Environment.GetEnvironmentVariable("keyVaultName")); _logger.LogInformation("GetKeyVault URL ==> " + url); var secretClient = new SecretClient( new Uri(url), _credentials); _logger.LogInformation("Fetching Started ==> " + AzureStorageKey.STORAGE_ACCOUNT_KEY); var accountKey = await secretClient.GetSecretAsync(AzureStorageKey.STORAGE_ACCOUNT_KEY); azureStorage.STORAGE_ACCOUNT_KEY = accountKey.Value.Value; _logger.LogInformation("Fetching Completed ==> " + AzureStorageKey.STORAGE_ACCOUNT_KEY); _logger.LogInformation("Fetching Started ==> " + AzureStorageKey.STORAGE_ACCOUNT_NAME); var accountName = await secretClient.GetSecretAsync(AzureStorageKey.STORAGE_ACCOUNT_NAME); azureStorage.STORAGE_ACCOUNT_NAME = accountName.Value.Value; _logger.LogInformation("Fetching Completed ==> " + AzureStorageKey.STORAGE_ACCOUNT_NAME); _logger.LogInformation("Fetching Started ==> " + AzureStorageKey.STORAGE_CONTAINER_NAME); var storageContainer = await secretClient.GetSecretAsync(AzureStorageKey.STORAGE_CONTAINER_NAME); azureStorage.STORAGE_CONTAINER_NAME = storageContainer.Value.Value; _logger.LogInformation("Fetching Completed ==> " + AzureStorageKey.STORAGE_CONTAINER_NAME); _logger.LogInformation("GetKeyVault ==> Ended"); return(azureStorage); } catch (Exception ex) { _logger.LogError("GetKeyVault Error ==> " + ex.Message.ToString()); throw new Exception(ex.Message.ToString(), ex); } }
protected override void OnAppearing() { base.OnAppearing(); MessagingCenter.Unsubscribe <Popup_ProfileImageDialog, string>(this, "blobimagename"); MessagingCenter.Subscribe <Popup_ProfileImageDialog, string>(this, "blobimagename", async(sender, value) => { bool ab = true; if (ab == true && value != null) { ImageName = value; int index = ImageName.IndexOf("blobimage"); ImageName = ImageName.Substring(index + 9); var byteArray = System.Convert.FromBase64String(ImageName); Stream stream3 = new MemoryStream(byteArray); var imageSource = ImageSource.FromStream(() => stream3); profileimage.Source = imageSource; ImageName2 = await AzureStorage.UploadFileAsync(ContainerType.Image, new MemoryStream(byteArray.ToArray())); } ab = false; value = null; }); }
private void UpdateAzureStorageStatus() { AzureStorage azure = new AzureStorage(Config.AzureStorageAccountName, Config.AzureStorageAccountAccessKey, Config.AzureStorageContainer, Config.AzureStorageEnvironment, Config.AzureStorageCustomDomain, Config.AzureStorageUploadPath); lblAzureStorageURLPreview.Text = azure.GetPreviewURL(); }
private void LoadMyImages(string userId) { foreach (var myimg in ijpContext.File.Where(x => x.UserId == userId)) { Images.Add(new FileModel() { FileId = myimg.FileId, CategoryId = myimg.CategoryId, RawFormat = myimg.RawFormat, IsPrivate = myimg.IsPrivate, IsLandscape = myimg.IsLandscape, LengthKB = myimg.LengthKB, Name = myimg.Name, Title = myimg.Title, Width = myimg.Width, Height = myimg.Height, HorizontalResolution = myimg.HorizontalResolution, VerticalResolution = myimg.VerticalResolution, PixelFormat = myimg.PixelFormat, Url = AzureStorage.BlobUrlAsync(userId, myimg.Name).GetAwaiter().GetResult().ToString(), UrlResized = AzureStorage.BlobUrlAsync(userId, myimg.ResizedFileName).GetAwaiter().ToString(), UrlThumb = AzureStorage.BlobUrlAsync(userId, myimg.ThumbFileName).GetAwaiter().GetResult().ToString(), ThumbFileName = myimg.ThumbFileName, ResizedFileName = myimg.ResizedFileName, Content = AzureStorage.DownloadFileFromBlob(myimg.Name, userId).GetAwaiter().GetResult(), UserId = userId }); } }
public ActionResult UploadFoto(User pessoa, int id) { if (Request.Files.Count == 0) { return(Json("Nenhum arquivo selecionado!", JsonRequestBehavior.AllowGet)); } if (Request.Files[0].ContentType != "image/jpeg") { return(Json("Apenas imagens JPEG!", JsonRequestBehavior.AllowGet)); } try { using (Image bmp = Image.FromStream(Request.Files[0].InputStream)) { if (bmp.Width > 2000 || bmp.Height > 2000) { return(Json("A imagem deve ter dimensões menores do que 2000x2000!", JsonRequestBehavior.AllowGet)); } } Request.Files[0].InputStream.Position = 0; } catch { return(Json("Imagem JPEG inválida!", JsonRequestBehavior.AllowGet)); } AzureStorage.Upload( "fotos", id + ".jpg", Request.Files[0].InputStream, "cloud", "UseDevelopmentStorage=true"); return(Json("Imagem registrada com sucesso", JsonRequestBehavior.AllowGet)); }
protected override async Task ExecuteAsync(CancellationToken stoppingToken) { var fileToWatchAsString = Environment.GetEnvironmentVariable("FILE_TO_WATCH"); if (fileToWatchAsString == null) { _logger.LogError("No file to be watched. Please set variable FILE_TO_WATCH"); return; } var fileToWatch = new FileInfo(fileToWatchAsString); var connectionString = Environment.GetEnvironmentVariable("AZURE_CONNECTION_STRING"); if (connectionString == null) { _logger.LogError("No connection string found. Please set variable AZURE_CONNECTION_STRING"); return; } var azureStorage = new AzureStorage(connectionString, _logger); using var _ = new ReactiveFileWatcher(fileToWatch, azureStorage.UploadFile, _logger); while (!stoppingToken.IsCancellationRequested) { await Task.Delay(-1, stoppingToken); } }
public void TestRecoverBlob_Successful() { string uploadPath = Path.GetTempPath() + Guid.NewGuid().ToString() + ".txt"; string result = null; using (StreamWriter sw = File.CreateText(uploadPath)) { sw.WriteLine("Test file"); } AzureStorage storageTest = new AzureStorage(_connectionString, "test record"); storageTest.DeleteBlobContainerContents(); storageTest.UploadBlob(uploadPath, "directory", "UploadUser", "Comments"); var blobName = @"directory/" + Path.GetFileName(uploadPath); storageTest.DeleteBlob(blobName, "Delete User"); try { storageTest.RecoverBlob(blobName, "Recover User"); } catch (Exception ex) { result = ex.Message; } Assert.IsNull(result); storageTest.DeleteBlobContainerContents(); File.Delete(uploadPath); }
public async Task <ImageSource> LoadImage(string imagePath) { if (string.IsNullOrWhiteSpace(imagePath)) { return(null); } if (imagePath.Length > 10 && Uri.IsWellFormedUriString(imagePath, UriKind.RelativeOrAbsolute)) { ImageHelper.ImageHelperItem item = ImageHelper.LoadedImages.FirstOrDefault(x => x.imageId == picture); ImageSource img = item?.image; return(img ?? await AzureStorage.LoadImage(picture)); } else { ImageHelper.ImageHelperItem item = ImageHelper.LoadedImages.FirstOrDefault(x => x.imageId == picture); ImageSource img; if (item == null) { img = ImageSource.FromFile(picture); ImageHelper.LoadedImages.Add(new ImageHelper.ImageHelperItem { image = img, imageId = picture }); return(img); } return(item.image); } }
public DaoEvents(AzureStorage storage) { Storage = storage; }
public DaoUsers(AzureStorage storage) { Storage = storage; }