LittleFunny
LittleFunny

Reputation: 8405

Xamarin: ICommand is this related to Command Pattern

Hello I am working a drawing application which allow user to draw strokes to the screen using Xamarin Form. Function I will need is: Add, Remove, Clear, and Undo. In xamarin, there is an interface called ICommand, but it only Execute method and have no unexecute related function. If I need to do a undo command, I will have to stored all those command and pop then call the unexecute the command again. Does ICommand is part of the command pattern or a completely different thing.

Upvotes: 1

Views: 254

Answers (1)

Prashant Cholachagudda
Prashant Cholachagudda

Reputation: 13092

The ICommand helps you implement the Command patterns in your app. We have an implementation in Xamarin.Forms called Xamarin.Forms.Command that you can use

The command pattern by definition does not maintain the stack of executed commands, but it helps you to do that to implement undo feature. (ref: https://en.wikipedia.org/wiki/Command_pattern#Uses)

Upvotes: 1

Related Questions