"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:Oy**************@TK2MSFTNGP04.phx.gbl...
As the app that I am developing gets more complex, it is getting harder to
manage state and ensure that the menus and controls have the correct
enabled/disabled state.
One thing that I do not like is to have each control talk to all other
controls and menus to determine the state of menus and such. What I need
is some kind of controlling mechanism. Does anyone know of any frameworks
that help coordinate application contexts?
You should be able to encapsulate your controlling mechanism into one
object. Your UI will act primarily as an event listener. This object raises
events, listens to events raised by the business layer and also has methods
like OnTabChanged or event a generic OnStateChanged() that can be called by
your UI. All the logic about deciding what should be enabled, disabled,
visible etc is within this object. A simple example would be where you have
2 menu items where only one should be enabled at a time based on what tab
the user has selected. So now your tab changed event tells this object "a
tab has changed and this is the selected tab". This object raises a
UiStateChanged event to all listening UI controls. The UI controls ask this
object "should I be enabled or disabled?".
SP