Skip to content

Commit 8a9d656

Browse files
committed
[PTBase] Allow multiselect for OFD
1 parent 26cbe6a commit 8a9d656

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

Helpers/IUserInterfaceInterop.vb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
''' <summary>
1010
''' Shows a file picker to open a file
1111
''' </summary>
12-
''' <returns>The path of the chosen file</returns>
12+
''' <param name="MultiSelect">Whether to allow file picker to select multiple files</param>
13+
''' <returns>The path, or paths, of the chosen file</returns>
1314
''' <remarks></remarks>
14-
Function ShowOpenFileDialog() As String
15+
Function ShowOpenFileDialog(Optional MultiSelect As Boolean = False) As Object
1516

1617
''' <summary>
1718
''' Shows a file picker to save a file

Helpers/PreparationTasks/PreparationTask.vb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,21 @@ Namespace Helpers.PreparationTasks
4141
''' <summary>
4242
''' Shows a file picker to open a file
4343
''' </summary>
44-
''' <returns>The path of the chosen file</returns>
44+
''' <param name="MultiSelect">Whether to allow file picker to select multiple files</param>
45+
''' <returns>The path, or paths, of the chosen file</returns>
4546
''' <remarks></remarks>
46-
Public Function ShowOpenFileDialog() As String Implements IUserInterfaceInterop.ShowOpenFileDialog
47+
Public Function ShowOpenFileDialog(Optional MultiSelect As Boolean = False) As Object Implements IUserInterfaceInterop.ShowOpenFileDialog
4748
Dim ofd As New OpenFileDialog() With {
48-
.SupportMultiDottedExtensions = True
49+
.SupportMultiDottedExtensions = True,
50+
.Multiselect = MultiSelect
4951
}
5052

5153
If ofd.ShowDialog() = DialogResult.OK Then
52-
Return ofd.FileName
54+
If MultiSelect Then
55+
Return ofd.FileNames
56+
Else
57+
Return ofd.FileName
58+
End If
5359
End If
5460
Return ""
5561
End Function

0 commit comments

Comments
 (0)