/// <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); } }