Hi, you are on right track, you could use Backgroundworker for this purpose with ease, just remember some thing while working with multithread is that, we cannot access UI elements directly from another thread.
And as entire code that's executed in Backgroundworker is in another thread we cannot access or modify them, hence when you write your logic in Backgroundworker implement logic such that we do not have to use UI elements or if its needed you can access them before i.e in your case
Quote:
string username = txtUsername.Text;
string password = txtPassword.Password;
make username & password as global variable & assign the value before
Quote:
backgroundWorker.RunWorkerAsync();
or else when using such
Quote:
lblInvalidText.Content = "Invalid Account Information";
you have to let Dispatcher (basically your UI thread) know that you are changing any of there elements, hence you need to write that code in
Dispatcher.BeginInvoke(DispatcherPriority.Send,new Action(()=>{
});
For more information on Dispatcher you can check out this
link