Skip to content

Commit

Permalink
#12 Some improvements to drag and drop .PRG loading
Browse files Browse the repository at this point in the history
  • Loading branch information
hagronnestad committed Oct 14, 2019
1 parent 1c109fb commit c09188f
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions ComputerSystems/Commodore64/FormC64Screen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,19 +380,23 @@ private void BtnReset_Click(object sender, EventArgs e) {
C64.Cpu.Reset();
}

private void pScreen_DragDropAsync(object sender, DragEventArgs e) {
private async void pScreen_DragDropAsync(object sender, DragEventArgs e) {
if (e.Data.GetData(DataFormats.FileDrop) is string[] d && d.Length > 0) {
if (!File.Exists(d.First())) return;

await C64.Cpu.Pause();
LoadPrg(d.First());
}
C64.Cpu.Resume();

// TODO: Fix this hack
this.Focus();
SendKeys.SendWait("r");
SendKeys.SendWait("u");
SendKeys.SendWait("n");
SendKeys.SendWait("{ENTER}");
// TODO: Fix this RUN hack
while (!Focused) {
Focus();
}
SendKeys.SendWait("r");
SendKeys.SendWait("u");
SendKeys.SendWait("n");
SendKeys.SendWait("{ENTER}");
}
}

private void pScreen_DragEnter(object sender, DragEventArgs e) {
Expand Down

0 comments on commit c09188f

Please sign in to comment.