How to implement undo / redo of files displayed in tree view

Can anyone give an idea of ​​how I should perform undo / redo / copy / paste of files (dirs, subdirs) displayed as a tree in C #?

It would be great to have some code examples.

-1


source to share


3 answers


For a quick linear undo / redo you can use the Memento pattern using the zip file as the memento.



+1


source


Consider the implementation of the Command Pattern (GoF):



  • Place your action logic in classes that implement the generic ICommand {Do (); Undo ();}.
  • In each custom action, you create the requested command object and initialize it with context parameters such as the new and old filename.
  • Calling Do (), push the object onto the completed command stack.
  • Each command is provided with a context, so by calling Undo () it can modify changes.
  • Consider moving the files to a temporary folder instead of deleting them.
+7


source


Undo / redo is usually done using what is called a "command pattern". Search on Google or read the following article:

http://blogs.vbcity.com/jspano/articles/198.aspx

+5


source







All Articles