private async Task LoadImagesAsync() { int imagesCount = 0; if (Images != null) { imagesCount = Images.Count; } Images = await Api.GetImagesAsync(EntryId); if (Log.IsDebugEnabled()) { Log.Debug($"LoadImages, previous images: {imagesCount}, markers: {Markers.Count}, entry locations: {Model.Locations.Count}."); Log.Debug(Json.Serialize(Markers)); } if (imagesCount > 0) { Markers.RemoveRange(0, imagesCount); } if (Log.IsDebugEnabled()) { Log.Debug($"LoadImages.Cleared, markers: {Markers.Count}."); Log.Debug(Json.Serialize(Markers)); } for (int i = 0; i < Images.Count; i++) { var image = Images[i]; Markers.Insert(i, new MapMarkerModel { Latitude = image.Location.Latitude, Longitude = image.Location.Longitude, Altitude = image.Location.Altitude, DropColor = "blue", Title = image.Name }); } if (Log.IsDebugEnabled()) { Log.Debug($"LoadImages.Final, markers: {Markers.Count}."); Log.Debug(Json.Serialize(Markers)); } GalleryItems.Clear(); foreach (var image in Images) { GalleryItems.Add(new GalleryModel() { Title = image.Name, Width = image.Preview.Width, Height = image.Preview.Height }); } }
public async void LoadGallery(string galleryType) { currentGalleryType = galleryType; string gallery = await networkManager.LoadGalleryAsync(Username, SessionId, galleryType); if (GalleryItems != null) { GalleryItems.Clear(); } GalleryItems = JsonConvert.DeserializeObject <List <GalleryControl.GalleryItem> >(gallery, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); }