I have an application that allows data to be dragged and dropped into it, before performing a potentially very long operation upon it. This works fine, however, the Explorer window freezes whilst my application is processing. Is there any way to "release" it so to speak as soon as I have taken a copy of the file list?
My current code is:
private void MainForm_DragDrop(object sender, DragEventArgs e)
{
ClearTempFiles(); //Clear all files before populating
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); //Get the filepaths for the dragdrop data
List<string> toParse = new List<string>();
foreach (string file in files)
{
FileAttributes attr = File.GetAttributes(file);
if (attr.HasFlag(FileAttributes.Directory)) //If a folder has been included, add all files from within
{
toParse.AddRange(DirSearch(file));
}
else
{
toParse.Add(file); //Add files
}
}
CurrentJobData = new JobData(toParse); //Create new JobData from these files <---- Takes up to a few minutes with hundreds of files.
CurrentJobData.ToTree(treeView1); //Push this data to the TreeView
} //Handles the dragdrop of data, populating the solution