469,275 Members | 1,497 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,275 developers. It's quick & easy.

Multiple undo/redo implementation in C#?

I'm looking for some information (books, articles, tutorials) on how to
implement a multiple undo/redo framework. I'm a beginner in this so I prefer
information specifically targeting C# with code samples. Is seems that the
'Command Pattern' is the way to achieve it (?).
If you know any good resources I would be very happy to know!

Thank you very much!,
Teis
Nov 16 '05 #1
3 7527
Hi Teis,

It depends on your program as there is no universal solution.
Here are some hints:
The idea is, that you store all actions you want to undo (in some sort of
collection).
When user wants to undo, you go through stored actions in reverse order and
undo actions one by one.
Of course, you'll have to provide undo/redo functionality.

I don't know of any resources, sorry.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"Teis Draiby" <te*************@draiby.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I'm looking for some information (books, articles, tutorials) on how to
implement a multiple undo/redo framework. I'm a beginner in this so I prefer information specifically targeting C# with code samples. Is seems that the
'Command Pattern' is the way to achieve it (?).
If you know any good resources I would be very happy to know!

Thank you very much!,
Teis

Nov 16 '05 #2
"Teis Draiby" <te*************@draiby.com> wrote:
I'm looking for some information (books, articles,
tutorials) on how to implement a multiple undo/redo
framework. [...]


I use two classes, an UndoFrame (representing an action that was performed)
and an UndoStack. The UndoStack has two regular C# Stack objects: an undo
stack and a redo stack.

When the user carries out an action, push its new UndoFrame onto the undo
stack and clear the redo stack. When the user undoes an action, pop the undo
stack and push the action being undone onto the redo stack.

If this isn't enough information, mail me and I'll send you some code.

P.
Nov 16 '05 #3
Hi Paul
If this isn't enough information, mail me and I'll send you some code. Oh, yes please! I've found some articles out there but not much sample
code - so I'd like to
see some examples.
You can mail me at: teisATdraibyDOTcom

regards, Teis

----- Original Message -----
From: "Paul E Collins" <fi******************@CL4.org>
Newsgroups: microsoft.public.dotnet.languages.csharp
Sent: Saturday, April 24, 2004 5:14 PM
Subject: Re: Multiple undo/redo implementation in C#?

"Teis Draiby" <te*************@draiby.com> wrote:
I'm looking for some information (books, articles,
tutorials) on how to implement a multiple undo/redo
framework. [...]
I use two classes, an UndoFrame (representing an action that was

performed) and an UndoStack. The UndoStack has two regular C# Stack objects: an undo
stack and a redo stack.

When the user carries out an action, push its new UndoFrame onto the undo
stack and clear the redo stack. When the user undoes an action, pop the undo stack and push the action being undone onto the redo stack.

If this isn't enough information, mail me and I'll send you some code.

Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Jay | last post: by
5 posts views Thread by Mickel Grönroos | last post: by
2 posts views Thread by Tony Nelson | last post: by
2 posts views Thread by Christian H | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.