Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Make a return function button for the operation of ShapeNode (Read 3488 times)
JackPan
Full Member
***
Offline


I Love MindFusion!

Posts: 134
Joined: Apr 9th, 2020
Make a return function button for the operation of ShapeNode
Sep 28th, 2020 at 6:39am
Print Post  
Hi, there Smiley

I want to implement a function:
When a ShapeNode is created in the figure, all subsequent operations on the ShapeNode will be saved. Just to be able to click the back button to have the function of returning to the previous step of all operations on this ShapeNode. If you keep clicking the return button, the final effect is to return to the time when this ShapeNode was not created.

Any assistance would be appreciated.

Cheers,

Jack
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Make a return function button for the operation of ShapeNode
Reply #1 - Sep 28th, 2020 at 6:57am
Print Post  
Hi,

You can achieve that by using the built-in Undo and Redo functionality. For specifics on how to use it, you can refer to our documentation here: https://www.mindfusion.eu/onlinehelp/wpfdiagram/index.htm?CC_Undo_and_Redo_0.htm

Regards,
Lyubo
MindFusion
  
Back to top
 
IP Logged
 
JackPan
Full Member
***
Offline


I Love MindFusion!

Posts: 134
Joined: Apr 9th, 2020
Re: Make a return function button for the operation of ShapeNode
Reply #2 - Oct 19th, 2020 at 12:35pm
Print Post  
Hi, Lyubo. Smiley

I have read the content in the link, but I don't understand it very well. Would you help me write an example for me to learn from? My project needs it very much. Smiley

Best regards. Smiley
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Make a return function button for the operation of ShapeNode
Reply #3 - Oct 22nd, 2020 at 1:09pm
Print Post  
Hi,

This topic explains how to use the UndoManager to enable the undo/redo functionality: https://www.mindfusion.eu/onlinehelp/wpfdiagram/index.htm?CC_Undo_Manager_0.htm.

After the undo history is enabled by setting Diagram.UndoManager.UndoEnabled to true, undoing or redoing interactive changes to diagram items is as easy as calling the Diagram.UndoManager.Undo() and Diagram.UndoManager.Redo() methods respectively. You can call those from button event handlers.

If you wish to track property changes to the items set via code, you will need to implement ChangeItem commands. Explanation with examples on how to do that is explained in this documentation topic: https://www.mindfusion.eu/onlinehelp/wpfdiagram/index.htm?CC_Undo_or_Redo_of_Pro...

When changes are recorded in that way, they can be undone/redone the same way as built-in actions - via the Undo/Redo methods on the UndoManager object.

Regards,
Lyubo
MindFusion
  
Back to top
 
IP Logged
 
JackPan
Full Member
***
Offline


I Love MindFusion!

Posts: 134
Joined: Apr 9th, 2020
Re: Make a return function button for the operation of ShapeNode
Reply #4 - Oct 23rd, 2020 at 1:44am
Print Post  
Thank you for giving me such useful material. Smiley

Best regards to you.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint