' Copyright And Detail -------------------------------------------------------------------------------------
' Name: GN.NavigationBar.WizardPage
' Author: Gary Noble
' Date: 09/01/2006
'
' Requires: GNWizardFrameWorkPageCollection
'
' Copyright � 2005 Gary Noble
' --------------------------------------------------------------------------------------
'
' Holds All The Related Data For A WizardPage
'
' --------------------------------------------------------------------------------------
' 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
#Region "Imports"
Imports System
Imports System.ComponentModel.Design.Serialization
Imports System.Globalization
Imports System.Reflection
#End Region
Namespace GNWizardFrameWork
#Region " WizardPage Type "
Public Enum PageStyle
eWPS_Interior
eWPS_Exterior
End Enum
#End Region
''' -----------------------------------------------------------------------------
''' Project : GNWizardFrameWork
''' Class : Winforms.UIStudio.Controls.Wizard.WizardPage
'''
''' -----------------------------------------------------------------------------
''' <summary>
''' Wizard Page Item
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [G_Noble] 13/03/2006 Created
''' </history>
''' -----------------------------------------------------------------------------
<Serializable(), TypeConverter(GetType(WizardTypeConverter)),ToolboxBitmap(GetType(GNWizardFrameWork.WizardPage))> _
Public Class WizardPage
Inherits System.Windows.Forms.Panel
#Region " Declares "
'-- Docked Panel Control
'-- We Use With Events As We Need To Determine If The Control Dock
'-- State <> None
'-- See: "Panel Control Events"
'-- Selected Flag
Private m_bSelected As Boolean = False
'-- Display Text/Caption
Private m_sText As String = "Wizard Item"
Private m_sSubText As String = "Panel Item"
'-- Visiblity Flag
Private m_bVisible As Boolean = False
'-- Page style
Private m_PageStyle As PageStyle = PageStyle.eWPS_Interior
'-- Buttons
Private m_bHasPreviousButton As Boolean = False
Private m_bHasNextButton As Boolean = False
Private m_bHasFinishButton As Boolean = False
Private m_bHasCancelButton As Boolean = True
#End Region
#Region " Properties "
#Region "Friend"
''' -----------------------------------------------------------------------------
''' <summary>
''' Main Header caption for pages with interior Pagestyle
''' </summary>
''' <value></value>
''' <remarks>
''' </remarks>
''' <history>
''' [G_Noble] 21/03/2006 Created
''' </history>
''' -----------------------------------------------------------------------------
<Description("Main Header caption for pages with interior Pagestyle")> _
Public Property HeaderCaption() As String
Get
Return m_sText
End Get
Set(ByVal Value As String)
m_sText = Value
OnItemChanged(Me, New EventArgs)
End Set
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' Sub header caption for pages with interior Pagestyle
''' </summary>
''' <value></value>
''' <remarks>
''' </remarks>
''' <history>
''' [G_Noble] 21/03/2006 Created
''' </history>
''' -----------------------------------------------------------------------------
<Description("Sub header caption for pages with interior Pagestyle")> _
Public Property SubHeaderCaption() As String
Get
Return m_sSubText
End Get
Set(ByVal Value As String)
m_sSubText = Value
OnItemChanged(Me, New EventArgs)
End Set
End Property
#End Region
#Region "Public"
''' -----------------------------------------------------------------------------
''' <summary>
''' Sets the page Style (Interior or Exterior)
''' </summary>
''' <value></value>
''' <remarks>
''' </remarks>
''' <history>
''' [G_Noble] 21/03/2006 Created
''' </history>
''' -----------------------------------------------------------------------------
<Description("Sets the page Style (Interior or Exterior)")> _
Public Property PageStyle() As PageStyle
Get
Return m_PageStyle
End Get
Set(ByVal Value As PageStyle)
m_PageStyle = Value
OnItemChanged(Me, New EventArgs)
End Set
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' Enables/Disables The Next Button
''' </summary>
''' <value></value>
''' <remarks>
''' </remarks>
''' <history>
''' [G_Noble] 21/03/2006 Created
''' </history>
''' -----------------------------------------------------------------------------
<Description("Enables/Disables The Next Button")> _
Public Property HasNextButton() As Boolean
Get
Return m_bHasNextButton
End Get
Set(ByVal Value As Boolean)
m_bHasNextButton = Value
Me.OnNextButtonStateChange(Me, Value)
End Set
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' Enables/Disables The Previous Button
''' </summary>
''' <value></value>
''' <remarks>
''' </remarks>
''' <history>
''' [G_Noble] 21/03/2006 Created
''' </history>
''' -----------------------------------------------------------------------------
<Description("Enables/Disables The Previous Button")> _
Public Property HasPreviousButton() As Boolean
Get
Return m_bHasPreviousButton
End Get
Set(ByVal Value As Boolean)
m_bHasPreviousButton = Value
Me.OnPreviousButtonStateChange(Me, Value)
End Set
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' Enables/Disables The Finish Button
''' </summary>
''' <value></value>
''' <remarks>
''' </remarks>
''' <history>
''' [G_Noble] 21/03/2006 Created
''' </history>
''' -----------------------------------------------------------------------------
<Description("Enables/Disables The Finish Button")> _
Public Property HasFinishButton() As Boolean
Get
Return m_bHasFinishButton
End Get
Set(ByVal Value As Boolean)
m_bHasFinishButton = Value
Me.OnFinishButtonStateChange(Me, Value)
End Set
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' Enables/Disables The Cancel Button
''' </summary>
''' <value></value>
''' <remarks>
''' </remarks>
''' <history>
''' [G_Noble] 21/03/2006 Created
''' </history>
''' -----------------------------------------------------------------------------
<Description("Enables/Disables The Cancel Button")> _
Public Property HasCancelButton() As Boolean
Get
Return m_bHasCancelButton
End Get
Set(ByVal Value As Boolean)
m_bHasCancelButton = Value
Me.OnCancelButtonStateChange(Me, Value)
End Set
End Property
#End Region
#End Region
#Region " Collection Events "
Public Event ItemChanged(ByVal sender As Object, ByVal e As EventArgs)
Protected Friend Sub OnItemChanged(ByVal sender As Object, ByVal e As EventArgs)
RaiseEvent ItemChanged(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 " Finalize "
Protected Overrides Sub Finalize()
MyBase.Finalize()
End Sub
#End Region
#Region " Panel Dock Change Event "
''' -----------------------------------------------------------------------------
''' <summary>
''' Make sure the panels docked state = dockstyle.none
''' The wizard Will handle the sizing of the controls
''' </summary>
''' <param name="e"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [G_Noble] 13/03/2006 Created
''' </history>
''' -----------------------------------------------------------------------------
Protected Overrides Sub OnDockChanged(ByVal e As System.EventArgs)
Me.Dock = DockStyle.None
End Sub
#End Region
End Class
#Region " Type Converters "
Friend Class WizardTypeConverter
Inherits TypeConverter
Public Overloads Overrides Function CanConvertTo(ByVal context As ITypeDescriptorContext, ByVal destType As Type) As Boolean
If destType Is GetType(InstanceDescriptor) Then
Return True
End If
Return MyBase.CanConvertTo(context, destType)
End Function
Public Overloads Overrides Function ConvertTo(ByVal context As ITypeDescriptorContext, ByVal culture As CultureInfo, ByVal value As Object, ByVal destType As Type) As Object
If destType Is GetType(InstanceDescriptor) AndAlso (TypeOf value Is WizardPage) Then
Dim col As WizardPage = CType(value, WizardPage)
Dim ci As ConstructorInfo = GetType(WizardPage).GetConstructor(New Type() {})
Return New InstanceDescriptor(ci, New Object() {}, False)
End If
Return MyBase.ConvertTo(context, culture, value, destType)
End Function
End Class
#End Region
End Namespace