Using observer paradigm to make my AutoCAD VB.NET program truly OOP

Using observer paradigm to make my AutoCAD VB.NET program truly OOP

Anonymous
Not applicable
515 Views
1 Reply
Message 1 of 2

Using observer paradigm to make my AutoCAD VB.NET program truly OOP

Anonymous
Not applicable
Wondering if someone could show me how to implement an observer pattern for AutoCAD programming in VB.NET?

Currently I have a lot of working Autocad code in VB6 which the company wants me to migrate to VB.NET. Well, that would
normally be straightforward ... yes? Unfortunately, not so in our case.... recently, our company decided that I need
to modify it to implement the MVC (Model View Controller) paradigm to make it truly OOP.

Currently, my move was to start with a simple one, opening a form and then grabbing the name of the drawing and putting
it as the caption of the form... now, that is easy... I simply put in the form_load event the .getvariable("dwgname") and I am done....

The problem lies in trying to implement observer patterns ... in the observer pattern I cannot simply call .getvariable("dwgname")
from the form_load event instead, I need to use objects that would use an interface to register themselves as observers as
the form loads but not necessary having to be residing in the form_load event... in fact ... if there is somehow a way for me
to make such a thing happen before the code goes through the form_load event then that would more completely separate
the View layer from the controller layer which gets implemented through the use of observers and observer related patterns.

I did a search for MVC but got nothing returned but Im hoping that someone viewing this new thread might have come across it
and please give me a clue how it can be done... thank you so much for all the kind help you could give ... all suggestions welcome

Gratefully,
Matt
0 Likes
516 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Hi,

I would like to help, but I don't find it really clear what you are trying to explain...

1. You should not do anything in the Form Load, instead for maybe calling Controller.ModelToView or something like that.
2. Readiing out your variable and placing it on the View needs to happen in the Controller
3. If you want anything done before the Form Load, you can do that in the constructor

What you are trying to do with the observers, I don't understand. Perhaps you should be a bit more clear, or post a simple code sample...

--

http://cupocadnet.blogspot.com Edited by: bert.vanpeteghem@dolmen.be on May 11, 2009 12:35 PM
0 Likes