GroupHistory.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using ComPDFKitViewer.Helper;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace ComPDFKit.Tool.UndoManger
  8. {
  9. public class GroupHistory : IHistory
  10. {
  11. public List<IHistory> Histories { get; set; } = new List<IHistory>();
  12. public bool Redo()
  13. {
  14. if (Histories != null && Histories.Count > 0)
  15. {
  16. bool success = true;
  17. foreach (IHistory history in Histories)
  18. {
  19. success &= history.Redo();
  20. }
  21. return success;
  22. }
  23. return false;
  24. }
  25. public bool Undo()
  26. {
  27. if (Histories != null && Histories.Count > 0)
  28. {
  29. bool success = true;
  30. foreach (IHistory history in Histories)
  31. {
  32. success &= history.Undo();
  33. }
  34. return success;
  35. }
  36. return false;
  37. }
  38. public void Check(IHistory checkItem, bool undo, bool redo, bool add)
  39. {
  40. }
  41. }
  42. }