Before my main form loads it asks the user to check for updates. When they click ok i make the main form show and make a panel that contains some labels and a picture box with an animated gif.
The animated gif is not moving which normally is because the main thread is busy but I have threaded the thread doing the work and no luck getting the animation to play.
Here is what I have.
Thread CheckVersion = new Thread(new ThreadStart(VersionCheck));
this.Show(); //bring up the main form
this.BringToFront();
pCheckingVersions.Visible = true; //this contains the animated gif
Application.DoEvents(); //refresh ui so my box
CheckVersion.Start(); //start thread
CheckVersion.Join(); //wait for thread to exit before moving on
pDownloading.Visible = false;
The CheckVersion.Join() call is making your UI thread wait for the CheckVersion thread to complete, which blocks. That makes the GIF animation pause.
Try using the BackgroundWorker class, and use the RunWorkerCompleted
event to signal to your UI thread that the background operation is done.