Home All Groups Group Topic Archive Search About
Author
26 Sep 2006 4:48 PM
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.

Author
26 Sep 2006 5:53 PM
Spam Catcher
"Sid Price" <s**@nowhere.com> wrote in
news:#FJJQuY4GHA.2264@TK2MSFTNGP02.phx.gbl:

> 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.
Author
26 Sep 2006 8:11 PM
Sid Price
"Spam Catcher" <spamhoneypot@rogers.com> wrote in message
news:Xns984A8D5267C78usenethoneypotrogers@127.0.0.1...
> "Sid Price" <s**@nowhere.com> wrote in
> news:#FJJQuY4GHA.2264@TK2MSFTNGP02.phx.gbl:
> 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.
Author
26 Sep 2006 8:39 PM
Spam Catcher
"Sid Price" <s**@nowhere.com> wrote in
news:eJGOEga4GHA.2264@TK2MSFTNGP06.phx.gbl:

> 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'm currently using CabUI which is pre-packaged combination of both
>> and it works well.
>>
>
> 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.
Author
26 Sep 2006 9:42 PM
Sid Price
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

Any other suggestions would be much appreciated,
Sid.


Show quoteHide quote
"Spam Catcher" <spamhoneypot@rogers.com> wrote in message
news:Xns984AA94EB2663usenethoneypotrogers@127.0.0.1...
> "Sid Price" <s**@nowhere.com> wrote in
> news:eJGOEga4GHA.2264@TK2MSFTNGP06.phx.gbl:
>
>> 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'm currently using CabUI which is pre-packaged combination of both
>>> and it works well.
>>>
>>
>> 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.
Author
27 Sep 2006 5:31 PM
Spam Catcher
"Sid Price" <s**@nowhere.com> wrote in
news:ewvC8Sb4GHA.512@TK2MSFTNGP06.phx.gbl:

> 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.
Author
26 Sep 2006 11:03 PM
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

Show quoteHide quote
> 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.
>