Imports AxSftDirectoryLib25
Imports SftDirectoryLib25
Imports Softelvdm.OLEConvert
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'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 using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Panel1 As System.Windows.Forms.Panel
Friend WithEvents AxSftDirectoryRight As AxSftDirectoryLib25.AxSftDirectory
Friend WithEvents Splitter1 As System.Windows.Forms.Splitter
Friend WithEvents AxSftDirectoryLeft As AxSftDirectoryLib25.AxSftDirectory
Friend WithEvents StatusBar As System.Windows.Forms.StatusBar
Friend WithEvents ButtonUp As System.Windows.Forms.Button
Friend WithEvents ButtonProp As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents ButtonNewFolder As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
Me.Panel1 = New System.Windows.Forms.Panel
Me.AxSftDirectoryRight = New AxSftDirectoryLib25.AxSftDirectory
Me.Splitter1 = New System.Windows.Forms.Splitter
Me.AxSftDirectoryLeft = New AxSftDirectoryLib25.AxSftDirectory
Me.StatusBar = New System.Windows.Forms.StatusBar
Me.ButtonUp = New System.Windows.Forms.Button
Me.ButtonProp = New System.Windows.Forms.Button
Me.Label1 = New System.Windows.Forms.Label
Me.ButtonNewFolder = New System.Windows.Forms.Button
Me.Panel1.SuspendLayout()
CType(Me.AxSftDirectoryRight, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.AxSftDirectoryLeft, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Panel1
'
Me.Panel1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.Panel1.Controls.Add(Me.AxSftDirectoryRight)
Me.Panel1.Controls.Add(Me.Splitter1)
Me.Panel1.Controls.Add(Me.AxSftDirectoryLeft)
Me.Panel1.Location = New System.Drawing.Point(0, 40)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(704, 392)
Me.Panel1.TabIndex = 11
'
'AxSftDirectoryRight
'
Me.AxSftDirectoryRight.ContainingControl = Me
Me.AxSftDirectoryRight.Dock = System.Windows.Forms.DockStyle.Fill
Me.AxSftDirectoryRight.Location = New System.Drawing.Point(208, 0)
Me.AxSftDirectoryRight.Name = "AxSftDirectoryRight"
Me.AxSftDirectoryRight.OcxState = CType(resources.GetObject("AxSftDirectoryRight.OcxState"), System.Windows.Forms.AxHost.State)
Me.AxSftDirectoryRight.Size = New System.Drawing.Size(492, 388)
Me.AxSftDirectoryRight.TabIndex = 1
'
'Splitter1
'
Me.Splitter1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.Splitter1.Location = New System.Drawing.Point(200, 0)
Me.Splitter1.Name = "Splitter1"
Me.Splitter1.Size = New System.Drawing.Size(8, 388)
Me.Splitter1.TabIndex = 12
Me.Splitter1.TabStop = False
'
'AxSftDirectoryLeft
'
Me.AxSftDirectoryLeft.ContainingControl = Me
Me.AxSftDirectoryLeft.Dock = System.Windows.Forms.DockStyle.Left
Me.AxSftDirectoryLeft.Location = New System.Drawing.Point(0, 0)
Me.AxSftDirectoryLeft.Name = "AxSftDirectoryLeft"
Me.AxSftDirectoryLeft.OcxState = CType(resources.GetObject("AxSftDirectoryLeft.OcxState"), System.Windows.Forms.AxHost.State)
Me.AxSftDirectoryLeft.Size = New System.Drawing.Size(200, 388)
Me.AxSftDirectoryLeft.TabIndex = 0
'
'StatusBar
'
Me.StatusBar.Location = New System.Drawing.Point(0, 438)
Me.StatusBar.Name = "StatusBar"
Me.StatusBar.Size = New System.Drawing.Size(704, 16)
Me.StatusBar.TabIndex = 10
'
'ButtonUp
'
Me.ButtonUp.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.ButtonUp.Location = New System.Drawing.Point(248, 8)
Me.ButtonUp.Name = "ButtonUp"
Me.ButtonUp.Size = New System.Drawing.Size(32, 24)
Me.ButtonUp.TabIndex = 2
Me.ButtonUp.Text = "Up"
'
'ButtonProp
'
Me.ButtonProp.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.ButtonProp.Location = New System.Drawing.Point(288, 8)
Me.ButtonProp.Name = "ButtonProp"
Me.ButtonProp.Size = New System.Drawing.Size(72, 24)
Me.ButtonProp.TabIndex = 3
Me.ButtonProp.Text = "Properties"
'
'Label1
'
Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.Location = New System.Drawing.Point(8, 8)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(232, 32)
Me.Label1.TabIndex = 7
Me.Label1.Text = "Simple Explorer Sample"
'
'ButtonNewFolder
'
Me.ButtonNewFolder.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.ButtonNewFolder.Location = New System.Drawing.Point(368, 8)
Me.ButtonNewFolder.Name = "ButtonNewFolder"
Me.ButtonNewFolder.Size = New System.Drawing.Size(72, 24)
Me.ButtonNewFolder.TabIndex = 4
Me.ButtonNewFolder.Text = "New Folder"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(704, 454)
Me.Controls.Add(Me.ButtonNewFolder)
Me.Controls.Add(Me.Panel1)
Me.Controls.Add(Me.StatusBar)
Me.Controls.Add(Me.ButtonUp)
Me.Controls.Add(Me.ButtonProp)
Me.Controls.Add(Me.Label1)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "Form1"
Me.Text = "SimpleExplorer - Softel vdm, Inc."
Me.Panel1.ResumeLayout(False)
CType(Me.AxSftDirectoryRight, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.AxSftDirectoryLeft, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
'--locate-marker--
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' call this to update the buttons
UpdateLeftButtons()
UpdateRightButtons()
AxSftDirectoryRight.MakeColumnsOptimal()
End Sub
Private Sub AxSftDirectoryLeft_SelectionFinal(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxSftDirectoryLeft.SelectionFinal
' If the selection in the left tree changes, update right side detaillist
UpdateLeftButtons()
AxSftDirectoryRight.Clear()
AxSftDirectoryRight.CancelMode()
AxSftDirectoryRight.Refresh()
If Not AxSftDirectoryLeft.CurrentFolder Is Nothing Then
AxSftDirectoryRight.TopMostFolderIDL = AxSftDirectoryLeft.CurrentFolder.ItemIDList
Else
AxSftDirectoryRight.TopMostFolderSpecial = SftDirectorySpecialFolderConstants.specialSftDirectoryEmpty
End If
End Sub
Private Sub AxSftDirectoryRight_Opening(ByVal sender As Object, ByVal e As AxSftDirectoryLib25._ISftDirectoryEvents_OpeningEvent) Handles AxSftDirectoryRight.Opening
Dim F As SftDirectoryFolder
Dim IDL As String
' we're about to open a file/folder. If we can add the folder on the
' left side, that means we don't need to open it in a separate window
IDL = e.folder.ItemIDList ' the folder we are looking for
' this will add the complete hierarchy down to the folder in
' left tree (if possible)
On Error Resume Next
F = AxSftDirectoryLeft.get_FolderUsingIDL(IDL, False)
On Error GoTo 0
' this will locate the exact item if we just added it
F = AxSftDirectoryLeft.get_FolderUsingIDL(IDL, True)
If Not F Is Nothing Then
' The folder has been added on the left side
F.MakeCurrent() ' make it the current item
F.MakeVisible() ' make sure it's scrolled into view
e.allow = False ' no need to open it
End If
End Sub
Private Sub AxSftDirectoryRight_SelectionFinal(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxSftDirectoryRight.SelectionFinal
UpdateRightButtons()
If Not AxSftDirectoryRight.CurrentFolder Is Nothing Then
StatusBar.Text = AxSftDirectoryRight.CurrentFolder.InfoTip
Else
StatusBar.Text = ""
End If
End Sub
Private Sub UpdateLeftButtons()
' Update the buttons dependent on the left tree
Dim F As SftDirectoryFolder
' Enable/disable Up button
F = AxSftDirectoryLeft.CurrentFolder
If Not F Is Nothing Then
F = F.Parent
End If
ButtonUp.Enabled = Not F Is Nothing
End Sub
Private Sub UpdateRightButtons()
' Update the buttons dependent on the right side detaillist
Dim F As SftDirectoryFolder
' Enable/disable properties button
F = AxSftDirectoryRight.CurrentFolder
ButtonProp.Enabled = False
If AxSftDirectoryRight.SelectionCount > 0 And Not F Is Nothing Then
If F.Can("properties") Then
ButtonProp.Enabled = True
End If
End If
' Enable/disable New Folder button
ButtonNewFolder.Enabled = False
F = AxSftDirectoryRight.RootFolder
If Not F Is Nothing Then
If F.Can("NewFolder") Then
ButtonNewFolder.Enabled = True
End If
End If
End Sub
Private Sub ButtonUp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonUp.Click
' Move up on level in left side tree control
Dim F As SftDirectoryFolder
F = AxSftDirectoryLeft.CurrentFolder
If Not F Is Nothing Then
F = F.Parent
If Not F Is Nothing Then
F.MakeCurrent() ' make it the current item
F.MakeVisible() ' make sure it's scrolled into view
End If
End If
End Sub
Private Sub ButtonProp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonProp.Click
' Display properties dialog for the currently selected item
Dim F As SftDirectoryFolder
F = AxSftDirectoryRight.CurrentFolder
If AxSftDirectoryRight.SelectionCount > 0 And Not F Is Nothing Then
F.Do("properties")
End If
End Sub
Private Sub ButtonNewFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonNewFolder.Click
' Create a new folder
Dim F As SftDirectoryFolder
F = AxSftDirectoryRight.RootFolder
If Not F Is Nothing Then
On Error Resume Next
F.Do("NewFolder")
End If
End Sub
Private Sub AxSftDirectoryLeft_KeyDownEvent(ByVal sender As Object, ByVal e As AxSftDirectoryLib25._ISftDirectoryEvents_KeyDownEvent) Handles AxSftDirectoryLeft.KeyDownEvent
' F5 automatically reloads left side, but we also want right side updated
If e.keyCode = Keys.F5 Then AxSftDirectoryRight.Reload(True, True)
End Sub
Private Sub AxSftDirectoryRight_KeyDownEvent(ByVal sender As Object, ByVal e As AxSftDirectoryLib25._ISftDirectoryEvents_KeyDownEvent) Handles AxSftDirectoryRight.KeyDownEvent
' F5 automatically reloads right side, but we also want left side updated
If e.keyCode = Keys.F5 Then AxSftDirectoryLeft.Reload(True, True)
End Sub
End Class