Paint.PictureStateManager.Undo C# (CSharp) Method

Undo() public method

Undo the most recent change
public Undo ( ) : void
return void
        public void Undo()
        {
            if (this.UndoEnabled == false)
            {
                return;
            }

            if (this.changesMadeSinceLastSave == true)
            {
                // temporarily increase the current save point by one and save - then set it back as
                // we are performing an undo.
                this.ImageStateData.IncrementSavePoint();
                this.StoreSavePointData();
                this.changesMadeSinceLastSave = false;
                this.ImageStateData.ResetLastSavePoint();
            }

            this.ImageStateData.DecrementSavePoint();
            this.StoreWorkingImageStateData();
            this.LoadSavePointData();

            this.RedoEnabled = true;

            if (this.ImageStateData.CurrentSavePoint == this.ImageStateData.FirstSavePoint)
            {
                // we are at the beginning - no more undo's available.
                this.UndoEnabled = false;
            }
            else
            {
                this.UndoEnabled = true;
            }
        }