Public Class ExplorerForm1

    

    ''' <summary>
    ''' Loads the tree view
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub FillTree()
        '-- Establish Locals
        Dim loNode As TreeNode

        '-- Clearing any existing tree nodes
        Me.TreeView1.Nodes.Clear()

        '-- Populate a battery parent node
        loNode = New TreeNode("Battery", 0, 0)
        loNode.Tag = New TreeNodeInfo(TreeNodeType.Battery)
        Me.TreeView1.Nodes.Add(loNode)

        '-- Populate an angel parent node
        loNode = New TreeNode("Angel", 1, 1)
        loNode.Tag = New TreeNodeInfo(TreeNodeType.Angel)
        Me.TreeView1.Nodes.Add(loNode)

        '-- Populate an angel parent node
        loNode = New TreeNode("Clock", 2, 2)
        loNode.Tag = New TreeNodeInfo(TreeNodeType.Clock)
        Me.TreeView1.Nodes.Add(loNode)

    End Sub

    Public Sub New()

        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        FillTree()
    End Sub

    Private Sub TreeView1_AfterSelect(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
        Select Case CType(e.Node.Tag, TreeNodeInfo).Type
            Case TreeNodeType.Angel
                Me.PanelManager1.SetActivePage(Me.PageAngel)

            Case TreeNodeType.Battery
                Me.PanelManager1.SetActivePage(Me.PageBattery)

            Case TreeNodeType.Clock
                Me.PanelManager1.SetActivePage(Me.PanelManagerPage1)
        End Select
    End Sub

    Private Sub CustomersBO1_ParentFormLoading() Handles CustomersBO1.ParentFormLoading
        Me.CustomersBO1.FillTop100()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.ThemedDetailWindow1.Items("CustomerName").Value = String.Format("{0}, {1}", Me.CustomersBO1.cust_LastName, Me.CustomersBO1.cust_FirstName)
        Me.ThemedDetailWindow1.Items(1).Value = Me.CustomersBO1.cust_Address1
        Me.ThemedDetailWindow1.Items(2).Value = Me.CustomersBO1.cust_City & ", " & Me.CustomersBO1.cust_State & "  " & Me.CustomersBO1.cust_Postal
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        '-- Show the wait window
        Me.MyWaitWindow.ShowWaitWindow("Processing...", "Working, please wait...")

        System.Threading.Thread.Sleep(1000)

        Dim lnIndex As Integer

        For lnIndex = 0 To 1000
            MyWaitWindow.Message = "Processing " & lnIndex.ToString("n0") & " of " & "1,000, please wait..."
        Next

        Me.MyWaitWindow.HideWaitWindow()

        'Me.bwLoop.RunWorkerAsync()
    End Sub

    Private Sub bwLoop_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bwLoop.DoWork
        Dim lnIndex As Integer


        For lnIndex = 0 To 1000
            MyWaitWindow.Message = "Processing " & lnIndex.ToString("n0") & " of " & "1,000, please wait..."
        Next

        Me.MyWaitWindow.HideWaitWindow()
    End Sub
End Class

''' <summary>
''' Tree note item information class
''' </summary>
''' <remarks></remarks>
Public Class TreeNodeInfo

#Region " Declare Privates "

    Private _Type As TreeNodeType

#End Region

#Region " Public Properties "

    ''' <summary>
    ''' The type of node
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Property Type() As TreeNodeType
        Get
            Return _Type
        End Get
        Set(ByVal value As TreeNodeType)
            _Type = value
        End Set
    End Property

#End Region

#Region " Constructors "

    ''' <summary>
    ''' Basic / Primary Constructor
    ''' </summary>
    ''' <param name="ItemTypeArg"></param>
    ''' <remarks></remarks>
    Public Sub New(ByVal ItemTypeArg As TreeNodeType)
        _Type = ItemTypeArg
    End Sub

#End Region

End Class

Public Enum TreeNodeType As Integer
    Battery = 0
    Angel = 1
    Clock = 2
End Enum