' Copyright And Detail -------------------------------------------------------------------------------------
' Name: GN.NavigationBar.WizardPageCollection
' Author: Gary Noble
' Date: 09/01/2006
'
' Requires: GN.Winforms.UIStudio.Controls.NavigationBar
'
' Copyright � 2005 Gary Noble
' --------------------------------------------------------------------------------------
'
' Holds All The Related Data For The WizardPages
'
' --------------------------------------------------------------------------------------
' History:
'
' --------------------------------------------------------------------------------------
' Date User Detail
' --------------------------------------------------------------------------------------
'
' 09/01/2006 Gary Noble Created
'
' --------------------------------------------------------------------------------------
'
' ********* If You Use This Control Please Give Credit *********
'
' --------------------------------------------------------------------------------------
' Copyright (c) 2005/6 Gary Noble
' ---------------------------------------------------------------------
'
' Redistribution and use in source and binary forms, with or
' without modification, are permitted provided that the following
' conditions are met:
'
' 1. Redistributions of source code must retain the above copyright
' notice, this list of conditions and the following disclaimer.
'
' 2. Redistributions in binary form must reproduce the above copyright
' notice, this list of conditions and the following disclaimer in
' the documentation and/or other materials provided with the distribution.
'
' 3. The end-user documentation included with the redistribution, if any,
' must include the following acknowledgment:
'
' "This product includes software developed by Gary Noble"
'
' Alternately, this acknowledgment may appear in the software itself, if
' and wherever such third-party acknowledgments normally appear.
'
' THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES,
' INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
' AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
' GARY NOBLE OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
' INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
' BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
' USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
' THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
' (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
' THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'
' ---------------------------------------------------------------------
Option Strict On
Namespace GNWizardFrameWork
''' -----------------------------------------------------------------------------
''' Project : GNWizardFrameWork
''' Class : Winforms.UIStudio.Controls.Wizard.WizardPageCollection
'''
''' -----------------------------------------------------------------------------
''' <summary>
''' Holds All The WizardPage Details, And Handles All The Events
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [G_Noble] 13/03/2006 Created
''' </history>
''' -----------------------------------------------------------------------------
<Designer("System.Windows.Forms.Design.ControlDesigner, System.Design", _
GetType(IDesigner)), Serializable()> _
Public Class WizardPageCollection
Inherits CollectionBase
#Region " Properties "
''' -----------------------------------------------------------------------------
''' <summary>
''' Returns The Panelitem Relevant To The Index
''' </summary>
''' <param name="index"></param>
''' <value></value>
''' <remarks>
''' </remarks>
''' <history>
''' [G_Noble] 09/01/2006 Created
''' </history>
''' -----------------------------------------------------------------------------
Default Public Property Item(ByVal index As Integer) As WizardPage
Get
Return CType(List(index), WizardPage)
End Get
Set(ByVal Value As WizardPage)
List(index) = Value
OnChanged(Me, New EventArgs)
End Set
End Property
#End Region
#Region " Functions "
''' -----------------------------------------------------------------------------
''' <summary>
''' Initiates or Set A WizardPage And Adds It To The Collection
''' </summary>
''' <param name="value"></param>
''' <value></value>
''' <remarks>
''' </remarks>
''' <history>
''' [G_Noble] 09/01/2006 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Function Add(ByVal value As WizardPage) As Integer
Dim result As Integer
Try
result = List.Add(value)
'-- Add The Event Handlers To Callback Events To The Control
AddHandler value.ItemChanged, AddressOf OnChanged
AddHandler value.FinishButtonStateChange, AddressOf OnFinishButtonStateChange
AddHandler value.NextButtonStateChange, AddressOf OnNextButtonStateChange
AddHandler value.CancelButtonStateChange, AddressOf OnCancelButtonStateChange
AddHandler value.PreviousButtonStateChange, AddressOf OnPreviousButtonStateChange
'-- Raise The Changed Event
OnChanged(Me, New EventArgs)
'-- Raise The Added Event
OnAdded(value)
Catch ex As Exception
' Throw ex
End Try
Return result
End Function
''' -----------------------------------------------------------------------------
''' <summary>
''' Collection IndexOf Function
''' </summary>
''' <param name="value"></param>
''' <returns></returns>
''' <remarks>
''' </remarks>
''' <history>
''' [G_Noble] 09/01/2006 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Function IndexOf(ByVal value As WizardPage) As Integer
Return List.IndexOf(value)
End Function
''' -----------------------------------------------------------------------------
''' <summary>
''' Collection Contains Function
''' </summary>
''' <param name="value"></param>
''' <returns></returns>
''' <remarks>
''' </remarks>
''' <history>
''' [G_Noble] 09/01/2006 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Function Contains(ByVal value As WizardPage) As Boolean
Return List.Contains(value)
End Function
#End Region
#Region " Events "
Public Event Added(ByVal sender As Object)
Protected Friend Sub OnAdded(ByVal sender As Object)
RaiseEvent Added(sender)
End Sub
Public Event Changed(ByVal sender As Object, ByVal e As EventArgs)
Protected Friend Sub OnChanged(ByVal sender As Object, ByVal e As EventArgs)
RaiseEvent Changed(sender, e)
End Sub
Public Event ItemRemoved(ByVal sender As Object, ByVal e As EventArgs) ', ByVal IsSelected As Boolean, ByVal IsVisible As Boolean, ByVal IsToolbarItem As Boolean)
Protected Friend Sub OnItemRemoved(ByVal sender As Object, ByVal e As EventArgs) ', ByVal IsSelected As Boolean, ByVal IsVisible As Boolean, ByVal IsToolbarItem As Boolean)
RaiseEvent ItemRemoved(sender, e) ', IsSelected, IsVisible, IsToolbarItem)
RaiseEvent Changed(sender, e)
End Sub
Public Event CancelButtonStateChange(ByVal sender As Object, ByVal bEnabled As Boolean)
Protected Friend Sub OnCancelButtonStateChange(ByVal sender As Object, ByVal bEnabled As Boolean)
RaiseEvent CancelButtonStateChange(sender, bEnabled)
End Sub
Public Event NextButtonStateChange(ByVal sender As Object, ByVal bEnabled As Boolean)
Protected Friend Sub OnNextButtonStateChange(ByVal sender As Object, ByVal bEnabled As Boolean)
RaiseEvent NextButtonStateChange(sender, bEnabled)
End Sub
Public Event PreviousButtonStateChange(ByVal sender As Object, ByVal bEnabled As Boolean)
Protected Friend Sub OnPreviousButtonStateChange(ByVal sender As Object, ByVal bEnabled As Boolean)
RaiseEvent PreviousButtonStateChange(sender, bEnabled)
End Sub
Public Event FinishButtonStateChange(ByVal sender As Object, ByVal bEnabled As Boolean)
Protected Friend Sub OnFinishButtonStateChange(ByVal sender As Object, ByVal bEnabled As Boolean)
RaiseEvent FinishButtonStateChange(sender, bEnabled)
End Sub
#End Region
#Region " Subs "
''' -----------------------------------------------------------------------------
''' <summary>
''' Collection Insert Function
''' </summary>
''' <param name="index"></param>
''' <param name="value"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [G_Noble] 09/01/2006 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Sub Insert(ByVal index As Integer, ByVal value As WizardPage)
List.Insert(index, value)
OnChanged(Me, New EventArgs)
End Sub
''' -----------------------------------------------------------------------------
''' <summary>
''' Removes A PanelItem From The Collection
''' </summary>
''' <param name="value"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [G_Noble] 09/01/2006 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Sub Remove(ByVal value As WizardPage)
Try
Dim o As Control
Try
If Not value Is Nothing Then
value.Visible = False
o.Parent.Parent.Controls.Add(value)
End If
Catch ex As Exception
End Try
'-- Raise The Remove Event
OnItemRemoved(value, New EventArgs)
List.Remove(value)
value = Nothing
Catch ex As Exception
'Throw New Exception("No Item Selected", ex)
End Try
End Sub
''' -----------------------------------------------------------------------------
''' <summary>
''' Collection Insert Complete Event
''' </summary>
''' <param name="index"></param>
''' <param name="value"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [G_Noble] 09/01/2006 Created
''' </history>
''' -----------------------------------------------------------------------------
Protected Overrides Sub OnInsertComplete(ByVal index As Integer, ByVal value As Object)
RaiseEvent Added(value)
End Sub
''' -----------------------------------------------------------------------------
''' <summary>
''' Finialize
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [G_Noble] 09/01/2006 Created
''' </history>
''' -----------------------------------------------------------------------------
Protected Overrides Sub Finalize()
'-- Add The Event Handlers To Callback Events To The Control
MyBase.Finalize()
End Sub
#End Region
#Region " Constructor "
Public Sub New()
MyBase.new()
End Sub
#End Region
End Class
End Namespace