I have a while loop inside a delegate method that is called. My issue is that while it is inside the while loop the whole GUI is frozen until it exits the while loop. How can I make it so it does not freeze the GUI? Thanks
if (!IsUploadingAvailable())
{
MessageBox.Show("Uploading is not available, please wait until it is ready!", "Upload not available");
myButton.Enabled = false;
while (IsUploadingAvailable())
{
Thread.Sleep(RandomAmountOfTime(10000));
}
MessageBox.Show("Uploading is now available!");
}