/// <summary> /// Process the given username and password. /// </summary> public void ProcessLogin() { var result = 0; Task.Factory.StartNew(() => { ToggleLayout(); _username = _usernameEditText.Text; _password = _passwordEditText.Text; result = CredentialsProvider.Login(_application, _username, _password); ToggleLayout(); }).ContinueWith(task => { ProcessResult(result); }, TaskScheduler.FromCurrentSynchronizationContext()); }