/// <summary> /// Playback an image. /// </summary> private void PlaybackImage(Guid pictureId) { var filenameResolver = this.CreateFilenameResolver(pictureId); var pictureIOManager = new PictureIOManager(filenameResolver); ImageStateData imageStateData = pictureIOManager.LoadImageStateData(); this.SetOrientationForImage(imageStateData); var canvasPlayback = new CanvasPlayback(filenameResolver.MasterCanvasRecorderFilename(imageStateData.CurrentSavePoint)); this.SetOrientationForImage(imageStateData); // Simply instantiate the class derived from monogame:game and away we go... ToolboxLayoutDefinition layoutDefinition = imageStateData.Width > imageStateData.Height ? this.toolboxLayoutManager.PlaybackLandscapeToolboxLayout : this.toolboxLayoutManager.PlaybackPortraitToolboxLayout; this.playBackApp = new CanvasPlaybackApp(canvasPlayback, imageStateData, layoutDefinition, this.deviceScale); this.playBackApp.Exiting += CanvasPlaybackAppExiting; this.playBackApp.Run(); }
/// <summary> /// Deletes the current image from the file list and updates the display. /// </summary> private void DeleteCurrentImageFromFileListAndUpdateDisplay() { var filenameResolver = this.CreateFilenameResolver(this.PictureIdFromFile(this.currentFileIndex)); var pictureIOManager = new PictureIOManager(filenameResolver); pictureIOManager.DeleteImage(); this.fileList.RemoveAt(this.currentFileIndex); this.fileListLength--; if (this.fileListLength == 0) { // we've just deleted the last image! foreach (var image in this.imageViewList) { image.Image = null; } } else { // remove the current image from screen. // copy the first image into the middle (current) image // then scroll to the next image int previousImageIndex = (this.currentFileIndex == 0) ? this.fileListLength - 1 : this.currentFileIndex - 1; this.LoadImageWithIndex(1, previousImageIndex); this.currentFileIndex = previousImageIndex; this.scrollView.SetContentOffset(new PointF(this.imageViewList[2].Frame.X, 0), true); } }
/// <summary> /// Edits a specific image. /// </summary> /// <param name='pictureId'> /// Unique ID referencing the specific image we want to edit /// </param> /// <param name='imageStateData'> /// Image state data for this image - if null then it will be read from disk (so should not be null for new images) /// </param> private void EditImage(Guid pictureId, ImageStateData imageStateData = null) { var filenameResolver = this.CreateFilenameResolver(pictureId); var pictureIOManager = new PictureIOManager(filenameResolver); pictureIOManager.CreateDirectoryStructure(); if (imageStateData == null) { imageStateData = pictureIOManager.LoadImageStateData(); } this.SetOrientationForImage(imageStateData); BusyMessageDisplay busyMessageDisplay = new BusyMessageDisplay("Saving", "Please wait..."); // Simply instantiate the class derived from monogame:game and away we go... ToolboxLayoutDefinition layoutDefinition = imageStateData.Width > imageStateData.Height ? this.toolboxLayoutManager.PaintLandscapeToolboxLayout : this.toolboxLayoutManager.PaintPortraitToolboxLayout; this.paintApp = new PaintApp(pictureIOManager, filenameResolver, imageStateData, busyMessageDisplay, layoutDefinition, this.deviceScale); this.paintApp.Exiting += PaintAppExiting; this.paintApp.Run(); }
/// <summary> /// Copies the image and all associated data /// </summary> /// <returns>Filename for the newly created image</returns> /// <param name='pictureId'> /// Identifier of the image to copy /// </param> private string CopyImage(Guid pictureId) { var existingFileFilenameResolver = this.CreateFilenameResolver(pictureId); var pictureIOManager = new PictureIOManager(existingFileFilenameResolver); var newFileFilenameResolver = this.CreateFilenameResolver(Guid.NewGuid()); pictureIOManager.CopyImage(newFileFilenameResolver); return newFileFilenameResolver.MasterImageFilename; }