Forráskód Böngészése

ComPDFKit.Tool(win) - 补充undo redo 结束编辑模式逻辑,防止undoredo失效

liyijie 4 hónapja
szülő
commit
945ed28f60

+ 35 - 24
Demo/Examples/ComPDFKit.Tool/UndoManger/PDFEditHistory/PDFEditHistory.cs

@@ -3,32 +3,43 @@ using ComPDFKitViewer.Helper;
 
 namespace ComPDFKit.Tool.UndoManger
 {
-	public class PDFEditHistory : IHistory
-	{
-		public CPDFEditPage EditPage { get; set; }
-		public int PageIndex {  get; set; }
-		public bool Redo()
-		{
-			if(EditPage!=null && EditPage.IsValid())
-			{
-				return EditPage.Redo();
-			}
-			
-			return false;
-		}
+    public class PDFEditHistory : IHistory
+    {
+        public CPDFEditPage EditPage { get; set; }
+        public int PageIndex { get; set; }
+        public bool Redo()
+        {
+            if (EditPage != null && EditPage.IsValid())
+            {
+                bool result = EditPage.Redo();
+                if (result)
+                {
+                    EditPage.EndEdit();
+                }
+                return result;
+
+            }
 
-		public bool Undo()
-		{
-			if(EditPage!=null && EditPage.IsValid())
-			{
-				return EditPage.Undo();
-			}
-			return false;
-		}
+            return false;
+        }
+
+        public bool Undo()
+        {
+            if (EditPage != null && EditPage.IsValid())
+            {
+                bool result = EditPage.Undo();
+                if (result)
+                {
+                    EditPage.EndEdit();
+                }
+                return result;
+            }
+            return false;
+        }
 
-		public void Check(IHistory changeItem, bool undo, bool redo, bool add)
+        public void Check(IHistory changeItem, bool undo, bool redo, bool add)
         {
 
-		}
-	}
+        }
+    }
 }