質問

I have to implement a progressbar in EXT.NET. I have a command "Process" as in processing a transaction. I have to keep track of the total number of transactions and transactions that failed and succeeded. E.g. "There are in total 60 transactions. 12 have failed and 48 have succeeded").

My question now is, can I use command pattern to implement this? I am not asking for the code, but I want to know if it makes sense.

The reason for this is that I have to implement some design patterns for assignment.

(http://en.wikipedia.org/wiki/Command_pattern one of the applications is progressbar)

PS:

If anyone has an example of a progressbar implemented with a command pattern feel free to post :P

役に立ちましたか?

解決

A clip from here:

Progress bars Suppose a program has a sequence of commands that it executes in order. If each command object has a getEstimatedDuration() method, the program can easily estimate the total duration. It can show a progress bar that meaningfully reflects how close the program is to completing all the tasks.

If you look at this:

enter image description here

The invoker can have a series of commands to execute. Each command object has a getEstimatedDuration() that knows approximately how long time it takes. This way every time a command has executed you can update the progressbar with the return value of getEstimatedDuration().

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top