public static void LoadImages() { var retrievedImages = DatabaseService.GetAllImages(); ImageCollection.Clear(); foreach (var dao in retrievedImages) { var img = ImageEncodingService.Base64ToSKImage(dao.Base64); var galleryImageEntry = new ImageEntry(img, dao.Name, dao.CreationTime, dao.Id); if (ImageCollection.ContainsKey(dao.CreationTime.Date)) { ImageCollection[dao.CreationTime.Date].Add(galleryImageEntry); } else { ImageCollection.Add(dao.CreationTime.Date, new GalleryImageSection(dao.CreationTime.Date)); ImageCollection[dao.CreationTime.Date].Add(galleryImageEntry); } } }
private void LaunchTimelineView() { var timelineStoryBoard = UIStoryboard.FromName(Constants.TimeLineStoryboardName, null); if (!(timelineStoryBoard.InstantiateInitialViewController() is TimeLineViewController timelineViewController)) { return; } var imageEntries = (from imgIndex in GalleryDataSource.SelectedImageIndexPaths select GalleryDataSource.ImageCollection.Values[imgIndex.Section] .Values[(int)imgIndex.Item] .Id ?? 0 into selectedImageId select DatabaseService.GetImage(selectedImageId) into imageDao select new ImageEntry(ImageEncodingService.Base64ToSKImage(imageDao.Base64), imageDao.Name, imageDao.CreationTime, imageDao.Id, imageDao.Observations.Select(obs => obs.ToObservation()))) .ToList(); timelineViewController.InputImageEntries = imageEntries; NavigationController.PushViewController(timelineViewController, true); }
private void LaunchSingleImageView() { var resultsPageStoryBoard = UIStoryboard.FromName(Constants.SingleImageStoryboardName, null); if (!(resultsPageStoryBoard.InstantiateInitialViewController() is SingleImageViewController resultsViewController)) { return; } var selectedImageIndexPath = GalleryDataSource.SelectedImageIndexPaths.First(); var selectedImageId = GalleryDataSource.ImageCollection.Values[selectedImageIndexPath.Section] .Values[(int)selectedImageIndexPath.Item].Id ?? 0; var imageDao = DatabaseService.GetImage(selectedImageId); resultsViewController.InputImageEntry = new ImageEntry( ImageEncodingService.Base64ToSKImage(imageDao.Base64), imageDao.Name, imageDao.CreationTime, imageDao.Id, imageDao.Observations.Select(obs => obs.ToObservation())); NavigationController.PushViewController(resultsViewController, true); }