Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Application.Exit() from non UI Thread

$
0
0

Our application has a System.Thread for checking for updates. 

Thread _updateThread = new Thread(() => CheckForUpdates());
_updateThread.IsBackground = true;
_UpdateThread.Start();

When an update is found we start our update process downloads the update, then needs to close the application so it can run the msi.  The thread shows the user a message to let them know there's an update then starts the install.  The problem is the thread calls Application.Exit(), but it does not close the application.

private static bool DownloadDoneStartUpdate()
{
   if(UpdateActive())
   {
      StartUpdateProcess();
      Application.Exit();
      return true;
   }
   else
      return false;
}

How do I get a System.Thread to close the application?

Thanks in advance,

Scott


Viewing all articles
Browse latest Browse all 31927

Trending Articles