public MainWindow() { InitializeComponent(); _uiPageList = new UiPageList(this); //Set the data binding btn_NextPage.DataContext = _uiPageList.Paging; btn_PreviousPage.DataContext = _uiPageList.Paging; //Create an FramesForYourPicsLogic instance _logic = new FramesForYourPicsLogic(); }
/// <summary> /// Clears all the temprory folders and images in cache /// </summary> private void ClearAllTemproryData(UiPageList pageList) { //Clear the page list pageList.Clear(); //If a scaled directory is not empty lets delete it and create a new one DeletaAndCreateDirectory(Constants.TempScaledFilesFolder); //If a merged directory is not empty lets delete it and creat a new one DeletaAndCreateDirectory(Constants.TempMergedFilesFolder); _lastTimeMissingPhotos = 0; }
/// <summary> /// Merge all the photos in the photo list with the specified frame and save them to the temp folder /// </summary> private void MergePhotosWithFrame(UiPageList pageList) { foreach (var photo in pageList.GetPages().SelectMany(page => page)) { //Merge the photo to the frame using (Image img = Image.FromFile(photo.PicturePath), frameImg = Image.FromFile(_framePath)) { var outputImage = ImageManipulationUtils.MergePhotoAndFrame(img, frameImg); //Save the merged image to the hard drive the number of times specified by the user for (var i = 0; i < photo.NumberOfTimes; i++) { //Create the merged photo path var mergedPhotoTempPath = Constants.TempMergedFilesFolder + Path.GetFileNameWithoutExtension(photo.PicturePath) + "_" + i + Constants.OutputFileType; //Create the temp directory Directory.CreateDirectory(Constants.TempMergedFilesFolder); //Save the merged photo outputImage.Save(mergedPhotoTempPath, ImageFormat.Jpeg); } } } }
public PagingData(UiPageList container) { _container = container; }