PageRenderTime 25ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/Source Code/PowerSong/Export and Import/frmImportPresenter.vb

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