
Public Class CustomerBrowse
    Inherits MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialog

#Region " Declare Privates "

    Private BrowseResultsPopulationSettings1 As New MicroFour.StrataFrame.UI.Windows.Forms.BrowseResultsPopulationSettings
    Private BrowseColumnItem1 As New MicroFour.StrataFrame.UI.Windows.Forms.BrowseColumnItem
    Private BrowseColumnItem2 As New MicroFour.StrataFrame.UI.Windows.Forms.BrowseColumnItem
    Private BrowseColumnItem3 As New MicroFour.StrataFrame.UI.Windows.Forms.BrowseColumnItem
    Private BrowseDialogLayoutSettings1 As New MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogLayoutSettings
    Private SearchFieldItem1 As New MicroFour.StrataFrame.UI.Windows.Forms.SearchFieldItem
    Private SearchFieldItem2 As New MicroFour.StrataFrame.UI.Windows.Forms.SearchFieldItem
    Private SearchFieldItem3 As New MicroFour.StrataFrame.UI.Windows.Forms.SearchFieldItem
    Private _Images As New System.Windows.Forms.ImageList()

#End Region
    

    ''' <summary>
    ''' Basic Constructor
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub New()
        LoadImages()

        InitControl()
    End Sub

    ''' <summary>
    ''' Loads the images intot he image list
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub LoadImages()
        _Images.ColorDepth = ColorDepth.Depth32Bit
        _Images.Images.Add(My.Resources.User_16)
    End Sub

    ''' <summary>
    ''' Initializes the browse dialog control
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub InitControl()
        '-- Associate the image list
        Me.BrowseResultsImageList = _Images

        '-- Define the browse columns
        BrowseColumnItem1.ColumnHeaderText = "Customer Name"
        BrowseColumnItem1.ColumnHeaderWidth = 150
        BrowseColumnItem1.ColumnTextAlignment = System.Windows.Forms.HorizontalAlignment.Left
        BrowseColumnItem1.DefaultSort = System.Windows.Forms.SortOrder.Ascending
        BrowseColumnItem1.FormatString = "{1}, {0}"
        BrowseColumnItem1.PopulationType = MicroFour.StrataFrame.UI.ListViewColumnPopulationType.FormattedString
        BrowseColumnItem1.RegExPattern = ""
        BrowseColumnItem1.RegExReplacementValue = ""
        BrowseColumnItem2.ColumnHeaderText = "Address"
        BrowseColumnItem2.ColumnHeaderWidth = 150
        BrowseColumnItem2.ColumnTextAlignment = System.Windows.Forms.HorizontalAlignment.Left
        BrowseColumnItem2.DefaultSort = System.Windows.Forms.SortOrder.None
        BrowseColumnItem2.FormatString = "{2}"
        BrowseColumnItem2.PopulationType = MicroFour.StrataFrame.UI.ListViewColumnPopulationType.FormattedString
        BrowseColumnItem2.RegExPattern = ""
        BrowseColumnItem2.RegExReplacementValue = ""
        BrowseColumnItem3.ColumnHeaderText = "Location"
        BrowseColumnItem3.ColumnHeaderWidth = 200
        BrowseColumnItem3.ColumnTextAlignment = System.Windows.Forms.HorizontalAlignment.Left
        BrowseColumnItem3.DefaultSort = System.Windows.Forms.SortOrder.None
        BrowseColumnItem3.FormatString = "{3}, {4}  {5}"
        BrowseColumnItem3.PopulationType = MicroFour.StrataFrame.UI.ListViewColumnPopulationType.FormattedString
        BrowseColumnItem3.RegExPattern = ""
        BrowseColumnItem3.RegExReplacementValue = ""
        BrowseResultsPopulationSettings1.BrowseColumns.AddRange(New MicroFour.StrataFrame.UI.Windows.Forms.BrowseColumnItem() {BrowseColumnItem1, BrowseColumnItem2, BrowseColumnItem3})
        BrowseResultsPopulationSettings1.DisplayFieldNames.AddRange(New String() {"cust_FirstName", "cust_LastName", "cust_Address1", "cust_City", "cust_State", "cust_Country"})

        '-- Set the results layout out
        Me.BrowseResultsLayout = BrowseResultsPopulationSettings1
        Me.BusinessObjectType = "BOSample1.CustomersBO"

        '-- Set the browse common properties
        BrowseDialogLayoutSettings1.AllowFormResize = True
        BrowseDialogLayoutSettings1.BottomPanelContents = MicroFour.StrataFrame.UI.BrowseDialogLayoutType.BrowseResults
        BrowseDialogLayoutSettings1.FormSize = New System.Drawing.Size(782, 587)
        BrowseDialogLayoutSettings1.LeftSplitterDistance = 131
        BrowseDialogLayoutSettings1.ShowBottomPanel = True
        BrowseDialogLayoutSettings1.ShowSidePanel = True
        BrowseDialogLayoutSettings1.SidePanelContents = MicroFour.StrataFrame.UI.BrowseDialogLayoutType.InformationPanel
        BrowseDialogLayoutSettings1.SideSplitterDistance = 523
        BrowseDialogLayoutSettings1.TopPanelContents = MicroFour.StrataFrame.UI.BrowseDialogLayoutType.SearchFields
        Me.FormLayout = BrowseDialogLayoutSettings1

        '-- Set the header information
        Me.HeaderImage = My.Resources.User_Find_48
        Me.HeaderTitle = "Customer Browse"

        '-- Set the information panel
        Me.InformationPanel = "BOSample1.CustomersBrowsePanel"

        '-- Define the search fields
        SearchFieldItem1.AllowAdvanced = True
        SearchFieldItem1.DefaultSearchStyle = MicroFour.StrataFrame.UI.BrowseDialogAllSearchTypes.BeginsWith
        SearchFieldItem1.EnumType = ""
        SearchFieldItem1.FieldLabelText = "Last Name:"
        SearchFieldItem1.FieldMask = ""
        SearchFieldItem1.FieldName = "cust_LastName"
        SearchFieldItem1.InitialValue = ""
        SearchFieldItem1.Visible = True
        SearchFieldItem2.AllowAdvanced = False
        SearchFieldItem2.DefaultSearchStyle = MicroFour.StrataFrame.UI.BrowseDialogAllSearchTypes.BeginsWith
        SearchFieldItem2.EnumType = ""
        SearchFieldItem2.FieldLabelText = "First Name:"
        SearchFieldItem2.FieldMask = ""
        SearchFieldItem2.FieldName = "cust_FirstName"
        SearchFieldItem2.InitialValue = ""
        SearchFieldItem2.Visible = True
        SearchFieldItem3.AllowAdvanced = False
        SearchFieldItem3.DefaultSearchStyle = MicroFour.StrataFrame.UI.BrowseDialogAllSearchTypes.Equals
        SearchFieldItem3.EnumType = "BOSample1.PhoneType"
        SearchFieldItem3.FieldLabelText = "Phone Type:"
        SearchFieldItem3.FieldMask = ""
        SearchFieldItem3.FieldName = "cust_PhoneDayType"
        SearchFieldItem3.InitialValue = ""
        SearchFieldItem3.Visible = True
        Me.SearchFields.AddRange(New MicroFour.StrataFrame.UI.Windows.Forms.SearchFieldItem() {SearchFieldItem1, SearchFieldItem2, SearchFieldItem3})
    End Sub

    Private Sub CustomerBrowse_RowPopulating(ByVal e As MicroFour.StrataFrame.UI.Windows.Forms.RowPopulatingEventArgs) Handles Me.RowPopulating
        With CType(e.BusinessObject, CustomersBO)
            e.ImageIndex = 0
        End With
    End Sub
End Class
