Clean up drag+drop handling in MainDiscoForm

This commit is contained in:
YoshiRulz 2021-10-02 05:03:32 +10:00 committed by James Groom
parent a514effba7
commit df5ef0ec2d
1 changed files with 8 additions and 6 deletions

View File

@ -35,26 +35,28 @@ namespace BizHawk.Client.DiscoHawk
private void lblMagicDragArea_DragDrop(object sender, DragEventArgs e)
{
List<string> files = ValidateDrop(e.Data);
if (files.Count == 0) return;
lblMagicDragArea.AllowDrop = false;
Cursor = Cursors.WaitCursor;
try
{
Cursor = Cursors.WaitCursor;
foreach (var file in files)
foreach (var file in ValidateDrop(e.Data))
{
var success = DiscoHawkLogic.HawkAndWriteFile(
inputPath: file,
errorCallback: err => MessageBox.Show(err, "Error loading disc"));
if (!success) break;
}
Cursor = Cursors.Default;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Error loading disc");
throw;
}
finally
{
lblMagicDragArea.AllowDrop = true;
Cursor = Cursors.Default;
}
}
#if false // API has changed