DeselectFunction.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using PaintDotNet.Measurement.HistoryMementos;
  2. namespace PaintDotNet.Measurement.HistoryFunctions
  3. {
  4. public sealed class DeselectFunction : HistoryFunction
  5. {
  6. public static string StaticName
  7. {
  8. get
  9. {
  10. return PdnResources.GetString("DeselectAction.Name");
  11. }
  12. }
  13. public static ImageResource StaticImage
  14. {
  15. get
  16. {
  17. return PdnResources.GetImageResource("Icons.MenuEditDeselectIcon.png");
  18. }
  19. }
  20. public override HistoryMemento OnExecute(IDocumentWorkspace historyWorkspace)
  21. {
  22. if (historyWorkspace.GetSelection().IsEmpty)
  23. {
  24. return null;
  25. }
  26. else
  27. {
  28. SelectionHistoryMemento sha = new SelectionHistoryMemento(StaticName, StaticImage, historyWorkspace);
  29. EnterCriticalRegion();
  30. historyWorkspace.GetSelection().Reset();
  31. return sha;
  32. }
  33. }
  34. public DeselectFunction()
  35. : base(PaintDotNet.Measurement.Enum.ActionFlags.None)
  36. {
  37. }
  38. }
  39. }