public async Task LoadFotos() { FotosLoading = true; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(FotosLoading))); var images = await Factory.GetAngebotService().GetAngebotImagesAsync(Angebot); int count = 1; foreach (var image in images) { if (images != null) { if (!Barrel.Current.IsExpired("angebot_foto_" + count + "_" + Angebot.Id) || !CrossConnectivity.Current.IsConnected) { var mstream = new MemoryStream(Barrel.Current.Get <byte[]>("angebot_foto_" + count + "_" + Angebot.Id)); Fotos.Add(new AttachmentImageViewModel(new AttachmentImage(mstream))); } else { byte[] data = new byte[image.Length]; image.Read(data, 0, (int)image.Length); Fotos.Add(new AttachmentImageViewModel(new AttachmentImage(image))); Barrel.Current.Add <byte[]>("angebot_foto_" + count + "_" + Angebot.Id, data, TimeSpan.FromDays(365)); } count++; } } FotosLoading = false; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(FotosLoading))); }
public void AddFotos() { string[] arxiusDirectori = Directory.GetFiles(_rutaImatges); string nom; foreach (string nomArxiu in arxiusDirectori) { nom = Path.GetFileName(nomArxiu); FotoModel f = new FotoModel { Client = "003", Expedient = "", Arxiu_foto = nom }; Fotos.Add(f); } TotalImatges = arxiusDirectori.Length; }
public void AddFoto(Foto foto) { Fotos.Add(foto); }