Part 4 Using
our interface Generator
For this we
will create a simple Web project to use our interface generator.
Because we
cant use resources for our images that we will be using on the web page we need
to add these to the Web project the images are in a file called “images.zip” in
the attached file, the complete Web Project with the images is in a file called
“WizardTest.zip” in the attached file.
Using our
interface generator is really simple; we create a Web project and add a
Placeholder called PropertyHolder to the page. We the create an instance of our
business object, once we have our business object we create an instance of our
interface generator passing it our business object in the .ctor., the Interface
Generator is declared withevents so that we can handle the ValuesUpdated event.
…
Dim WithEvents Generator As Wizard.Control.Prototype.InterfaceGenerator
…
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page
here
TestObject = New
Customer
Generator
= New
Wizard.Control.Prototype.InterfaceGenerator(TestObject)
PropertyHolder.Controls.Add(Generator)
If IsPostBack Then
PropertyHolder.Visible = False
End
If
End
Sub
…
For the test
when the event is triggered we display the values to the user.
Private Sub
Generator_ValuesUpdated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Generator.ValuesUpdated
TestObject = Generator.WizardObject
Response.Write("<P>The Following Properties Values now exist in the
Object:</P>")
Response.Write(TestObject.Active & "<BR>")
Response.Write(TestObject.Address1 & "<BR>")
Response.Write(TestObject.Address2 & "<BR>")
Response.Write(TestObject.City & "<BR>")
Response.Write(TestObject.Contact & "<BR>")
Response.Write(TestObject.CreditLimit & "<BR>")
Response.Write(TestObject.Number & "<BR>")
Response.Write(TestObject.Phone & "<BR>")
Response.Write(TestObject.Postal & "<BR>")
End
Sub
Now that was
cool wasn’t it!