how to control application context?

  • Thread starter Thread starter Peter Rilling
  • Start date Start date
P

Peter Rilling

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 might want to try to wrap your mind around the enterprise library. it
will do all that for you but it will bring complexity that like of which you
will scarcely imagine. Not to mention various obscure bugs.

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Professional VSTO.NET - Wrox/Wiley 2006
 
This article may help. I wrote my own class which uses the same
paradigm...only took a day and it saves me a lot of headaches now.

http://msdn.microsoft.com/msdnmag/issues/02/10/CommandManagement/default.aspx

-sb


Alvin Bruney said:
You might want to try to wrap your mind around the enterprise library. it
will do all that for you but it will bring complexity that like of which
you will scarcely imagine. Not to mention various obscure bugs.

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Professional VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------

Peter Rilling said:
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?
 
Peter Rilling said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top