Link CodeSample - Testing Browser dependency of LinkParameters

From Visual WebGui Wiki

Jump to: navigation, search

Overview

This is the test code used for browser dependency test of LinkParameters for Link.Open

VB.NET Code

Imports Gizmox.WebGui.Forms
 
Public Class LinkTest
    Friend WithEvents btnOpen As Gizmox.WebGui.Forms.Button
    Friend WithEvents Label1 As Gizmox.WebGui.Forms.Label
    Friend WithEvents txtTarget As Gizmox.WebGui.Forms.TextBox
    Friend WithEvents txtSize1 As Gizmox.WebGui.Forms.TextBox
    Friend WithEvents txtSize2 As Gizmox.WebGui.Forms.TextBox
    Friend WithEvents Label2 As Gizmox.WebGui.Forms.Label
    Friend WithEvents chkMenuBar As Gizmox.WebGui.Forms.CheckBox
    Friend WithEvents chkToolBar As Gizmox.WebGui.Forms.CheckBox
    Friend WithEvents chkStatusBar As Gizmox.WebGui.Forms.CheckBox
    Friend WithEvents chkTitleBar As Gizmox.WebGui.Forms.CheckBox
    Friend WithEvents chkLocationBar As Gizmox.WebGui.Forms.CheckBox
    Friend WithEvents Label3 As Gizmox.WebGui.Forms.Label
    Friend WithEvents chkFullScreen As Gizmox.WebGui.Forms.CheckBox
    Friend WithEvents cboWindowStyle As Gizmox.WebGui.Forms.ComboBox
    Friend WithEvents Label4 As Gizmox.WebGui.Forms.Label
    Friend WithEvents Label5 As Gizmox.WebGui.Forms.Label
    Friend WithEvents txtLocation1 As Gizmox.WebGui.Forms.TextBox
    Friend WithEvents txtLocation2 As Gizmox.WebGui.Forms.TextBox
    Friend WithEvents Label6 As Gizmox.WebGui.Forms.Label
    Friend WithEvents txtParm1 As Gizmox.WebGui.Forms.TextBox
    Friend WithEvents chkResizable As Gizmox.WebGui.Forms.CheckBox
    Friend WithEvents chkScrollbars As Gizmox.WebGui.Forms.CheckBox
 
    Sub New()
        MyBase.New()
 
        ' This call is required by the Windows Form Designer.
        InitializeComponent()
 
        ' Add any initialization after the InitializeComponent() call.
        Me.btnOpen = New Gizmox.WebGui.Forms.Button
        Me.Label1 = New Gizmox.WebGui.Forms.Label
        Me.txtTarget = New Gizmox.WebGui.Forms.TextBox
        Me.txtSize1 = New Gizmox.WebGui.Forms.TextBox
        Me.txtSize2 = New Gizmox.WebGui.Forms.TextBox
        Me.Label2 = New Gizmox.WebGui.Forms.Label
        Me.chkMenuBar = New Gizmox.WebGui.Forms.CheckBox
        Me.chkToolBar = New Gizmox.WebGui.Forms.CheckBox
        Me.chkStatusBar = New Gizmox.WebGui.Forms.CheckBox
        Me.chkTitleBar = New Gizmox.WebGui.Forms.CheckBox
        Me.chkLocationBar = New Gizmox.WebGui.Forms.CheckBox
        Me.Label3 = New Gizmox.WebGui.Forms.Label
        Me.chkFullScreen = New Gizmox.WebGui.Forms.CheckBox
        Me.cboWindowStyle = New Gizmox.WebGui.Forms.ComboBox
        Me.Label4 = New Gizmox.WebGui.Forms.Label
        Me.Label5 = New Gizmox.WebGui.Forms.Label
        Me.txtLocation1 = New Gizmox.WebGui.Forms.TextBox
        Me.txtLocation2 = New Gizmox.WebGui.Forms.TextBox
        Me.Label6 = New Gizmox.WebGui.Forms.Label
        Me.txtParm1 = New Gizmox.WebGui.Forms.TextBox
        Me.chkResizable = New Gizmox.WebGui.Forms.CheckBox
        Me.chkScrollbars = New Gizmox.WebGui.Forms.CheckBox
        Me.SuspendLayout()
        '
        'btnOpen
        '
        Me.btnOpen.Location = New System.Drawing.Point(12, 21)
        Me.btnOpen.Name = "btnOpen"
        Me.btnOpen.Size = New System.Drawing.Size(75, 23)
        Me.btnOpen.TabIndex = 0
        Me.btnOpen.Text = "Link.Open"
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(119, 26)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(100, 23)
        Me.Label1.TabIndex = 2
        Me.Label1.Text = "Target"
        '
        'txtTarget
        '
        Me.txtTarget.Location = New System.Drawing.Point(202, 23)
        Me.txtTarget.Name = "txtTarget"
        Me.txtTarget.Size = New System.Drawing.Size(100, 20)
        Me.txtTarget.TabIndex = 1
        '
        'txtSize1
        '
        Me.txtSize1.Location = New System.Drawing.Point(159, 118)
        Me.txtSize1.Name = "txtSize1"
        Me.txtSize1.Size = New System.Drawing.Size(100, 20)
        Me.txtSize1.TabIndex = 3
        '
        'txtSize2
        '
        Me.txtSize2.Location = New System.Drawing.Point(265, 118)
        Me.txtSize2.Name = "txtSize2"
        Me.txtSize2.Size = New System.Drawing.Size(100, 20)
        Me.txtSize2.TabIndex = 4
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(3, 119)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(150, 23)
        Me.Label2.TabIndex = 6
        Me.Label2.Text = "Size"
        Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'chkMenuBar
        '
        Me.chkMenuBar.Checked = True
        Me.chkMenuBar.CheckState = Gizmox.WebGui.Forms.CheckState.Unchecked
        Me.chkMenuBar.FlatStyle = Gizmox.WebGui.Forms.FlatStyle.Standard
        Me.chkMenuBar.Location = New System.Drawing.Point(383, 13)
        Me.chkMenuBar.Name = "chkMenuBar"
        Me.chkMenuBar.Size = New System.Drawing.Size(104, 24)
        Me.chkMenuBar.TabIndex = 8
        Me.chkMenuBar.Text = "MenuBar"
        Me.chkMenuBar.ThreeState = False
        '
        'chkToolBar
        '
        Me.chkToolBar.Checked = True
        Me.chkToolBar.CheckState = Gizmox.WebGui.Forms.CheckState.Unchecked
        Me.chkToolBar.FlatStyle = Gizmox.WebGui.Forms.FlatStyle.Standard
        Me.chkToolBar.Location = New System.Drawing.Point(383, 43)
        Me.chkToolBar.Name = "chkToolBar"
        Me.chkToolBar.Size = New System.Drawing.Size(104, 24)
        Me.chkToolBar.TabIndex = 9
        Me.chkToolBar.Text = "ToolBar"
        Me.chkToolBar.ThreeState = False
        '
        'chkStatusBar
        '
        Me.chkStatusBar.Checked = True
        Me.chkStatusBar.CheckState = Gizmox.WebGui.Forms.CheckState.Unchecked
        Me.chkStatusBar.FlatStyle = Gizmox.WebGui.Forms.FlatStyle.Standard
        Me.chkStatusBar.Location = New System.Drawing.Point(383, 73)
        Me.chkStatusBar.Name = "chkStatusBar"
        Me.chkStatusBar.Size = New System.Drawing.Size(104, 24)
        Me.chkStatusBar.TabIndex = 10
        Me.chkStatusBar.Text = "StatusBar"
        Me.chkStatusBar.ThreeState = False
        '
        'chkTitleBar
        '
        Me.chkTitleBar.Checked = True
        Me.chkTitleBar.CheckState = Gizmox.WebGui.Forms.CheckState.Unchecked
        Me.chkTitleBar.FlatStyle = Gizmox.WebGui.Forms.FlatStyle.Standard
        Me.chkTitleBar.Location = New System.Drawing.Point(383, 104)
        Me.chkTitleBar.Name = "chkTitleBar"
        Me.chkTitleBar.Size = New System.Drawing.Size(104, 24)
        Me.chkTitleBar.TabIndex = 11
        Me.chkTitleBar.Text = "TitleBar"
        Me.chkTitleBar.ThreeState = False
        '
        'chkLocationBar
        '
        Me.chkLocationBar.Checked = True
        Me.chkLocationBar.CheckState = Gizmox.WebGui.Forms.CheckState.Unchecked
        Me.chkLocationBar.FlatStyle = Gizmox.WebGui.Forms.FlatStyle.Standard
        Me.chkLocationBar.Location = New System.Drawing.Point(383, 135)
        Me.chkLocationBar.Name = "chkLocationBar"
        Me.chkLocationBar.Size = New System.Drawing.Size(104, 24)
        Me.chkLocationBar.TabIndex = 12
        Me.chkLocationBar.Text = "LocationBar"
        Me.chkLocationBar.ThreeState = False
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(119, 49)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(222, 18)
        Me.Label3.TabIndex = 12
        Me.Label3.Text = "(Try _blank, _popup, _self, _parent, _top)"
        '
        'chkFullScreen
        '
        Me.chkFullScreen.Checked = False
        Me.chkFullScreen.CheckState = Gizmox.WebGui.Forms.CheckState.Unchecked
        Me.chkFullScreen.FlatStyle = Gizmox.WebGui.Forms.FlatStyle.Standard
        Me.chkFullScreen.Location = New System.Drawing.Point(383, 166)
        Me.chkFullScreen.Name = "chkFullScreen"
        Me.chkFullScreen.Size = New System.Drawing.Size(104, 24)
        Me.chkFullScreen.TabIndex = 13
        Me.chkFullScreen.Text = "FullScreen"
        Me.chkFullScreen.ThreeState = False
        '
        'cboWindowStyle
        '
        Me.cboWindowStyle.BorderStyle = Gizmox.WebGui.Forms.BorderStyle.Fixed3D
        Me.cboWindowStyle.Items.AddRange(New Object() {"Normal", "Modal", "ModeLess"})
        Me.cboWindowStyle.Location = New System.Drawing.Point(159, 91)
        Me.cboWindowStyle.Name = "cboWindowStyle"
        Me.cboWindowStyle.Size = New System.Drawing.Size(121, 21)
        Me.cboWindowStyle.TabIndex = 2
        Me.cboWindowStyle.Text = "Normal"
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(3, 94)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(150, 23)
        Me.Label4.TabIndex = 15
        Me.Label4.Text = "Window Style"
        Me.Label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(3, 145)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(150, 23)
        Me.Label5.TabIndex = 16
        Me.Label5.Text = "Location"
        Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'txtLocation1
        '
        Me.txtLocation1.Location = New System.Drawing.Point(159, 144)
        Me.txtLocation1.Name = "txtLocation1"
        Me.txtLocation1.Size = New System.Drawing.Size(100, 20)
        Me.txtLocation1.TabIndex = 5
        '
        'txtLocation2
        '
        Me.txtLocation2.Location = New System.Drawing.Point(265, 144)
        Me.txtLocation2.Name = "txtLocation2"
        Me.txtLocation2.Size = New System.Drawing.Size(100, 20)
        Me.txtLocation2.TabIndex = 6
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(2, 168)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(151, 23)
        Me.Label6.TabIndex = 17
        Me.Label6.Text = "Parameter ""Test"" value"
        Me.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'txtParm1
        '
        Me.txtParm1.Location = New System.Drawing.Point(159, 170)
        Me.txtParm1.Name = "txtParm1"
        Me.txtParm1.Size = New System.Drawing.Size(206, 20)
        Me.txtParm1.TabIndex = 7
        '
        'chkResizable
        '
        Me.chkResizable.Checked = False
        Me.chkResizable.CheckState = Gizmox.WebGui.Forms.CheckState.Unchecked
        Me.chkResizable.FlatStyle = Gizmox.WebGui.Forms.FlatStyle.Standard
        Me.chkResizable.Location = New System.Drawing.Point(383, 197)
        Me.chkResizable.Name = "chkResizable"
        Me.chkResizable.Size = New System.Drawing.Size(104, 24)
        Me.chkResizable.TabIndex = 18
        Me.chkResizable.Text = "Resizable"
        Me.chkResizable.ThreeState = False
        '
        'chkScrollbars
        '
        Me.chkScrollbars.Checked = False
        Me.chkScrollbars.CheckState = Gizmox.WebGui.Forms.CheckState.Unchecked
        Me.chkScrollbars.FlatStyle = Gizmox.WebGui.Forms.FlatStyle.Standard
        Me.chkScrollbars.Location = New System.Drawing.Point(383, 228)
        Me.chkScrollbars.Name = "chkScrollbars"
        Me.chkScrollbars.Size = New System.Drawing.Size(104, 24)
        Me.chkScrollbars.TabIndex = 19
        Me.chkScrollbars.Text = "ScrollBars"
        Me.chkScrollbars.ThreeState = False
        '
        'LinkTest
        '
        Me.Controls.Add(Me.chkScrollbars)
        Me.Controls.Add(Me.chkResizable)
        Me.Controls.Add(Me.txtParm1)
        Me.Controls.Add(Me.Label6)
        Me.Controls.Add(Me.txtLocation2)
        Me.Controls.Add(Me.txtLocation1)
        Me.Controls.Add(Me.Label5)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.cboWindowStyle)
        Me.Controls.Add(Me.chkFullScreen)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.chkLocationBar)
        Me.Controls.Add(Me.chkTitleBar)
        Me.Controls.Add(Me.chkStatusBar)
        Me.Controls.Add(Me.chkToolBar)
        Me.Controls.Add(Me.chkMenuBar)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.txtSize2)
        Me.Controls.Add(Me.txtSize1)
        Me.Controls.Add(Me.txtTarget)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.btnOpen)
        Me.Size = New System.Drawing.Size(556, 270)
        Me.Text = "LinkTest"
        Me.ResumeLayout(False)
 
    End Sub
    Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
        Dim objLinkParamters As LinkParameters = New LinkParameters
        objLinkParamters.Target = txtTarget.Text
        If txtSize1.Text.Length > 0 And txtSize2.Text.Length > 0 Then
            Dim s As System.Drawing.Size = New System.Drawing.Size(txtSize1.Text, txtSize2.Text)
            objLinkParamters.Size = s
        End If
        If txtLocation1.Text.Length > 0 And txtLocation2.Text.Length > 0 Then
            Dim l As System.Drawing.Size = New System.Drawing.Size(txtLocation1.Text, txtLocation2.Text)
            objLinkParamters.Location = l
        End If
        objLinkParamters.ShowLocationBar = chkLocationBar.Checked
        objLinkParamters.ShowMenuBar = chkMenuBar.Checked
        objLinkParamters.ShowStatusBar = chkStatusBar.Checked
        objLinkParamters.ShowTitleBar = chkTitleBar.Checked
        objLinkParamters.ShowToolBar = chkToolBar.Checked
        objLinkParamters.FullScreen = chkFullScreen.Checked
        objLinkParamters.Resizable = chkResizable.Checked
        objLinkParamters.ScrollBars = chkScrollbars.Checked
        If cboWindowStyle.Text = "Modal" Then
            objLinkParamters.WindowStyle = LinkWindowStyle.ModalWindow
        ElseIf cboWindowStyle.Text = "Modeless" Then
            objLinkParamters.WindowStyle = LinkWindowStyle.ModelessWindow
        ElseIf cboWindowStyle.Text = "Normal" Then
            objLinkParamters.WindowStyle = LinkWindowStyle.Normal
        End If
        If txtParm1.Text.Length > 0 Then
            objLinkParamters.QueryString("Test") = txtParm1.Text
        End If
        Link.Open("http://www.google.com", objLinkParamters)
 
 
    End Sub
End Class

C# Code

Personal tools