I'm using a background image to change the language of my application, it needs to show a gif in a picturebox while it is changing the language.
The code I use looks as follow:
private void pbNL_Click(object sender, EventArgs e)
{
var bwchangelanguageNL = new BackgroundWorker();
bwchangelanguageNL.DoWork += bwchangelanguageNL_DoWork;
bwchangelanguageNL.RunWorkerCompleted += bwchangelanguageNL_RunWorkerCompleted;
bwchangelanguageNL.RunWorkerAsync();
}
void bwchangelanguageNL_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
pbLoading.Visible = false;
}
void bwchangelanguageNL_DoWork(object sender, DoWorkEventArgs e)
{
pbLoading.Visible = true;
const int countryLanguage = 1;
ChangeLanguage(countryLanguage);
}
When I press the pbNL button(Click event) nothing happens. Why does nothing happen? The backgroundworker gets started with RunWorkerAsync on button click.
The picturebox with gif doesn't show up and the language doesn't change.
Edit
The DoWork event and the RunWorkerCompleted event get both called, so calling the events isn't the problem.