User:McFaust

From Wikipedia, the free encyclopedia

imports System imports System.Drawing imports System.Collections imports System.ComponentModel imports System.Windows.Forms imports System.Data imports System.IO Imports System.Diagnostics Imports ESRI.ArcGIS.Carto Imports ESRI.ArcGIS.Geodatabase Imports ESRI.ArcGIS.esriSystem Imports ESRI.ArcGIS.DataSourcesFile Imports ESRI.ArcGIS.DataSourcesGDB imports Infragistics.Shared imports Infragistics.Win imports Infragistics.Win.UltraWinTree Imports Infragistics.Win.UltraWinToolbars Imports ESRI.ArcGIS.MapControl Imports Encom.Compass.Common.DataSource Imports Encom.Compass.Common.DataSource.Database.ESRI

Namespace Dialog

   Public Class DatasetExplorer
       Inherits System.Windows.Forms.Form
       Public Enum SearchTypes
           All = 0
           FileGeoDatabase = 1
           PersonalGeodatabase = 2
           SDEGeodatabase = 3
           Folder = 4
       End Enum
  1. Region " Windows Form Designer generated code "


       'Form overrides dispose to clean up the component list.
       Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
           If disposing Then
               If Not (components Is Nothing) Then
                   components.Dispose()
               End If
           End If
           MyBase.Dispose(disposing)
       End Sub
       'Required by the Windows Form Designer
       Private components As System.ComponentModel.IContainer
       'NOTE: The following procedure is required by the Windows Form Designer
       'It can be modified imports the Windows Form Designer.  
       'Do not modify it imports the code editor.
       Friend WithEvents imageList1 As System.Windows.Forms.ImageList
       Friend WithEvents ultraToolbarsManager1 As Infragistics.Win.UltraWinToolbars.UltraToolbarsManager
       Friend WithEvents imageList2 As System.Windows.Forms.ImageList
       Friend WithEvents columnHeader1 As System.Windows.Forms.ColumnHeader
       Friend WithEvents columnHeader3 As System.Windows.Forms.ColumnHeader
       Friend WithEvents ButtonAdd As System.Windows.Forms.Button
       Friend WithEvents ButtonCancel As System.Windows.Forms.Button
       Friend WithEvents LabelName As System.Windows.Forms.Label
       Friend WithEvents Label1 As System.Windows.Forms.Label
       Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
       Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox
       Friend WithEvents _DatasetExplorer_Toolbars_Dock_Area_Top As Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea
       Friend WithEvents _DatasetExplorer_Toolbars_Dock_Area_Bottom As Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea
       Friend WithEvents _DatasetExplorer_Toolbars_Dock_Area_Left As Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea
       Friend WithEvents _DatasetExplorer_Toolbars_Dock_Area_Right As Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea
       Friend WithEvents listViewFiles As System.Windows.Forms.ListView
       Friend WithEvents TreeDirectories As Infragistics.Win.UltraWinTree.UltraTree
       <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
           Me.components = New System.ComponentModel.Container
           Dim UltraTreeColumnSet1 As Infragistics.Win.UltraWinTree.UltraTreeColumnSet = New Infragistics.Win.UltraWinTree.UltraTreeColumnSet
           Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(DatasetExplorer))
           Dim OptionSet1 As Infragistics.Win.UltraWinToolbars.OptionSet = New Infragistics.Win.UltraWinToolbars.OptionSet("Folders")
           Dim UltraToolbar1 As Infragistics.Win.UltraWinToolbars.UltraToolbar = New Infragistics.Win.UltraWinToolbars.UltraToolbar("AddressBar")
           Dim LabelTool1 As Infragistics.Win.UltraWinToolbars.LabelTool = New Infragistics.Win.UltraWinToolbars.LabelTool("Look")
           Dim ComboBoxTool1 As Infragistics.Win.UltraWinToolbars.ComboBoxTool = New Infragistics.Win.UltraWinToolbars.ComboBoxTool("AddressCombo")
           Dim ButtonTool1 As Infragistics.Win.UltraWinToolbars.ButtonTool = New Infragistics.Win.UltraWinToolbars.ButtonTool("Up")
           Dim ButtonTool2 As Infragistics.Win.UltraWinToolbars.ButtonTool = New Infragistics.Win.UltraWinToolbars.ButtonTool("List")
           Dim ButtonTool3 As Infragistics.Win.UltraWinToolbars.ButtonTool = New Infragistics.Win.UltraWinToolbars.ButtonTool("Details")
           Dim ButtonTool4 As Infragistics.Win.UltraWinToolbars.ButtonTool = New Infragistics.Win.UltraWinToolbars.ButtonTool("Thumbnails")
           Dim LabelTool2 As Infragistics.Win.UltraWinToolbars.LabelTool = New Infragistics.Win.UltraWinToolbars.LabelTool("Look")
           Dim ComboBoxTool2 As Infragistics.Win.UltraWinToolbars.ComboBoxTool = New Infragistics.Win.UltraWinToolbars.ComboBoxTool("AddressCombo")
           Dim ValueList1 As Infragistics.Win.ValueList = New Infragistics.Win.ValueList(0)
           Dim ValueListItem1 As Infragistics.Win.ValueListItem = New Infragistics.Win.ValueListItem
           Dim ButtonTool5 As Infragistics.Win.UltraWinToolbars.ButtonTool = New Infragistics.Win.UltraWinToolbars.ButtonTool("Up")
           Dim Appearance1 As Infragistics.Win.Appearance = New Infragistics.Win.Appearance
           Dim ButtonTool6 As Infragistics.Win.UltraWinToolbars.ButtonTool = New Infragistics.Win.UltraWinToolbars.ButtonTool("Go")
           Dim Appearance2 As Infragistics.Win.Appearance = New Infragistics.Win.Appearance
           Dim ButtonTool7 As Infragistics.Win.UltraWinToolbars.ButtonTool = New Infragistics.Win.UltraWinToolbars.ButtonTool("List")
           Dim Appearance3 As Infragistics.Win.Appearance = New Infragistics.Win.Appearance
           Dim Appearance4 As Infragistics.Win.Appearance = New Infragistics.Win.Appearance("List")
           Dim Appearance5 As Infragistics.Win.Appearance = New Infragistics.Win.Appearance
           Dim ButtonTool8 As Infragistics.Win.UltraWinToolbars.ButtonTool = New Infragistics.Win.UltraWinToolbars.ButtonTool("Details")
           Dim Appearance6 As Infragistics.Win.Appearance = New Infragistics.Win.Appearance
           Dim ButtonTool9 As Infragistics.Win.UltraWinToolbars.ButtonTool = New Infragistics.Win.UltraWinToolbars.ButtonTool("Thumbnails")
           Dim Appearance7 As Infragistics.Win.Appearance = New Infragistics.Win.Appearance
           Dim ButtonTool10 As Infragistics.Win.UltraWinToolbars.ButtonTool = New Infragistics.Win.UltraWinToolbars.ButtonTool("Space")
           Dim ButtonTool11 As Infragistics.Win.UltraWinToolbars.ButtonTool = New Infragistics.Win.UltraWinToolbars.ButtonTool("DefaultConnection")
           Dim Appearance8 As Infragistics.Win.Appearance = New Infragistics.Win.Appearance
           Me.TreeDirectories = New Infragistics.Win.UltraWinTree.UltraTree
           Me.imageList1 = New System.Windows.Forms.ImageList(Me.components)
           Me.ultraToolbarsManager1 = New Infragistics.Win.UltraWinToolbars.UltraToolbarsManager(Me.components)
           Me._DatasetExplorer_Toolbars_Dock_Area_Top = New Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea
           Me._DatasetExplorer_Toolbars_Dock_Area_Bottom = New Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea
           Me._DatasetExplorer_Toolbars_Dock_Area_Left = New Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea
           Me._DatasetExplorer_Toolbars_Dock_Area_Right = New Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea
           Me.imageList2 = New System.Windows.Forms.ImageList(Me.components)
           Me.listViewFiles = New System.Windows.Forms.ListView
           Me.columnHeader1 = New System.Windows.Forms.ColumnHeader
           Me.columnHeader3 = New System.Windows.Forms.ColumnHeader
           Me.ButtonAdd = New System.Windows.Forms.Button
           Me.ButtonCancel = New System.Windows.Forms.Button
           Me.LabelName = New System.Windows.Forms.Label
           Me.Label1 = New System.Windows.Forms.Label
           Me.TextBox1 = New System.Windows.Forms.TextBox
           Me.ComboBox1 = New System.Windows.Forms.ComboBox
           CType(Me.TreeDirectories, System.ComponentModel.ISupportInitialize).BeginInit()
           CType(Me.ultraToolbarsManager1, System.ComponentModel.ISupportInitialize).BeginInit()
           Me.SuspendLayout()
           '
           'TreeDirectories
           '
           Me.TreeDirectories.BorderStyle = Infragistics.Win.UIElementBorderStyle.RaisedSoft
           Me.TreeDirectories.ColumnSettings.RootColumnSet = UltraTreeColumnSet1
           Me.TreeDirectories.HideSelection = False
           Me.TreeDirectories.ImageList = Me.imageList1
           resources.ApplyResources(Me.TreeDirectories, "TreeDirectories")
           Me.TreeDirectories.Name = "TreeDirectories"
           '
           'imageList1
           '
           Me.imageList1.ImageStream = CType(resources.GetObject("imageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
           Me.imageList1.TransparentColor = System.Drawing.Color.Transparent
           Me.imageList1.Images.SetKeyName(0, "")
           Me.imageList1.Images.SetKeyName(1, "")
           Me.imageList1.Images.SetKeyName(2, "")
           Me.imageList1.Images.SetKeyName(3, "")
           Me.imageList1.Images.SetKeyName(4, "")
           Me.imageList1.Images.SetKeyName(5, "")
           Me.imageList1.Images.SetKeyName(6, "")
           Me.imageList1.Images.SetKeyName(7, "")
           Me.imageList1.Images.SetKeyName(8, "")
           Me.imageList1.Images.SetKeyName(9, "")
           Me.imageList1.Images.SetKeyName(10, "")
           Me.imageList1.Images.SetKeyName(11, "")
           Me.imageList1.Images.SetKeyName(12, "")
           Me.imageList1.Images.SetKeyName(13, "")
           Me.imageList1.Images.SetKeyName(14, "")
           Me.imageList1.Images.SetKeyName(15, "")
           Me.imageList1.Images.SetKeyName(16, "")
           Me.imageList1.Images.SetKeyName(17, "")
           Me.imageList1.Images.SetKeyName(18, "")
           Me.imageList1.Images.SetKeyName(19, "")
           Me.imageList1.Images.SetKeyName(20, "")
           Me.imageList1.Images.SetKeyName(21, "")
           Me.imageList1.Images.SetKeyName(22, "")
           Me.imageList1.Images.SetKeyName(23, "")
           Me.imageList1.Images.SetKeyName(24, "")
           Me.imageList1.Images.SetKeyName(25, "")
           Me.imageList1.Images.SetKeyName(26, "")
           Me.imageList1.Images.SetKeyName(27, "")
           Me.imageList1.Images.SetKeyName(28, "")
           Me.imageList1.Images.SetKeyName(29, "")
           Me.imageList1.Images.SetKeyName(30, "")
           Me.imageList1.Images.SetKeyName(31, "")
           Me.imageList1.Images.SetKeyName(32, "")
           Me.imageList1.Images.SetKeyName(33, "")
           Me.imageList1.Images.SetKeyName(34, "")
           Me.imageList1.Images.SetKeyName(35, "")
           Me.imageList1.Images.SetKeyName(36, "")
           Me.imageList1.Images.SetKeyName(37, "")
           Me.imageList1.Images.SetKeyName(38, "")
           Me.imageList1.Images.SetKeyName(39, "")
           Me.imageList1.Images.SetKeyName(40, "")
           Me.imageList1.Images.SetKeyName(41, "cadmultipatch.ico")
           '
           'ultraToolbarsManager1
           '
           Me.ultraToolbarsManager1.DesignerFlags = 1
           Me.ultraToolbarsManager1.DockWithinContainer = Me
           Me.ultraToolbarsManager1.ImageListSmall = Me.imageList1
           Me.ultraToolbarsManager1.ImageSizeSmall = New System.Drawing.Size(20, 20)
           Me.ultraToolbarsManager1.OptionSets.Add(OptionSet1)
           Me.ultraToolbarsManager1.ShowFullMenusDelay = 500
           Me.ultraToolbarsManager1.Style = Infragistics.Win.UltraWinToolbars.ToolbarStyle.Office2003
           UltraToolbar1.DockedColumn = 0
           UltraToolbar1.DockedRow = 0
           UltraToolbar1.FloatingLocation = New System.Drawing.Point(339, 269)
           UltraToolbar1.FloatingSize = New System.Drawing.Size(515, 28)
           UltraToolbar1.IsMainMenuBar = True
           UltraToolbar1.Settings.AllowCustomize = Infragistics.Win.DefaultableBoolean.[False]
           UltraToolbar1.Settings.AllowDockBottom = Infragistics.Win.DefaultableBoolean.[False]
           UltraToolbar1.Settings.AllowDockLeft = Infragistics.Win.DefaultableBoolean.[False]
           UltraToolbar1.Settings.AllowDockRight = Infragistics.Win.DefaultableBoolean.[False]
           UltraToolbar1.Settings.AllowDockTop = Infragistics.Win.DefaultableBoolean.[True]
           UltraToolbar1.Settings.AllowFloating = Infragistics.Win.DefaultableBoolean.[False]
           UltraToolbar1.Settings.AllowHiding = Infragistics.Win.DefaultableBoolean.[False]
           UltraToolbar1.Settings.BorderStyleDocked = Infragistics.Win.UIElementBorderStyle.None
           UltraToolbar1.Settings.GrabHandleStyle = Infragistics.Win.UltraWinToolbars.GrabHandleStyle.None
           resources.ApplyResources(UltraToolbar1, "UltraToolbar1")
           ComboBoxTool1.InstanceProps.Width = 287
           UltraToolbar1.Tools.AddRange(New Infragistics.Win.UltraWinToolbars.ToolBase() {LabelTool1, ComboBoxTool1, ButtonTool1, ButtonTool2, ButtonTool3, ButtonTool4})
           Me.ultraToolbarsManager1.Toolbars.AddRange(New Infragistics.Win.UltraWinToolbars.UltraToolbar() {UltraToolbar1})
           LabelTool2.SharedProps.Caption = resources.GetString("resource.Caption")
           ComboBoxTool2.SharedProps.Caption = resources.GetString("resource.Caption1")
           ComboBoxTool2.SharedProps.Width = 200
           resources.ApplyResources(ComboBoxTool2, "ComboBoxTool2")
           ValueList1.DisplayStyle = Infragistics.Win.ValueListDisplayStyle.DisplayText
           ValueListItem1.DataValue = "ValueListItem0"
           resources.ApplyResources(ValueListItem1, "ValueListItem1")
           ValueList1.ValueListItems.Add(ValueListItem1)
           ComboBoxTool2.ValueList = ValueList1
           Appearance1.Image = CType(resources.GetObject("Appearance1.Image"), Object)
           ButtonTool5.SharedProps.AppearancesSmall.Appearance = Appearance1
           ButtonTool5.SharedProps.Caption = resources.GetString("resource.Caption2")
           ButtonTool5.SharedProps.ShowInCustomizer = False
           Appearance2.Image = CType(resources.GetObject("Appearance2.Image"), Object)
           ButtonTool6.SharedProps.AppearancesSmall.Appearance = Appearance2
           ButtonTool6.SharedProps.Caption = resources.GetString("resource.Caption3")
           ButtonTool6.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText
           Appearance3.Image = CType(resources.GetObject("Appearance3.Image"), Object)
           ButtonTool7.SharedProps.AppearancesSmall.Appearance = Appearance3
           Appearance4.BackColor = System.Drawing.Color.White
           ButtonTool7.SharedProps.AppearancesSmall.HotTrackAppearance = Appearance4
           Appearance5.BackColor = System.Drawing.Color.Gray
           Appearance5.BorderColor = System.Drawing.Color.White
           ButtonTool7.SharedProps.AppearancesSmall.PressedAppearanceOnToolbar = Appearance5
           ButtonTool7.SharedProps.Caption = resources.GetString("resource.Caption4")
           ButtonTool7.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageOnlyOnToolbars
           ButtonTool7.SharedProps.ShowInCustomizer = False
           Appearance6.Image = CType(resources.GetObject("Appearance6.Image"), Object)
           ButtonTool8.SharedProps.AppearancesSmall.Appearance = Appearance6
           ButtonTool8.SharedProps.Caption = resources.GetString("resource.Caption5")
           ButtonTool8.SharedProps.ShowInCustomizer = False
           Appearance7.Image = CType(resources.GetObject("Appearance7.Image"), Object)
           ButtonTool9.SharedProps.AppearancesSmall.Appearance = Appearance7
           ButtonTool9.SharedProps.Caption = resources.GetString("resource.Caption6")
           ButtonTool9.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageOnlyOnToolbars
           ButtonTool9.SharedProps.ShowInCustomizer = False
           ButtonTool9.SharedProps.Spring = True
           ButtonTool10.SharedProps.Caption = resources.GetString("resource.Caption7")
           Appearance8.Image = 34
           ButtonTool11.SharedProps.AppearancesSmall.Appearance = Appearance8
           ButtonTool11.SharedProps.Caption = resources.GetString("resource.Caption8")
           ButtonTool11.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageOnlyOnToolbars
           ButtonTool11.SharedProps.ShowInCustomizer = False
           Me.ultraToolbarsManager1.Tools.AddRange(New Infragistics.Win.UltraWinToolbars.ToolBase() {LabelTool2, ComboBoxTool2, ButtonTool5, ButtonTool6, ButtonTool7, ButtonTool8, ButtonTool9, ButtonTool10, ButtonTool11})
           '
           '_DatasetExplorer_Toolbars_Dock_Area_Top
           '
           Me._DatasetExplorer_Toolbars_Dock_Area_Top.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping
           Me._DatasetExplorer_Toolbars_Dock_Area_Top.BackColor = System.Drawing.Color.FromArgb(CType(CType(158, Byte), Integer), CType(CType(190, Byte), Integer), CType(CType(245, Byte), Integer))
           Me._DatasetExplorer_Toolbars_Dock_Area_Top.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Top
           Me._DatasetExplorer_Toolbars_Dock_Area_Top.ForeColor = System.Drawing.SystemColors.ControlText
           resources.ApplyResources(Me._DatasetExplorer_Toolbars_Dock_Area_Top, "_DatasetExplorer_Toolbars_Dock_Area_Top")
           Me._DatasetExplorer_Toolbars_Dock_Area_Top.Name = "_DatasetExplorer_Toolbars_Dock_Area_Top"
           Me._DatasetExplorer_Toolbars_Dock_Area_Top.ToolbarsManager = Me.ultraToolbarsManager1
           '
           '_DatasetExplorer_Toolbars_Dock_Area_Bottom
           '
           Me._DatasetExplorer_Toolbars_Dock_Area_Bottom.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping
           Me._DatasetExplorer_Toolbars_Dock_Area_Bottom.BackColor = System.Drawing.Color.FromArgb(CType(CType(158, Byte), Integer), CType(CType(190, Byte), Integer), CType(CType(245, Byte), Integer))
           Me._DatasetExplorer_Toolbars_Dock_Area_Bottom.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Bottom
           Me._DatasetExplorer_Toolbars_Dock_Area_Bottom.ForeColor = System.Drawing.SystemColors.ControlText
           resources.ApplyResources(Me._DatasetExplorer_Toolbars_Dock_Area_Bottom, "_DatasetExplorer_Toolbars_Dock_Area_Bottom")
           Me._DatasetExplorer_Toolbars_Dock_Area_Bottom.Name = "_DatasetExplorer_Toolbars_Dock_Area_Bottom"
           Me._DatasetExplorer_Toolbars_Dock_Area_Bottom.ToolbarsManager = Me.ultraToolbarsManager1
           '
           '_DatasetExplorer_Toolbars_Dock_Area_Left
           '
           Me._DatasetExplorer_Toolbars_Dock_Area_Left.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping
           Me._DatasetExplorer_Toolbars_Dock_Area_Left.BackColor = System.Drawing.Color.FromArgb(CType(CType(158, Byte), Integer), CType(CType(190, Byte), Integer), CType(CType(245, Byte), Integer))
           Me._DatasetExplorer_Toolbars_Dock_Area_Left.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Left
           Me._DatasetExplorer_Toolbars_Dock_Area_Left.ForeColor = System.Drawing.SystemColors.ControlText
           resources.ApplyResources(Me._DatasetExplorer_Toolbars_Dock_Area_Left, "_DatasetExplorer_Toolbars_Dock_Area_Left")
           Me._DatasetExplorer_Toolbars_Dock_Area_Left.Name = "_DatasetExplorer_Toolbars_Dock_Area_Left"
           Me._DatasetExplorer_Toolbars_Dock_Area_Left.ToolbarsManager = Me.ultraToolbarsManager1
           '
           '_DatasetExplorer_Toolbars_Dock_Area_Right
           '
           Me._DatasetExplorer_Toolbars_Dock_Area_Right.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping
           Me._DatasetExplorer_Toolbars_Dock_Area_Right.BackColor = System.Drawing.Color.FromArgb(CType(CType(158, Byte), Integer), CType(CType(190, Byte), Integer), CType(CType(245, Byte), Integer))
           Me._DatasetExplorer_Toolbars_Dock_Area_Right.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Right
           Me._DatasetExplorer_Toolbars_Dock_Area_Right.ForeColor = System.Drawing.SystemColors.ControlText
           resources.ApplyResources(Me._DatasetExplorer_Toolbars_Dock_Area_Right, "_DatasetExplorer_Toolbars_Dock_Area_Right")
           Me._DatasetExplorer_Toolbars_Dock_Area_Right.Name = "_DatasetExplorer_Toolbars_Dock_Area_Right"
           Me._DatasetExplorer_Toolbars_Dock_Area_Right.ToolbarsManager = Me.ultraToolbarsManager1
           '
           'imageList2
           '
           Me.imageList2.ImageStream = CType(resources.GetObject("imageList2.ImageStream"), System.Windows.Forms.ImageListStreamer)
           Me.imageList2.TransparentColor = System.Drawing.Color.Transparent
           Me.imageList2.Images.SetKeyName(0, "")
           Me.imageList2.Images.SetKeyName(1, "")
           '
           'listViewFiles
           '
           resources.ApplyResources(Me.listViewFiles, "listViewFiles")
           Me.listViewFiles.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.columnHeader1, Me.columnHeader3})
           Me.listViewFiles.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable
           Me.listViewFiles.LargeImageList = Me.imageList1
           Me.listViewFiles.Name = "listViewFiles"
           Me.listViewFiles.SmallImageList = Me.imageList1
           Me.listViewFiles.UseCompatibleStateImageBehavior = False
           Me.listViewFiles.View = System.Windows.Forms.View.Details
           '
           'columnHeader1
           '
           resources.ApplyResources(Me.columnHeader1, "columnHeader1")
           '
           'columnHeader3
           '
           resources.ApplyResources(Me.columnHeader3, "columnHeader3")
           '
           'ButtonAdd
           '
           resources.ApplyResources(Me.ButtonAdd, "ButtonAdd")
           Me.ButtonAdd.Name = "ButtonAdd"
           '
           'ButtonCancel
           '
           Me.ButtonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
           resources.ApplyResources(Me.ButtonCancel, "ButtonCancel")
           Me.ButtonCancel.Name = "ButtonCancel"
           '
           'LabelName
           '
           resources.ApplyResources(Me.LabelName, "LabelName")
           Me.LabelName.Name = "LabelName"
           '
           'Label1
           '
           resources.ApplyResources(Me.Label1, "Label1")
           Me.Label1.Name = "Label1"
           '
           'TextBox1
           '
           resources.ApplyResources(Me.TextBox1, "TextBox1")
           Me.TextBox1.Name = "TextBox1"
           '
           'ComboBox1
           '
           resources.ApplyResources(Me.ComboBox1, "ComboBox1")
           Me.ComboBox1.Name = "ComboBox1"
           '
           'DatasetExplorer
           '
           Me.AcceptButton = Me.ButtonAdd
           resources.ApplyResources(Me, "$this")
           Me.CancelButton = Me.ButtonCancel
           Me.Controls.Add(Me.ComboBox1)
           Me.Controls.Add(Me.TextBox1)
           Me.Controls.Add(Me.Label1)
           Me.Controls.Add(Me.LabelName)
           Me.Controls.Add(Me.ButtonCancel)
           Me.Controls.Add(Me.ButtonAdd)
           Me.Controls.Add(Me.TreeDirectories)
           Me.Controls.Add(Me.listViewFiles)
           Me.Controls.Add(Me._DatasetExplorer_Toolbars_Dock_Area_Left)
           Me.Controls.Add(Me._DatasetExplorer_Toolbars_Dock_Area_Right)
           Me.Controls.Add(Me._DatasetExplorer_Toolbars_Dock_Area_Top)
           Me.Controls.Add(Me._DatasetExplorer_Toolbars_Dock_Area_Bottom)
           Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
           Me.MaximizeBox = False
           Me.MinimizeBox = False
           Me.Name = "DatasetExplorer"
           Me.ShowInTaskbar = False
           CType(Me.TreeDirectories, System.ComponentModel.ISupportInitialize).EndInit()
           CType(Me.ultraToolbarsManager1, System.ComponentModel.ISupportInitialize).EndInit()
           Me.ResumeLayout(False)
           Me.PerformLayout()
       End Sub
  1. End Region
  1. Region " Private Fields "
       Private MapControlValue As ESRI.ArcGIS.MapControl.IMapControl2
       Private pathsVisited As ArrayList = New ArrayList(10)
       Private mvarCurrentPathIndex As Integer = -1
       Private addressComboPreDropdownValue As String = String.Empty
       Private dataSourcesValue As New DataSources
       Private WithEvents AddressComboTool As ComboBoxTool
       Private SDESQLInstances As New SpatialSearch.SDEInstance
       Private SearchTypeValue As SearchTypes
  1. End Region
  1. Region " Constructor "
       Public Sub New()
           MyBase.New()
           Encom.Compass.Map.ArcCommon.LicenseSingleton.LicenseApplication()
           InitializeComponent()
           debugging()
           SearchTypeValue = SearchTypes.All
       End Sub
       Private Sub debugging()
           Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(DatasetExplorer))
           Dim a As System.Collections.IDictionaryEnumerator
           Dim ci As New System.Globalization.CultureInfo("de")
           a = resources.GetResourceSet(ci, True, True).GetEnumerator
           While a.MoveNext
               Try
                   If a.Value.ToString <> "" Then
                       Debug.Print(a.Value.ToString & Environment.NewLine)
                   Else
                       Debug.Print("empty" & Environment.NewLine)
                   End If
               Catch ex As Exception
                   Debug.Print("nothing" & Environment.NewLine)
               End Try
           End While
       End Sub
       Public Sub New(ByVal searchtype As SearchTypes)
           Me.New()
           Me.SearchTypeValue = searchtype
           Dim title As String = Nothing
           Dim filter As String = Nothing
           Select Case searchtype
               Case SearchTypes.All
                   title = ml_string(47, "Datasets and Layers")
                   filter = title
               Case SearchTypes.FileGeoDatabase
                   title = ml_string(48, "Select File Geodatabase")
                   filter = ml_string(49, "File Geodatabases")
               Case SearchTypes.Folder
                   title = ml_string(50, "Select Favourite Folder")
                   filter = ml_string(51, "Folders")
               Case SearchTypes.PersonalGeodatabase
                   title = ml_string(52, "Select Personal Geodatabase")
                   filter = PERSONAL_GEODATABASE
               Case SearchTypes.SDEGeodatabase
                   title = ml_string(54, "Select SDE Connection")
                   filter = ml_string(55, "SDE connections")
           End Select
           Me.Text = title
           ComboBox1.Items.Clear()
           ComboBox1.Items.Add(filter)
           ComboBox1.SelectedIndex = 0
       End Sub
  1. End Region
  1. Region " Constants "
       Private Shared ReadOnly MYCOMPUTER As String = ml_string(41, "My Computer")
       Private Shared ReadOnly DATABASE As String = ml_string(42, "Database Connections")
       Private Shared ReadOnly CATALOG As String = ml_string(43, "Catalog")
       Private Space As Char = CType(".", Char)                      'MLHIDE
       Private DatabaseConnectionLocation As String = "\Application Data\ESRI\ArcCatalog" 'MLHIDE
       Private SDESearchPattern As String = "*.sde"                  'MLHIDE
  1. End Region
  1. Region " Private Events "
       Private Sub MainForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
           Dim rootNode As UltraTreeNode = TreeDirectories.Nodes.Add("", CATALOG)
           rootNode.Override.NodeAppearance.Image = 16
           Dim dbNode As UltraTreeNode = Nothing
           If SearchTypeValue = SearchTypes.All Then
               dbNode = rootNode.Nodes.Add("", DATABASE)
               dbNode.Override.NodeAppearance.Image = 20
           End If
           Dim mcNode As UltraTreeNode = rootNode.Nodes.Add("", MYCOMPUTER)
           mcNode.Override.NodeAppearance.Image = 21


           'Load the first level of tree nodes.
           LoadTreeNodes(mcNode, False, False)
           'Load the first level of tree nodes.
           If dbNode IsNot Nothing Then
               LoadSDENodes(dbNode)
           End If
           'Expand the root node.
           mcNode.Expanded = True
           AddressComboTool = DirectCast(ultraToolbarsManager1.Toolbars("AddressBar").Tools("AddressCombo"), ComboBoxTool) 'MLHIDE
           'Listen to events of certain toolbar tools.
           AddHandler ultraToolbarsManager1.Tools("Up").ToolClick, AddressOf UpToolClicked 'MLHIDE
           AddHandler ultraToolbarsManager1.Tools("List").ToolClick, AddressOf ListViewStyle 'MLHIDE
           AddHandler ultraToolbarsManager1.Tools("Details").ToolClick, AddressOf ListViewStyle 'MLHIDE
           AddHandler ultraToolbarsManager1.Tools("Thumbnails").ToolClick, AddressOf ListViewStyle 'MLHIDE
           Dim cdrive As String = My.Computer.FileSystem.SpecialDirectories.Desktop
           cdrive = cdrive.Substring(0, cdrive.IndexOf("\") + 1)     'MLHIDE
           Try
               Dim lastpath As String = My.Settings.LastLocation '--Utilities.GetRegistryValue(Utilities.Section, Utilities.AddDialogLastLocation)
               ' If lastpath Is Nothing OrElse lastpath = "" Then
               lastpath = cdrive
               ' End If
               lastpath = lastpath.Replace("~", "")                  'MLHIDE
               Dim file As New FileInfo(lastpath)
               Dim directory As New DirectoryInfo(lastpath)
               If file.Exists Then
                   If file.Extension.ToLower = ".mdb" Then           'MLHIDE
                       LoadMDBLayers(file.FullName)
                   ElseIf file.Extension.ToLower = ".sde" Then       'MLHIDE
                       LoadSDELayers(file.FullName)
                   Else
                       CurrentPath = file.DirectoryName
                   End If
               ElseIf directory.Exists Then
                   If (Not directory.Parent Is Nothing) AndAlso (ESRIWorkspace.IsArcInfoWorkspaceFactory(directory.Parent) Or _
                   ESRIWorkspace.IsRasterWorkspaceFactory(directory.Parent) Or _
                   ESRIWorkspace.IsTinWorkspaceFactory(directory.Parent)) Then
                       CurrentPath = directory.Parent.FullName
                       SelectPathInTree(directory.Parent.FullName)
                   Else
                       CurrentPath = directory.FullName
                       SelectPathInTree(directory.FullName)
                   End If
               Else
                   If Not SelectPathInTree(lastpath) Then
                       SelectPathInTree(cdrive)
                       My.Settings.LastLocation = cdrive
                       '--Utilities.SaveRegistryValue(Utilities.Section, Utilities.AddDialogLastLocation, "c:\")
                   End If
               End If
           Catch ex As Exception
               SelectPathInTree(cdrive)
           End Try
           Dim view As String = My.Settings.ListViewStyle '--Utilities.GetRegistryValue(Utilities.Section, Utilities.Listview)
           If view Is Nothing Then
               view = "List"                                         'MLHIDE
           End If
           If view.Length > 0 Then
               System.Enum.Parse(GetType(System.Windows.Forms.View), view)
               listViewFiles.View = CType(System.Enum.Parse(GetType(System.Windows.Forms.View), view), System.Windows.Forms.View)
           End If
           TreeDirectories.Nodes(0).ExpandAll()
       End Sub
       Private Sub TreeDirectories_BeforeExpand(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinTree.CancelableNodeEventArgs) Handles TreeDirectories.BeforeExpand
           If e.TreeNode.Nodes.Count > 1 Then
               e.TreeNode.Nodes(1).Nodes.Clear()
               LoadTreeNodes(e.TreeNode.Nodes(1), True, False)
           End If
       End Sub
       Private Sub TreeDirectories_AfterSelect(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinTree.SelectEventArgs) Handles TreeDirectories.AfterSelect
           Dim nodeTag As String
           If e.NewSelections.Count > 0 AndAlso e.NewSelections(0).Key <> "" Then
               nodeTag = CType(e.NewSelections(0).Tag, String)
               If New FileInfo(nodeTag).Extension.ToUpper = ".SDE" Then 'MLHIDE
                   LoadSDELayers(nodeTag)
               ElseIf nodeTag.ToUpper.IndexOf(SDEDatabaseLocation.ToUpper) = 0 Then
                   CurrentPath = nodeTag
                   SetAddressComboText(DATABASE)
               Else
                   CurrentPath = nodeTag
               End If
           ElseIf e.NewSelections.Count > 0 AndAlso e.NewSelections(0).Text.IndexOf(DATABASE) = 0 Then
               Dim nodeToSelect As UltraTreeNode = TreeDirectories.Nodes(0).Nodes(0)
               CurrentPath = Me.SDEDatabaseLocation
               SetAddressComboText(DATABASE)
           ElseIf e.NewSelections.Count > 0 AndAlso e.NewSelections(0).Text.IndexOf(DatasetExplorer.MYCOMPUTER) = 0 Then
           End If
           TreeDirectories.Visible = False
       End Sub
       Private Sub listViewFiles_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles listViewFiles.DoubleClick
           Dim cursorPosition As System.Drawing.Point = listViewFiles.PointToClient(Control.MousePosition)
           Dim item As ListViewItem = listViewFiles.GetItemAt(cursorPosition.X, cursorPosition.Y)
           Try
               FormCursor(Cursors.WaitCursor)
               If Not item Is Nothing Then
                   Dim dataSource As DataSourceBase = DirectCast(item.Tag, DataSourceBase)
                   If Not dataSource Is Nothing Then
                       If TypeOf dataSource Is FileSystem.Directory Then
                           Dim directory As FileSystem.Directory = CType(dataSource, FileSystem.Directory)
                           If ESRIWorkspace.IsFileDatabaseWorkspaceFactory(New DirectoryInfo(directory.LocalPath)) Then
                               If Me.SearchTypeValue = SearchTypes.All Then
                                   LoadFileGeodatabaseDatasets(directory.LocalPath)
                               End If
                           Else
                               SelectPathInTree(directory.LocalPath)
                               ButtonAdd.Enabled = False
                           End If
                       Else
                           If Me.SearchTypeValue = SearchTypes.All Then
                               If TypeOf dataSource Is FileSystem.File Then
                                   Dim file As New FileInfo(CType(dataSource, FileSystem.File).LocalPath)
                                   SelectPathInTree(file.DirectoryName)
                                   If file.Extension.ToUpper = ".MDB" Then 'MLHIDE
                                       LoadMDBLayers(file.FullName)
                                   ElseIf file.Extension.ToUpper = ".SDE" Then 'MLHIDE
                                       LoadSDELayers(file.FullName)
                                   Else
                                       ButtonAdd_Click(Nothing, Nothing)
                                   End If
                               ElseIf TypeOf dataSource Is FileSystem.ESRI.Coverage Then
                                   Dim coverage As FileSystem.ESRI.Coverage = CType(dataSource, FileSystem.ESRI.Coverage)
                                   If Not coverage.HasFeatureClass Then
                                       CurrentPath = coverage.LocalPath '& "\" & coverage.Name
                                       FormCursor(Cursors.WaitCursor)
                                       ESRIWorkspace.CoverageDatasets(New DirectoryInfo(coverage.LocalPath), listViewFiles)
                                       FormCursor(Cursors.Default)
                                   Else
                                       ButtonAdd_Click(Nothing, Nothing)
                                   End If
                               ElseIf TypeOf dataSource Is Database.ESRI.PersonalGeodatabase Then
                                   Dim geodatabase As Database.ESRI.PersonalGeodatabase = CType(dataSource, Database.ESRI.PersonalGeodatabase)
                                   If geodatabase.DatasetType = esriDatasetType.esriDTFeatureDataset Then
                                       CurrentPath = geodatabase.Location & "~" 'MLHIDE
                                       ESRIWorkspace.MDBDatasets(New FileInfo(geodatabase.Location), listViewFiles, geodatabase)
                                   Else
                                       ButtonAdd_Click(Nothing, Nothing)
                                   End If
                               ElseIf TypeOf dataSource Is Database.ESRI.SpatialDataEngine Then
                                   Dim geodatabase As Database.ESRI.SpatialDataEngine = CType(dataSource, Database.ESRI.SpatialDataEngine)
                                   If geodatabase.DatasetType = esriDatasetType.esriDTFeatureDataset Then
                                       ESRIWorkspace.SDEFeatureDataSets(geodatabase, listViewFiles)
                                   Else
                                       ButtonAdd_Click(Nothing, Nothing)
                                   End If
                               ElseIf TypeOf dataSource Is FileSystem.ESRI.CADDrawing Then
                                   ButtonAdd_Click(Nothing, Nothing)
                               ElseIf TypeOf dataSource Is FileSystem.ESRI.CADDataset Then
                                   Dim caddataset As FileSystem.ESRI.CADDataset = CType(dataSource, FileSystem.ESRI.CADDataset)
                                   CurrentPath = caddataset.LocalPath
                                   If caddataset.CADDatasetType = FileSystem.ESRI.ESRIFeatureClassTypes.EnumerationToString(FileSystem.ESRI.ESRIFeatureTypes.FeatureDataset) Then
                                       ESRIWorkspace.CADFeatureDataSets(caddataset, listViewFiles)
                                   Else
                                       ButtonAdd_Click(Nothing, Nothing)
                                   End If
                               ElseIf TypeOf dataSource Is FileSystem.ESRI.IESRIFileSystem Or TypeOf dataSource Is FileSystem.ESRI.IESRIDirectorySystem Then
                                   ButtonAdd_Click(Nothing, Nothing)
                               End If
                           Else
                               ButtonAdd_Click(Nothing, Nothing)
                           End If
                       End If
                   End If
               End If
           Catch ex As Exception
               Debug.WriteLine(ex)
           End Try
           FormCursor(Cursors.Default)
       End Sub
       Private Sub listViewFiles_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles listViewFiles.SelectedIndexChanged
           ButtonAdd.Enabled = listViewFiles.SelectedItems.Count > 0
       End Sub
       Private Sub DatasetExplorer_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
           TreeDirectories.Visible = False
       End Sub
       Private Sub DefaultConnectionClicked(ByVal sender As Object, ByVal e As ToolClickEventArgs)
           ultraToolbarsManager1.Tools("DefaultConnection").SharedProps.AppearancesSmall.Appearance.Image = imageList1.Images.Item(19) 'MLHIDE
       End Sub
       Private Sub UpToolClicked(ByVal sender As Object, ByVal e As ToolClickEventArgs)
           TreeDirectories.Visible = False
           Dim parentDirectory As DirectoryInfo
           If CurrentPath.IndexOf("~") > -1 Then                     'MLHIDE
               Dim file As New FileInfo(CurrentPath.Replace("~", "")) 'MLHIDE
               parentDirectory = file.Directory
               SelectPathInTree(parentDirectory.FullName)
               CurrentPath = file.FullName
               If file.Extension.ToUpper = ".MDB" Then               'MLHIDE
                   ESRIWorkspace.MDBDatasets(file, listViewFiles, SDESQLInstances)
               ElseIf file.Extension.ToUpper = ".SDE" Then           'MLHIDE
                   ESRIWorkspace.SDEDataSets(file, listViewFiles, SDESQLInstances)
               End If
           ElseIf CurrentPath.ToLower.IndexOf(SDEDatabaseLocation.ToLower) = 0 Then
               Dim treenode As UltraTreeNode = Me.TreeDirectories.Nodes(0).Nodes(0)
               SelectPathInTree(SDEDatabaseLocation)
               CurrentPath = Me.SDEDatabaseLocation
               treenode.Selected = True
               treenode.Expanded = True
               treenode.BringIntoView()
               treenode.ExpandAll()
               SetAddressComboText(DATABASE)
           Else
               parentDirectory = Directory.GetParent(CurrentPath)
               If Not parentDirectory Is Nothing Then
                   SelectPathInTree(parentDirectory.FullName)
               Else
                   SelectPathInTree(CurrentPath)
               End If
           End If
           ButtonAdd.Enabled = False
       End Sub
       Private Sub GoToolClicked(ByVal sender As Object, ByVal e As ToolClickEventArgs)
           If Not (AddressComboTool Is Nothing) Then
               SelectPathInTree(AddressComboTool.Text)
           End If
       End Sub
       Private Sub AddressComboToolKeyPress(ByVal sender As Object, ByVal e As ToolKeyPressEventArgs) Handles AddressComboTool.ToolKeyPress
           SetAddressComboText(CurrentPath)
       End Sub
       Private Sub AddressComboToolDropdown(ByVal sender As Object, ByVal e As BeforeToolDropdownEventArgs) Handles AddressComboTool.BeforeToolDropdown
           TreeDirectories.Visible = True
           TreeDirectories.Focus()
           TreeDirectories.BringToFront()
           TreeDirectories.Location = New System.Drawing.Point(72, ultraToolbarsManager1.Toolbars(0).Height - 3)
       End Sub
       Private Sub AddressComboToolCloseup(ByVal sender As Object, ByVal e As ToolDropdownEventArgs) Handles AddressComboTool.AfterToolCloseup
           If (Not (AddressComboTool Is Nothing)) AndAlso (String.Compare(AddressComboTool.Text, addressComboPreDropdownValue, True) <> 0) Then
               SelectPathInTree(AddressComboTool.Text)
           End If
       End Sub
       Private Sub ListViewStyle(ByVal sender As Object, ByVal e As ToolClickEventArgs)
           TreeDirectories.Visible = False
           Dim ListViewTool As ButtonTool = DirectCast(e.Tool, ButtonTool)
           ListViewTool.IsActiveTool = True
           Select Case e.Tool.Key
               Case "List"                                           'MLHIDE
                   listViewFiles.View = View.List
               Case "Details"                                        'MLHIDE
                   listViewFiles.View = View.Details
               Case "Thumbnails"                                     'MLHIDE
                   listViewFiles.View = View.LargeIcon
           End Select
           My.Settings.ListViewStyle = listViewFiles.View.ToString
           '--Utilities.SaveRegistryValue(Utilities.Section, Utilities.Listview, listViewFiles.View.ToString)
       End Sub
       Private Sub TreeDirectories_AfterExpand(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinTree.NodeEventArgs) Handles TreeDirectories.AfterExpand
           If Not e.TreeNode.IsRootLevelNode And Not (e.TreeNode.Text = MYCOMPUTER Or e.TreeNode.Text = DATABASE Or e.TreeNode.Text = CATALOG Or e.TreeNode.Text.IndexOf("\") > -1) Then 'MLHIDE
               e.TreeNode.Override.NodeAppearance.Image = 6
               If Not e.TreeNode.Parent Is Nothing AndAlso Not (e.TreeNode.Parent.Text = MYCOMPUTER Or e.TreeNode.Parent.Text = DATABASE Or e.TreeNode.Parent.Text = CATALOG Or e.TreeNode.Parent.Text.IndexOf("\") > -1) Then 'MLHIDE
                   e.TreeNode.Parent.Override.NodeAppearance.Image = 0
               End If
           End If
           If (e.TreeNode.Nodes.Count = 0) Then
               e.TreeNode.Override.ShowExpansionIndicator = ShowExpansionIndicator.Never
               e.TreeNode.Selected = True
           End If
       End Sub
       Private Sub listViewFiles_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles listViewFiles.MouseDown
           TreeDirectories.Visible = False
       End Sub
       Private Sub TreeDirectories_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TreeDirectories.LostFocus
           TreeDirectories.Visible = False
       End Sub
       Private Sub TreeDirectories_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TreeDirectories.MouseLeave
           ' TreeDirectories.Visible = False
       End Sub
       Private Sub ButtonCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonCancel.Click
           Close()
       End Sub
       Private Sub ButtonAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonAdd.Click
           Dim listviewItem As ListViewItem
           Dim dataSource As DataSourceBase
           Dim addedLayer As Boolean
           '-- need to create an enum of datasetnames
           If listViewFiles.SelectedItems.Count > 0 Then
               dataSourcesValue = New DataSources
               For i As Integer = 0 To listViewFiles.SelectedItems.Count - 1
                   listviewItem = listViewFiles.SelectedItems.Item(i)
                   dataSource = CType(listviewItem.Tag, DataSourceBase)
                   dataSourcesValue.Add(dataSource)
                   addedLayer = True
               Next i
           End If
           DialogResult = Windows.Forms.DialogResult.Cancel
           If addedLayer Then
               My.Settings.LastLocation = CurrentPath
               '--Utilities.SaveRegistryValue(Utilities.Section, Utilities.AddDialogLastLocation, CurrentPath)
               DialogResult = Windows.Forms.DialogResult.OK
           End If
           Close()
       End Sub
  1. End Region
  1. Region " Public Properties "
       Public ReadOnly Property DataSources() As DataSources
           Get
               Return dataSourcesValue
           End Get
       End Property
  1. End Region
  1. Region "Private properties"
       Private ReadOnly Property SDEDatabaseLocation() As String
           Get
               Return System.Environment.GetEnvironmentVariable("USERPROFILE") & DatabaseConnectionLocation 'MLHIDE
           End Get
       End Property
  1. End Region
  1. Region " Private Methods "
  1. Region " LoadListViewWithDetails "
       Private Function LoadListViewWithDetails(ByVal path As String, ByVal loadDirectories As Boolean, ByVal loadFiles As Boolean) As Boolean
           Try
               If path = "" Then Return False
               listViewFiles.Items.Clear()
               If System.IO.Path.GetExtension(path) <> "" Then Exit Function
               If (loadDirectories = True Or loadFiles = True) Then
                   'Stop the listview from updating until we're done adding items.
                   listViewFiles.BeginUpdate()
                   'Load the directories contained in the path.
                   If (loadDirectories) Then
                       GetDirectories(path, False)
                   End If
                   'Load the files contained within the path.
                   If (loadFiles) Then
                       CreateFileDataSources(New DirectoryInfo(path))
                   End If
                   SortListView()
                   listViewFiles.Refresh()
                   listViewFiles.EndUpdate()
               End If
               Return True
           Catch ex As Exception
               Return False
           Finally
               listViewFiles.EndUpdate()
           End Try
       End Function
       Private Sub SortListView()
           Dim folderslistview As New ListView
           Dim pgdblistview As New ListView
           Dim filelistview As New ListView
           Dim coverageslistview As New ListView
           Dim gridslistview As New ListView
           Dim fileslistview As New ListView
           Dim sortedlistview As New ListView
           Dim cloneitem As ListViewItem


           For Each itm As ListViewItem In listViewFiles.Items
               cloneitem = CType(itm.Clone, ListViewItem)
               '-- get all the folders
               If itm.SubItems.Count > 0 AndAlso itm.SubItems(1).Text.ToString = FOLDER Then
                   folderslistview.Items.Add(cloneitem)
               ElseIf itm.SubItems.Count > 0 AndAlso (itm.SubItems(1).Text.ToString = PERSONAL_GEODATABASE Or itm.SubItems(1).Text.ToString = SPATIAL_DATABASE_CONNECTION) Then
                   '-- get all the database
                   pgdblistview.Items.Add(cloneitem)
               ElseIf itm.SubItems.Count > 0 AndAlso itm.SubItems(1).Text.ToString = FILE_GEODATABASE Then
                   '-- get all the database
                   filelistview.Items.Add(cloneitem)
               ElseIf itm.SubItems.Count > 0 AndAlso itm.SubItems(1).Text.ToString = ARCINFO_COVERAGE Then
                   '-- get all the Coverages
                   coverageslistview.Items.Add(cloneitem)
               ElseIf itm.SubItems.Count > 0 AndAlso itm.SubItems(1).Text.ToString = ARCINFO_GRID Then
                   '-- get all the Coverages
                   gridslistview.Items.Add(cloneitem)
               Else
                   '-- get all the other values
                   fileslistview.Items.Add(cloneitem)
               End If
           Next
           folderslistview.Sort()
           pgdblistview.Sort()
           filelistview.Sort()
           coverageslistview.Sort()
           gridslistview.Sort()
           fileslistview.Sort()
           listViewFiles.Items.Clear()
           listViewFiles.Sorting = SortOrder.None
           For Each itm As ListViewItem In folderslistview.Items
               listViewFiles.Items.Add(CType(itm.Clone, ListViewItem))
           Next
           For Each itm As ListViewItem In pgdblistview.Items
               listViewFiles.Items.Add(CType(itm.Clone, ListViewItem))
           Next
           For Each itm As ListViewItem In filelistview.Items
               listViewFiles.Items.Add(CType(itm.Clone, ListViewItem))
           Next
           For Each itm As ListViewItem In coverageslistview.Items
               listViewFiles.Items.Add(CType(itm.Clone, ListViewItem))
           Next
           For Each itm As ListViewItem In gridslistview.Items
               listViewFiles.Items.Add(CType(itm.Clone, ListViewItem))
           Next
           For Each itm As ListViewItem In fileslistview.Items
               listViewFiles.Items.Add(CType(itm.Clone, ListViewItem))
           Next
       End Sub
       Private Sub CreateFileDataSources(ByVal path As DirectoryInfo)
           '-- First check  for personal geodatabase
           Dim datasources As New DataSourceImages
           Dim datasourceimage As DataSourceImage
           GetDirectories(path.FullName, True)
           GeoDatabases(path)
           If Me.SearchTypeValue = SearchTypes.All Then
               MXDFiles(path, datasources)
               Shapefiles(path, datasources)
               CadFiles(path, datasources)
               SDCFiles(path, datasources)
               LyrFiles(path, datasources)
               ImagesFiles(path, datasources)
           End If
           For Each de As DictionaryEntry In datasources.Sortedlist
               datasourceimage = CType(de.Value, DataSourceImage)
               Additem(datasourceimage.File, datasourceimage.Datasource, datasourceimage.File.Extension.ToUpper.Substring(1), datasourceimage.ImageIndex)
           Next
       End Sub
  1. Region " Image Files "
       Private Sub ImagesFiles(ByVal path As DirectoryInfo, ByRef datasources As DataSourceImages)
           Dim extensions() As String = {"*.ECW", "*.TIF", "*.JPG", "*.SID", "*.BIL", "*.IMG", "*.JP2"} 'MLHIDE
           Dim files() As FileInfo
           Dim dataSource As FileSystem.File
           For Each ext As String In extensions
               files = path.GetFiles(ext)
               For Each file As FileInfo In files
                   dataSource = New FileSystem.File(file)
                   datasources.Add(New DataSourceImage(file, dataSource, 9))
                   'Additem(file, dataSource, 7)
               Next file
           Next ext
       End Sub
  1. End Region
  1. Region " Layer Files "
       Private Sub LyrFiles(ByVal path As DirectoryInfo, ByRef datasources As DataSourceImages)
           Dim files() As FileInfo
           Dim dataSource As FileSystem.ESRI.Layer
           files = path.GetFiles("*.lyr")                            'MLHIDE
           For Each file As FileInfo In files
               dataSource = New FileSystem.ESRI.Layer(file)
               datasources.add(New DataSourceImage(file, dataSource, 7))
               'Additem(file, dataSource, 7)
           Next file
       End Sub
  1. End Region
  1. Region " MXD Files "
       Private Sub MXDFiles(ByVal path As DirectoryInfo, ByRef datasources As DataSourceImages)
           Dim files() As FileInfo
           Dim dataSource As FileSystem.ESRI.ArcMapDocument
           files = path.GetFiles("*.mxd")                            'MLHIDE
           For Each file As FileInfo In files
               dataSource = New FileSystem.ESRI.ArcMapDocument(file)
               datasources.Add(New DataSourceImage(file, dataSource, 36))
               'Additem(file, dataSource, 36)
           Next file
       End Sub
  1. End Region
  1. Region "Load CAD Files"
       Private Sub CadFiles(ByVal path As DirectoryInfo, ByRef datasources As DataSourceImages)
           Dim arcObjectsFactory As ArcObjectsFactory = New ArcObjectsFactory
           Dim file As FileInfo
           Dim dataSource As IDataSource
           Dim workspacefactory As IWorkspaceFactory
           Dim workspace As IWorkspace
           Dim datasets As IEnumDatasetName
           Dim dataset As IDatasetName
           Try
               If ESRIWorkspace.IsCADWorkspaceFactory(path) Then
                   workspacefactory = arcObjectsFactory.CadFactory
                   workspace = workspacefactory.OpenFromFile(path.FullName, 0)
                   datasets = workspace.DatasetNames(esriDatasetType.esriDTAny)
                   dataset = datasets.Next
                   Do While Not dataset Is Nothing
                       file = New FileInfo(path.FullName & "\" & dataset.Name) 'MLHIDE
                       If dataset.Type = esriDatasetType.esriDTCadDrawing Then
                           dataSource = New FileSystem.ESRI.CADDrawing(file.Name, file.FullName)
                           datasources.add(New DataSourceImage(file, dataSource, 35))
                           'Additem(file, dataSource, 35)
                       Else
                           dataSource = New FileSystem.ESRI.CADDataset(file.Name, file.FullName, FileSystem.ESRI.ESRIFeatureTypes.FeatureDataset)
                           datasources.add(New DataSourceImage(file, dataSource, 11))
                           'Additem(file, dataSource, 11)
                       End If
                       dataset = datasets.Next
                   Loop
               End If
           Catch ex As Exception
           Finally
               arcObjectsFactory = Nothing
           End Try
       End Sub
  1. End Region
  1. Region "Load SDC Files"
       Private Sub SDCFiles(ByVal path As DirectoryInfo, ByRef datasources As DataSourceImages)
           Dim arcObjectsFactory As ArcObjectsFactory = New ArcObjectsFactory
           Dim file As FileInfo
           Dim dataSource As FileSystem.ESRI.SDC
           Dim workspacefactory As IWorkspaceFactory
           Dim workspace As IWorkspace
           Dim datasets As IEnumDatasetName
           Dim dataset As IDatasetName
           Dim subdatasetnames As IEnumDatasetName
           Dim subdatasetname As IDatasetName
           Dim featuredatasetname As IFeatureDatasetName
           If ESRIWorkspace.IsSDCWorkspaceFactory(path) Then
               workspacefactory = arcObjectsFactory.SDCFactory
               workspace = workspacefactory.OpenFromFile(path.FullName, 0)
               datasets = workspace.DatasetNames(esriDatasetType.esriDTAny)
               dataset = datasets.Next
               Do While Not dataset Is Nothing
                   'file = New FileInfo(path.FullName & "\" & dataset.Name)
                   featureClass = DirectCast(DirectCast(dataset, IName).Open, IFeatureClass)
                   'dataSource = New FileSystem.ESRI.SDC(file.Name, file.FullName, Conversion.ESRIFileTypes.DatasetNameType(dataset))
                   'datasources.Add(New DataSourceImage(file, dataSource, 12))
                   Additem(file, dataSource, 11)
                   'dataset = datasets.Next
                   file = New FileInfo(path.FullName & "\" & dataset.Name) 'MLHIDE
                   FeatureDatasetName = CType(dataset, IFeatureDatasetName)
                   subdatasetnames = FeatureDatasetName.FeatureClassNames
                   subdatasetname = subdatasetnames.Next
                   Do While Not subdatasetname Is Nothing
                       dataSource = New FileSystem.ESRI.SDC(file.Name, file.FullName, Conversion.ESRIFileTypes.DatasetNameType(subdatasetname))
                       datasources.Add(New DataSourceImage(file, dataSource, 12))
                       subdatasetname = subdatasetnames.Next
                   Loop
                   dataset = datasets.Next
               Loop
           End If
           arcObjectsFactory = Nothing
       End Sub
  1. End Region
  1. Region "Load Shapefiles"
       Private Sub Shapefiles(ByVal path As DirectoryInfo, ByRef datasources As DataSourceImages)
           Dim arcObjectsFactory As ArcObjectsFactory = New ArcObjectsFactory
           Dim file As FileInfo
           Dim dataSource As FileSystem.ESRI.Shapefile
           Dim workspacefactory As IWorkspaceFactory
           Dim workspace As IWorkspace
           Dim datasets As IEnumDatasetName
           Dim dataset As IDatasetName
           If ESRIWorkspace.IsShapefileWorkspaceFactory(path) Then
               workspacefactory = arcObjectsFactory.ShapefileFactory
               workspace = workspacefactory.OpenFromFile(path.FullName, 0)
               datasets = workspace.DatasetNames(esriDatasetType.esriDTAny)
               dataset = datasets.Next
               Do While Not dataset Is Nothing
                   Try
                       If dataset.Type = esriDatasetType.esriDTFeatureClass Then
                           file = New FileInfo(path.FullName & "\" & dataset.Name & ".shp") 'MLHIDE
                           dataSource = New FileSystem.ESRI.Shapefile(file.Name, file.FullName, Conversion.ESRIFileTypes.DatasetNameType(dataset))
                           datasources.Add(New DataSourceImage(file, dataSource, 10))
                           'Additem(file, dataSource, 10)
                       End If
                   Catch ex As Exception
                   End Try
                   dataset = datasets.Next
               Loop
           End If
           arcObjectsFactory = Nothing
       End Sub
       Private Function ShapefileDataSource(ByVal file As FileInfo) As FileSystem.ESRI.Shapefile
           Dim arcObjectsFactory As ArcObjectsFactory = New ArcObjectsFactory
           Dim datasource As FileSystem.ESRI.Shapefile
           Dim workspace As IWorkspace
           Dim featureWorkspace As IFeatureWorkspace
           Dim workspacefactory As IWorkspaceFactory
           Dim FeatureClass As IFeatureClass
           workspacefactory = arcObjectsFactory.ShapefileFactory
           Try
               workspace = workspacefactory.OpenFromFile(file.DirectoryName, 0)
               featureWorkspace = DirectCast(workspace, IFeatureWorkspace)
               FeatureClass = featureWorkspace.OpenFeatureClass(Path.GetFileNameWithoutExtension(file.FullName))
               datasource = New Encom.Compass.Common.DataSource.FileSystem.ESRI.Shapefile(file.Name, file.FullName, Conversion.ESRIFileTypes.FeatureClassFileType(FeatureClass.ShapeType))
           Catch ex As Exception
               datasource = Nothing
           Finally
               arcObjectsFactory = Nothing
           End Try
           Return datasource
       End Function
  1. End Region
  1. Region "Load Geodatabases"
       Private Sub GeoDatabases(ByVal path As DirectoryInfo)
           Dim extensions() As String = {"sde", "mdb"}               'MLHIDE
           Dim files() As FileInfo
           Dim dataSource As FileSystem.File
           If Me.SearchTypeValue <> SearchTypes.FileGeoDatabase AndAlso Me.SearchTypeValue <> SearchTypes.Folder Then
               If Me.SearchTypeValue = SearchTypes.PersonalGeodatabase Then
                   ReDim extensions(0)
                   extensions(0) = "mdb"                             'MLHIDE
               ElseIf Me.SearchTypeValue = SearchTypes.SDEGeodatabase Then
                   ReDim extensions(0)
                   extensions(0) = "sde"                             'MLHIDE
               End If


               For Each ext As String In extensions
                   files = path.GetFiles("*." & ext)                 'MLHIDE
                   For Each file As FileInfo In files
                       Dim subitem As String = PERSONAL_GEODATABASE
                       If file.Extension.ToUpper = ".SDE" Then       'MLHIDE
                           subitem = SPATIAL_DATABASE_CONNECTION
                       End If
                       dataSource = New FileSystem.File(file)
                       Additem(file, dataSource, subitem, 8)
                   Next file
               Next ext
           End If
       End Sub
  1. End Region
  1. Region "Load SDE Files"
       Private Sub SDE(ByVal path As DirectoryInfo)
           Dim arcObjectsFactory As ArcObjectsFactory = New ArcObjectsFactory
           Dim files() As FileInfo
           Dim dataSource As SpatialDataEngine
           Dim workspaceFactory As IWorkspaceFactory
           Dim workspace As IWorkspace
           files = path.GetFiles("*.sde")                            'MLHIDE
           For Each file As FileInfo In files
               workspaceFactory = arcObjectsFactory.SDEFactory
               Try
                   workspace = workspaceFactory.OpenFromFile(file.FullName, 0)
                   Dim server As String = ArcCommon.Workspace.Factory.SDEWorkspaceProperties(workspace, ArcCommon.Workspace.WorkspacePropertyEnum.Server)
                   Dim service As String = ArcCommon.Workspace.Factory.SDEWorkspaceProperties(workspace, ArcCommon.Workspace.WorkspacePropertyEnum.Instance)
                   Dim database As String = ArcCommon.Workspace.Factory.SDEWorkspaceProperties(workspace, ArcCommon.Workspace.WorkspacePropertyEnum.Database)
                   Dim sdeinstance As String = SDESQLInstances.InstanceName(workspace)
                   dataSource = New SpatialDataEngine(Utilities.RemovePath(file.Name))
                   dataSource.AddConnection(server, service, database, sdeinstance, True)
                   Additem(file, dataSource, file.Extension.ToUpper.Substring(1), 19)
               Catch
                   workspace = Nothing
               Finally
                   arcObjectsFactory = Nothing
               End Try
           Next file
       End Sub
  1. End Region
       Private Sub Additem(ByVal file As FileInfo, ByVal datasource As IDataSource, ByVal subitem As String, ByVal imageIndex As Integer)
           Dim item As ListViewItem
           item = listViewFiles.Items.Add(Utilities.RemovePath(file.FullName), imageIndex)
           item.UseItemStyleForSubItems = True
           item.Tag = datasource
           item.SubItems.Add(subitem)
       End Sub


  1. End Region
       Private Sub GetDirectories(ByVal path As String, ByVal testForDatasets As Boolean)
           '-- Get a list of the directories in the path.
           Dim directories() As String = System.IO.Directory.GetDirectories(path)
           Dim directory As String
           Dim directoryInfo As directoryInfo
           Dim item As ListViewItem
           Dim dataSource As DataSourceBase
           Dim arcInfoNames As New Hashtable
           Dim arcInfoGrids As New Hashtable
           Dim arcTins As New Hashtable
           Dim arcInfo As Boolean
           Dim grid As Boolean
           Dim tin As Boolean
           Dim filebased As Boolean
           Dim additem As Boolean = False


           arcInfoNames = ESRIWorkspace.ArcInfoCoverages(New DirectoryInfo(path))
           arcInfoGrids = ESRIWorkspace.ArcInfoGrids(New DirectoryInfo(path))
           arcTins = ESRIWorkspace.ArcInfoTins(New DirectoryInfo(path))
           For Each directory In directories
               additem = (Me.SearchTypeValue = SearchTypes.All)
               directoryInfo = New DirectoryInfo(directory)
               '-- check to see if directory is ESRI workspace
               arcInfo = arcInfoNames.Contains(New DirectoryInfo(directory).Name)
               grid = arcInfoGrids.Contains(New DirectoryInfo(directory).Name)
               tin = arcTins.Contains(New DirectoryInfo(directory).Name)
               filebased = ESRIWorkspace.IsFileDatabaseWorkspaceFactory(directoryInfo)
               item = Nothing
               dataSource = Nothing
               If testForDatasets Then
                   If ESRIWorkspace.IsFileDatabaseWorkspaceFactory(directoryInfo) Then
                       item = New ListViewItem(Utilities.RemovePath(directory), 8)
                       dataSource = New FileSystem.Directory(directoryInfo)
                       item.SubItems.Add(FILE_GEODATABASE)
                       If Me.SearchTypeValue = SearchTypes.FileGeoDatabase Then
                           additem = True
                       End If
                   ElseIf arcInfo And additem Then
                       item = New ListViewItem(Utilities.RemovePath(directory), 0)
                       dataSource = New FileSystem.ESRI.Coverage(directoryInfo)
                       item.SubItems.Add(ARCINFO_COVERAGE)
                       item.ImageIndex = 15
                   ElseIf grid And additem Then
                       item = New ListViewItem(Utilities.RemovePath(directory), 0)
                       dataSource = New FileSystem.ESRI.Grid(directoryInfo)
                       item.SubItems.Add(ARCINFO_GRID)
                       item.ImageIndex = 9
                   ElseIf tin And additem Then
                       item = New ListViewItem(Utilities.RemovePath(directory), 0)
                       dataSource = New FileSystem.ESRI.Tin(directoryInfo)
                       item.SubItems.Add("Tin Dataset")              'MLHIDE
                       item.ImageIndex = 33
                   End If
               ElseIf Not testForDatasets And Not grid And Not arcInfo And Not tin And Not filebased Then
                   additem = True
                   item = New ListViewItem(Utilities.RemovePath(directory), 0)
                   dataSource = New FileSystem.Directory(directoryInfo)
                   item.SubItems.Add(FOLDER)
               End If
               If item IsNot Nothing AndAlso dataSource IsNot Nothing And additem Then
                   listViewFiles.Items.Add(item)
                   item.UseItemStyleForSubItems = False
                   item.Tag = dataSource
               End If
               item = Nothing
           Next
       End Sub
       Private Sub FormCursor(ByVal cursor As Windows.Forms.Cursor)
           Me.Cursor = cursor
           Me.Refresh()
       End Sub
  1. Region " Load SDE Nodes "
       Private Sub LoadSDENodes(ByVal sdeNode As UltraTreeNode)
           Dim node As UltraTreeNode
           '-- Read registry for sde values
           TreeDirectories.BeginUpdate()
           sdeNode.Nodes.Clear()
           If (sdeNode.Key = "") Then
               For Each sdeValue As DictionaryEntry In GetLocalConnections()
                   If Not sdeNode.Nodes.Contains(sdeValue.Key.ToString) Then
                       node = sdeNode.Nodes.Add(sdeValue.Key.ToString, sdeValue.Key.ToString)
                       node.Override.NodeAppearance.Image = 19
                       node.Tag = sdeValue.Value
                   End If
               Next sdeValue
           End If
           TreeDirectories.EndUpdate()
       End Sub
       Private Function GetLocalConnections() As Hashtable
           Dim result As New Hashtable
           Dim directory As New DirectoryInfo(SDEDatabaseLocation)
           For Each file As FileInfo In directory.GetFiles(SDESearchPattern)
               result.Add(System.IO.Path.GetFileNameWithoutExtension(file.Name), file.FullName)
           Next
           Return result
       End Function
  1. End Region
  1. Region " LoadTreeNodes "
       Private Function LoadTreeNodes(ByVal parentNode As UltraTreeNode, ByVal loadDirectories As Boolean, ByVal loadFiles As Boolean) As Boolean
           Try
               Dim node As UltraTreeNode = Nothing
               Dim uncName As String = " "                           'MLHIDE
               If (parentNode.Key = "") Then
                   Dim drives() As String = System.Environment.GetLogicalDrives 'Directory.GetLogicalDrives
                   TreeDirectories.BeginUpdate()
                   Dim drive As String
                   For Each drive In drives
                       uncName = New String(Space, 100)
                       Utilities.WNetGetConnection(drive.Substring(0, 2), uncName, 100)
                       uncName = uncName.Substring(0, uncName.IndexOf(Space))
                       If uncName.Length > 0 Then
                           uncName = uncName.Substring(0, uncName.Length - 1) '& "\"
                           If Not parentNode.Nodes.Exists(uncName.ToLower) Then
                               node = parentNode.Nodes.Add(uncName.ToLower, uncName)      'parentNode.Nodes.Add(drive.ToLower(), drive)
                               node.Tag = uncName
                           End If
                       Else
                           If Not parentNode.Nodes.Exists(drive.ToLower) Then
                               node = parentNode.Nodes.Add(drive.ToLower, drive)   'parentNode.Nodes.Add(drive.ToLower(), drive)
                               node.Tag = drive
                           End If
                       End If
                       If Not node Is Nothing Then
                           node.Override.ShowExpansionIndicator = ShowExpansionIndicator.Always
                           If (drive = "A:\") Then                   'MLHIDE
                               node.Override.NodeAppearance.Image = 3
                           Else
                               Dim driveType As Integer = Utilities.GetDriveTypeApi(drive)
                               Select Case (driveType)
                                   Case Utilities.DRIVE_CDROM, Utilities.DRIVE_REMOVABLE
                                       node.Override.NodeAppearance.Image = 5
                                   Case Utilities.DRIVE_FIXED
                                       node.Override.NodeAppearance.Image = 4
                                   Case Utilities.DRIVE_REMOTE
                                       node.Override.NodeAppearance.Image = 14
                                   Case Else
                                       node.Override.ReserveImageSpace = DefaultableBoolean.True
                               End Select
                           End If
                       End If
                   Next
                   TreeDirectories.EndUpdate()
               Else
                   If (loadDirectories = True Or loadFiles = True) Then
                       TreeDirectories.BeginUpdate()
                       Dim childNode As UltraTreeNode
                       For Each childNode In parentNode.Nodes
                           childNode.Text = ""
                       Next
                       If (loadDirectories) Then
                           Dim directories() As String = Nothing
                           Dim Directory As String
                           Try
                               If System.IO.Directory.Exists(parentNode.Key) Then
                                   directories = System.IO.Directory.GetDirectories(parentNode.Key)
                               End If
                           Catch ex As IOException
                           End Try
                           If Not directories Is Nothing Then
                               For Each Directory In directories
                                   If (parentNode.Nodes.Exists(Directory)) Then
                                       parentNode.Nodes(Directory).Text = Utilities.RemovePath(Directory)
                                       parentNode.Nodes(Directory).Override.ShowExpansionIndicator = ShowExpansionIndicator.Always
                                   Else
                                       If Not parentNode.Nodes.Exists(Directory.ToLower) Then
                                           node = parentNode.Nodes.Add(Directory.ToLower, Utilities.RemovePath(Directory))
                                           node.Tag = Directory
                                           node.Override.ShowExpansionIndicator = ShowExpansionIndicator.Always
                                           node.Override.NodeAppearance.Image = 0
                                       End If
                                   End If
                               Next
                           End If
                       End If
                       '-- Load the files contained within the parent node.
                       If (loadFiles) Then
                           Dim files() As String = Directory.GetFiles(parentNode.Key)
                           Dim file As String
                           For Each file In files
                               If (parentNode.Nodes.Exists(file)) Then
                                   parentNode.Nodes(file).Text = Utilities.RemovePath(file)
                               Else
                                   If Not parentNode.Nodes.Exists(file.ToLower) Then
                                       node = parentNode.Nodes.Add(file.ToLower, Utilities.RemovePath(file))
                                       node.Tag = file
                                       node.Override.NodeAppearance.Image = 1
                                   End If
                               End If
                           Next
                       End If
                       'Remove all the child nodes that have blank text.
                       Dim childNodes() As Object = parentNode.Nodes.All
                       Dim childNode2 As UltraTreeNode
                       For Each childNode2 In childNodes
                           If (childNode2.Text = "") Then
                               parentNode.Nodes.Remove(childNode2)
                           End If
                           'We're finished adding entries to the tree so tell the tree to update its UI.
                           TreeDirectories.EndUpdate()
                       Next
                   End If
                   End If
                   Return True
           Catch ex As Exception
               Return False
           Finally
               'We're finished adding entries to the tree so tell the tree to update its UI.
               TreeDirectories.EndUpdate()
           End Try
       End Function
  1. End Region
  1. Region " SelectPathInTree "
       Private Function SelectPathInTree(ByVal path As String) As Boolean
           'Try to find the requested path in the tree.  If it has already been loaded, select it and bring it 
           'into view.
           Dim nodeToSelect As UltraTreeNode = TreeDirectories.GetNodeByKey(path.ToLower())
           Dim result As Boolean = False
           Try
               If Not (nodeToSelect Is Nothing) Then
                   'If reSelectNode And nodeToSelect.Selected Then
                   If nodeToSelect.Selected Then
                       nodeToSelect.Selected = False
                   End If
                   nodeToSelect.Selected = True
                   nodeToSelect.BringIntoView()
                   result = True
                   Exit Function
               End If
               'Need to load tree nodes for each directory along the path.  First, get each folder
               'in the path.
               Dim pathParts() As String
               Dim newtorkParts() As String
               Dim i As Integer
               If path.Substring(0, 2) = "\\" Then                   'MLHIDE
                   newtorkParts = path.Substring(2).Split(New Char() {Char.Parse("\")}, 100) 'MLHIDE
                   ReDim pathParts(newtorkParts.Length - 2)
                   pathParts(0) = "\\" & newtorkParts(0) & "\" & newtorkParts(1) 'MLHIDE
                   For i = 2 To newtorkParts.Length - 1
                       pathParts(i - 1) = newtorkParts(i)
                   Next
               Else
                   pathParts = path.Split(New Char() {Char.Parse("\")}, 100) 'MLHIDE
                   pathParts(0) = pathParts(0) & "\"                 'MLHIDE
               End If
               '-- Set the 'last node' equal to the node that represents the drive portion of the path.
               Dim lastNode As UltraTreeNode = TreeDirectories.GetNodeByKey(pathParts(0).ToLower())
               If (lastNode Is Nothing) Then Return False
               '-- Iterate through each folder in the path and reload the child nodes for the folder.
               Dim pathWork As String = pathParts(0)
               For i = 1 To pathParts.Length - 1
                   'Load the child nodes for the 'last node' processed.
                   LoadTreeNodes(lastNode, True, False)
                   If pathWork.Substring(pathWork.Length - 1, 1) = "\" Then 'MLHIDE
                       pathWork += pathParts(i)
                   Else
                       pathWork += "\" + pathParts(i)                'MLHIDE
                   End If
                   'Rset the 'last node' equal to the current folder's node.
                   lastNode = TreeDirectories.GetNodeByKey(pathWork.ToLower())
                   If (lastNode Is Nothing) Then Return False
               Next
               'Now try to select the requested path in the tree.
               nodeToSelect = TreeDirectories.GetNodeByKey(path.ToLower())
               If Not (nodeToSelect Is Nothing) Then
                   nodeToSelect.Selected = True
                   'If TreeDirectories.Visible Then
                   nodeToSelect.BringIntoView()
                   'End If
               result = True
               End If
           Catch ex As Exception
               result = False
           End Try
           Return result
       End Function


  1. End Region
  1. Region " SetToolbarButtonsEnabledStatus"


  1. End Region
  1. End Region
  1. Region " Private Properties "
  1. Region " CurrentPath "
       Private Property CurrentPath() As String
           Get
               If (CurrentPathIndex < 0 Or CurrentPathIndex > (pathsVisited.Count - 1)) Then
                   Return String.Empty
               End If
               Return CType(pathsVisited(CurrentPathIndex), String)
           End Get
           Set(ByVal Value As String)
               If (Value <> CurrentPath) Then
                   Dim pathAlreadyVisited As Boolean = False
                   'See if we already have visited the path being set.  If so, adjust the current path index
                   'to point ot that path.
                   Dim i As Integer
                   For i = 0 To pathsVisited.Count - 1
                       If (String.Compare(Value, pathsVisited(i).ToString, True) = 0) Then
                           CurrentPathIndex = i
                           pathAlreadyVisited = True
                       End If
                   Next
                   'If we haven't already visited the path, remove all entries in our 'visited paths' list
                   'that follow the current entry, and add an entry for the new path.
                   If (pathAlreadyVisited = False) Then
                       'Remove all entries following the current path entry.
                       For i = CurrentPathIndex + 1 To pathsVisited.Count - 2
                           Try
                               pathsVisited.RemoveAt(i)
                           Catch ex As Exception
                           End Try
                       Next
                       CurrentPathIndex = pathsVisited.Add(Value)
                   End If
                   'Update the UI to reflect the new path.
                   If Not (AddressComboTool Is Nothing) Then
                       SetAddressComboText(Value)
                   End If
                   LoadListViewWithDetails(Value, True, True)
               End If
           End Set
       End Property
  1. End Region
  1. Region " CurrentPathIndex"
       Private Property CurrentPathIndex() As Integer
           Get
               Return mvarCurrentPathIndex
           End Get
           Set(ByVal Value As Integer)
               mvarCurrentPathIndex = Value
           End Set
       End Property
  1. End Region
  1. End Region
       Private Sub LoadSDELayers(ByVal browsePath As String)
           Dim textValue As String = ml_string(59, "Database Connection -- ") & Path.GetFileNameWithoutExtension(browsePath)
           CurrentPath = browsePath
           SetAddressComboText(textValue)
           TreeDirectories.Visible = False
           FormCursor(Cursors.WaitCursor)
           ESRIWorkspace.SDEDataSets(New FileInfo(browsePath), listViewFiles, SDESQLInstances)
           FormCursor(Cursors.Default)
       End Sub
       Private Sub LoadFileGeodatabaseDatasets(ByVal browsePath As String)
           CurrentPath = browsePath
           FormCursor(Cursors.WaitCursor)
           ESRIWorkspace.FileGeodatabaseDatasets(New DirectoryInfo(browsePath), listViewFiles, SDESQLInstances)
           FormCursor(Cursors.Default)
       End Sub
       Private Sub LoadMDBLayers(ByVal browsePath As String)
           CurrentPath = browsePath
           FormCursor(Cursors.WaitCursor)
           ESRIWorkspace.MDBDatasets(New FileInfo(browsePath), listViewFiles, SDESQLInstances)
           FormCursor(Cursors.Default)
       End Sub
       Private Sub SetAddressComboText(ByVal textValue As String)
           Dim item As New Infragistics.Win.ValueListItem
           item.DisplayText = textValue
           item.DataValue = "ValueListItem"                          'MLHIDE
           item.DisplayText = textValue
           Dim ValueList1 As Infragistics.Win.ValueList = New Infragistics.Win.ValueList(0)
           ValueList1.ValueListItems.Add(item)
           AddressComboTool.ValueList.DisplayStyle = ValueListDisplayStyle.DisplayText
           AddressComboTool.ValueList = ValueList1
           AddressComboTool.SelectedIndex = 0
       End Sub


   End Class

End Namespace