public void undoClick() { Bitmap lastImage = (Bitmap)undoRedo.GetFromUndoBuffer(); if (lastImage != null) { undoRedo.AddToRedoBuffer((Bitmap)model.getMainImage().Clone()); model.setMainImage(lastImage); lastImage = (Bitmap)lastImage.Clone(); } if (channelsOn) { this.showChannelsClick(); } else { this.view.ShowImage(model.getMainImage(), model.getImageName()); } }