N
Norvin Laudon
Hi,
I find in the typical applications I develop in C#, I have a UI form, and a
bunch of my own classes (instances of which are used in the forms).
Almost always, these child classes need interaction with the UI. Some need
to display something to the user, and others need to get input from the
user.
Consequently, in my forms, I find myself writing tonnes of events (which can
be raised by the class to pass some info to the form), and simple
"forwarding" method calls (i.e. when someone clicks a button on the form,
the event handler for that button simply calls a method on the child class).
Lots of extra code for no observable benefit...
Does anyone ever take the approach of having the UI (or parts of it)
globally accessible by all classes? Any pitfalls to this approach? (Is it
even possible?)
Just looking for ways to cut out all the extra code...
Thanks,
Norvin
I find in the typical applications I develop in C#, I have a UI form, and a
bunch of my own classes (instances of which are used in the forms).
Almost always, these child classes need interaction with the UI. Some need
to display something to the user, and others need to get input from the
user.
Consequently, in my forms, I find myself writing tonnes of events (which can
be raised by the class to pass some info to the form), and simple
"forwarding" method calls (i.e. when someone clicks a button on the form,
the event handler for that button simply calls a method on the child class).
Lots of extra code for no observable benefit...
Does anyone ever take the approach of having the UI (or parts of it)
globally accessible by all classes? Any pitfalls to this approach? (Is it
even possible?)
Just looking for ways to cut out all the extra code...
Thanks,
Norvin