/Source Code/PowerSong/Export and Import/frmImportPresenter.vb
Visual Basic | 49 lines | 33 code | 13 blank | 3 comment | 0 complexity | e1029bdb7c995f08353151908b7eb2f1 MD5 | raw file
1Imports System.Windows.Forms 2Imports PowerSong.SongDatabase 3Imports PowerSong.SongDatabase.ExportImport 4 5Public Class frmImportPresenter 6 7 Private FDatabase As Database 8 9 Public Sub New(ByVal database As Database) 10 InitializeComponent() 11 FDatabase = database 12 End Sub 13 14 Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click 15 16 ' Check a folder has been selected 17 If txtLocation.Text = "" Then 18 MsgBox("Please select the location of a Presenter collection of songs.", MsgBoxStyle.Exclamation) 19 Exit Sub 20 End If 21 22 Try 23 24 ' Perform the import 25 Call (New PresenterImport(FDatabase, chkIncludeSubFolders.Checked)).Import(txtLocation.Text) 26 27 ' Finished 28 MsgBox("The import was completed without any errors.", MsgBoxStyle.Information) 29 Me.DialogResult = System.Windows.Forms.DialogResult.OK 30 Me.Close() 31 32 Catch ex As Exception 33 MsgBox("There was an error during the import:" + Environment.NewLine + ex.Message, MsgBoxStyle.Critical) 34 End Try 35 36 End Sub 37 38 Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click 39 Me.DialogResult = System.Windows.Forms.DialogResult.Cancel 40 Me.Close() 41 End Sub 42 43 Private Sub btnSelectLocation_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelectLocation.Click 44 If dlgSelectLocation.ShowDialog = Windows.Forms.DialogResult.OK Then 45 txtLocation.Text = dlgSelectLocation.SelectedPath 46 End If 47 End Sub 48 49End Class