public void LoadNewImagesFromFolder(string rootFolderPath, bool resizeImages) { string webSizeFolderPath = Path.Combine(rootFolderPath, "WebSize"); string fullSizeFolderPath = Path.Combine(rootFolderPath, "FullSize"); string thumbnailFolderPath = Path.Combine(rootFolderPath, "Thumbnails"); _view.ThumbnailFolderPath = thumbnailFolderPath; string[] fullSizeImageFullPaths = _fileIo.GetFiles(fullSizeFolderPath, "*.JPG"); var images = new ImagesDataSet(); foreach (string fullSizeImageFullPath in fullSizeImageFullPaths) { string fileName = Path.GetFileName(fullSizeImageFullPath); Image fullSizeImage = _fileIo.ImageFromFile(fullSizeImageFullPath); if (resizeImages) { string webSizeImageFullPath = Path.Combine(webSizeFolderPath, fileName); string thumbnailImageFullPath = Path.Combine(thumbnailFolderPath, fileName); _imageResizer.SaveScaledImage(fullSizeImage, GetReductionFactor(fullSizeImage, ThumbnailMaxDimension), thumbnailImageFullPath); _imageResizer.SaveScaledImage(fullSizeImage, GetReductionFactor(fullSizeImage, WebSizeMaxDimension), webSizeImageFullPath); } //Need to figure out if there's any value to having these flags and remove them from the data set if there isn't bool hasFullSize = true; //We always start with a full size. Maybe the thought is that we don't publish it? bool hasThumbnail = true; //I don't know why I wouldn't have a thumbnail DateTime dateTaken = _imagePropertyFacade.GetDateTaken(fullSizeImage).Value; images.Images.AddImagesRow(Guid.NewGuid(), fileName, Path.GetFileNameWithoutExtension(fullSizeImageFullPath), dateTaken, hasThumbnail, hasFullSize, null); fullSizeImage.Dispose(); } _view.Images = images; }
public void LoadImagesFromIndexFile() { var ds = new ImagesDataSet(); ds.ReadXml(_view.IndexFileName); _view.Images = ds; }