Here is a problem I often come across:
I start building my app and define eve开发者_JAVA百科nt handlers for changes in the UI, e.g. a user uses a select list -> event triggered -> event handled.
At some point I want to programmatically make changes to the UI and if those changes trigger events, handlers go off without any way of controlling them.
Is there some way around this?
Consider a smarter command implementation. Instead of having the logic directly in UI event handlers, you keep them dumb, and only executing certain tasks via command functions/classes/dispatcher/.. anything you want. Then prior to making your changes to UI, you can instruct command dispatcher to not run certain task, in any way suits you.
精彩评论