43 lines
No EOL
2.1 KiB
VB.net
43 lines
No EOL
2.1 KiB
VB.net
Public Class Preset_Directory_Manager
|
|
Private Sub Preset_Directory_Manager_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
If My.Settings.PresetDirectories.Count = 1 AndAlso My.Settings.PresetDirectories(0).Length = 0 Then
|
|
My.Settings.PresetDirectories(0) = My.Computer.FileSystem.SpecialDirectories.MyDocuments
|
|
My.Settings.Save()
|
|
End If
|
|
DirBox.Items.Clear()
|
|
For i = 0 To My.Settings.PresetDirectories.Count - 1
|
|
DirBox.Items.Add(My.Settings.PresetDirectories(i))
|
|
Next
|
|
End Sub
|
|
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
FolderBrowserDialog1.ShowDialog()
|
|
If My.Computer.FileSystem.DirectoryExists(FolderBrowserDialog1.SelectedPath) Then DirBox.Items.Add(FolderBrowserDialog1.SelectedPath) Else MsgBox("Couldn't access " & FolderBrowserDialog1.SelectedPath & ". Notepad Ultra may not have access rights.")
|
|
End Sub
|
|
|
|
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
|
|
Dim response As String = InputBox("Path to add:")
|
|
If My.Computer.FileSystem.DirectoryExists(response) Then DirBox.Items.Add(response) Else MsgBox("Couldn't access " & response & ". Notepad Ultra may not have access rights, or the directory may not exist.")
|
|
End Sub
|
|
|
|
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
|
|
My.Settings.PresetDirectories.Clear()
|
|
For i = 0 To DirBox.Items.Count - 1
|
|
My.Settings.PresetDirectories.Add(DirBox.Items(i).ToString)
|
|
Next
|
|
If DirBox.Items.Count > 0 Then
|
|
My.Settings.Save()
|
|
Button4.PerformClick()
|
|
Else
|
|
MsgBox("The list must contain at least one preset directory.")
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
|
|
Close()
|
|
End Sub
|
|
|
|
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
|
If MsgBox("Are you sure you want to remove " & DirBox.SelectedItem.ToString & " from the list of preset directories?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then DirBox.Items.RemoveAt(DirBox.SelectedIndex)
|
|
End Sub
|
|
End Class |