private void LoginComplete(LoadOperation op)
{
if (op.HasError)
{
// Remove the error information the RIA domain services framework adds in and that will just confuse things.
string errorMessage = Regex.Replace(op.Error.Message, @"Load operation failed .*?\.", "");
WriteLoginMessage("Error logging in." + errorMessage);
op.MarkErrorAsHandled();
UIHelper.SetText(m_passwordTextBox, String.Empty);
}
else if (op.Entities.Count() == 0)
{
WriteLoginMessage("Login failed.");
UIHelper.SetText(m_passwordTextBox, String.Empty);
}
else
{
var user = op.Entities.SingleOrDefault() as User;
Authenticated(user.Name, null);
//Authenticated(m_loginUsername, null);
}
}