我必须在 EXT.NET 中实现一个进度条。我在处理交易时有一个命令“Process”。我必须跟踪失败和成功的事务和事务的总数。例如。 “总共有60笔交易。12笔交易失败,48笔交易成功”)。
我现在的问题是,我可以使用命令模式来实现它吗?我不是要代码,但我想知道它是否有意义。
这样做的原因是我必须为赋值实现一些设计模式。
(http://en.wikipedia.org/wiki/Command_pattern 其中一个应用程序是进度条)
附言:
如果有人有使用命令模式实现的进度条的示例,请随意发布:P
最佳答案
来自 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.
如果你看这个:
调用者可以执行一系列命令。每个命令对象都有一个 getEstimatedDuration() 知道大约需要多长时间。这样,每次执行命令时,您都可以使用 getEstimatedDuration() 的返回值更新进度条。
关于c# - 带有命令模式部分 -1 的进度条 C#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9261433/