Fix dragndrop cursor getting stuck when main thread is busy

This commit is contained in:
N00MKRAD
2024-11-08 12:07:43 +01:00
parent b1b7c0b46a
commit 9bd1736fec
3 changed files with 9 additions and 15 deletions

View File

@@ -674,12 +674,14 @@ namespace Flowframes.Forms.Main
private void Form1_DragEnter(object sender, DragEventArgs e) { e.Effect = DragDropEffects.Copy; }
private void Form1_DragDrop(object sender, DragEventArgs e)
private async void Form1_DragDrop(object sender, DragEventArgs e)
{
DragDropHandler((string[])e.Data.GetData(DataFormats.FileDrop));
var files = (string[])e.Data.GetData(DataFormats.FileDrop);
await Task.Delay(1); // Release drop
DragDropHandler(files);
}
public void DragDropHandler(string[] files)
public void DragDropHandler(string[] files, bool first = true)
{
if (Program.busy) return;
@@ -689,13 +691,12 @@ namespace Flowframes.Forms.Main
{
SetTab(interpOptsTab.Name);
queueBtn_Click(null, null);
if (BatchProcessing.currentBatchForm != null)
BatchProcessing.currentBatchForm.LoadDroppedPaths(files, start);
BatchProcessing.currentBatchForm?.LoadDroppedPaths(files, start);
}
else
{
SetTab(interpOptsTab.Name);
Logger.Log("Selected video/directory: " + Path.GetFileName(files[0]), true);
Logger.Log($"Selected video/directory: {Path.GetFileName(files[0])}", true);
inputTbox.Text = files[0];
bool resume = Directory.Exists(files[0]) && IoUtils.GetAmountOfFiles(Path.Combine(files[0], Paths.resumeDir), true, "*.json") > 0;

View File

@@ -1,11 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Flowframes.Forms

View File

@@ -381,8 +381,8 @@ namespace Flowframes.Main
public static Fraction AskForFramerate(string mediaName, bool isImageSequence = true)
{
string text = $"Please enter an input frame rate to use for{(isImageSequence ? " the image sequence" : "")} '{mediaName.Trunc(80)}'.";
PromptForm form = new PromptForm("Enter Frame Rate", text, "15");
string text = $"Please enter the source frame rate for{(isImageSequence ? " the image sequence" : "")} '{mediaName.Trunc(80)}'.";
var form = new PromptForm("Enter Frame Rate", text, "15");
form.ShowDialog();
return new Fraction(form.EnteredText);
}