NullHistoryMemento.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. /////////////////////////////////////////////////////////////////////////////////
  2. // Paint.NET //
  3. // Copyright (C) dotPDN LLC, Rick Brewster, Tom Jackson, and contributors. //
  4. // Portions Copyright (C) Microsoft Corporation. All Rights Reserved. //
  5. // See src/Resources/Files/License.txt for full licensing and attribution //
  6. // details. //
  7. // . //
  8. /////////////////////////////////////////////////////////////////////////////////
  9. using System;
  10. namespace PaintDotNet.Measurement.HistoryMementos
  11. {
  12. /// <summary>
  13. /// This history action doesn't really do anything. It is useful for putting in a
  14. /// "New Image" placeholder, since the first item in the undo stack can't really
  15. /// be "undone".
  16. /// NullHistoryMemento instances are also not undoable.
  17. /// </summary>
  18. public class NullHistoryMemento : HistoryMemento
  19. {
  20. protected override HistoryMemento OnUndo()
  21. {
  22. throw new InvalidOperationException("NullHistoryMementos are not undoable");
  23. }
  24. public NullHistoryMemento(string name, ImageResource image)
  25. : base(name, image)
  26. {
  27. }
  28. }
  29. }