我不想在多读的方案拟订或技术方面经历过,因此,我要问,这一问题是如何集中设计,以完成一些用户行动实时启动的相对长期工作(4至10秒)的以下要求:
- After the job is initiated and until it completes:
- * Show some indeterminate progress indicator (ie, spinning ball, progress bar)
- * Show a running count of the elapsed number of seconds as part of a status update
- Use an MVVM design with the status and notion of IsBusy being data bound properties in some INPC view model class
- Unit testable
I started down the path of trying to use a BackgroundWorker that is either subclassed or otherwise encapsulated, but found myself getting tripped up on how to synchronize the notion of counting the elapsed seconds on a timer thread while another thread is doing the work.
设计可能导致更有重点的方案拟定问题的想法,值得高度赞赏!
Cheers,
Berryl