A question of design

S

Sid Price

Hello,

I have struggled with this question for many years and have so far not come
up with what I consider a good answer. Consider one is designing a windows
forms based application using vb.net. The main form of the application has a
number of sets of controls that provide the GUI for particular application
functions. One can design a class hierarchy that reflects the functions of
the various sets of controls and hides the logic of the processing from the
rest of the application. To achieve this the main form either has to
intercept and pass-off events to the various objects encapsulating the logic
of the controls or pass references to the controls to the classes and let
them handle the events directly.

I find both of these methods create too tight a dependency between the main
form and the logic of each control set. Is there a better way? Is there a
way to continue using the forms' editor to create the layout of the form and
have the controls encapsulated in the processing classes?

Any suggestions or pointers to reading materials would be much appreciated,
Sid.
 
G

Guest

I find both of these methods create too tight a dependency between the
main form and the logic of each control set. Is there a better way? Is
there a way to continue using the forms' editor to create the layout
of the form and have the controls encapsulated in the processing
classes?

How about UserControls or Plug Ins?

I'm currently using CabUI which is pre-packaged combination of both and it
works well.
 
S

Sid Price

Spam Catcher said:
How about UserControls or Plug Ins?

I see a similar issue with a User Control although to a lesser extent.

Not sure I understand how a plug in would help; would you care to expand on
that?
I'm currently using CabUI which is pre-packaged combination of both and it
works well.

I googled CabUI and found nothing, what is it?

Thanks again,
Sid.
 
G

Guest

Not sure I understand how a plug in would help; would you care to
expand on that?

With plugins you can dynamically add/remove services/controls as needed.

A event broker of sorts could solve the need to pass references around -
you would register each plugin with the event broker with the events it
needs to be notified about.
I googled CabUI and found nothing, what is it?

Take a look at Composite UI from microsoft practices:

practices.gotdotnet.com/projects/cab

CAB UI has all the plugin loading, event broker, layout engine, etc stuff
all built. You just provide the main form + individual plugins.
 
G

GhostInAK

Hello Sid,

How about creating properties (of type delegate) so that you can push data
out (instead of the usual pull model).

Something like.. in the business class:

public delegate UpdateStatusDelegate(byval tStatus as string)

public property UpdateStatus as UpdateStatusDelegate
get.. end get.. set.. end set
end property


then in your form.. wire up the property to your updater method..

private sub DoStatusUpdate(byval tStatus as string)
oTxtStatus.Text = tstatus
end sub

sub form_load ()

Dim tSomeBusnessObj as BusinessClass = New BusinessClass

tSomeBusinessObj.UpdateStatus = New BusinessClass.UpdateStatusDelegate(Me.DoStatusUpdate)

end sub



as for the busness objects pulling from the UI.. well.. that's just not done.
ever.


-Boo
 
G

Guest

I really appreciate you taking the time to help out; however the
component you suggested is for .NET 2005 and Framework 2.0 and I am
using 2003 and Framework 1.1 at this time.

Also the URL given is incorrect, the URL direct to MS is
http://www.microsoft.com/downloads/details.aspx?FamilyID=b619276a-2e9e-
47c6-8893-f8e5f88fd8dd&DisplayLang=en


http://practices.gotdotnet.com/projects/cab is the correct URL ... it's the
team URL.

Yes, the framework is for 2.0 - but it might give you some ideas for 1.1.

Another possiblity is to build your app using a set of distributed service
(remoting or web service) - your winform app will connect to individual
services as needed to fetch data.
 

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

Top