private void Button_Click(object sender, RoutedEventArgs e) { if (txtUserName.Text == "" || txtPassword.Password == "") { //BindingExpression beUserName = txtUserName.GetBindingExpression(TextBox.TextProperty); //beUserName.UpdateSource(); mMessageChildWindow = new MessageChildWindow((int)Globals.Message.LoginError); mMessageChildWindow.Show(); } else { btLogin.IsEnabled = false; Globals.UserName = txtUserName.Text; Globals.Password = txtPassword.Password; ConfigurationSettings.KeepPassword = (bool)chkKeepPWD.IsChecked; ConfigurationSettings.AutoLogin = (bool)chkAutoLogin.IsChecked; busyIndicator.IsBusy = true; if (ConfigurationSettings.UserName == "") { GetToken(txtUserName.Text, txtPassword.Password); } else { if (ConfigurationSettings.UserName == txtUserName.Text && ConfigurationSettings.Password == txtPassword.Password) { VerifyCredentialsLogin("xml"); } else { GetToken(txtUserName.Text, txtPassword.Password); } } } }
private void client_VerifyCredentialsLoginCompleted(object sender, VerifyCredentialsCompletedEventArgs e) { try { if (e.Result != null) { ConfigurationSettings.UserName = txtUserName.Text; ConfigurationSettings.Password = txtPassword.Password; Globals.UserInformation = e.Result; NavigationService.Navigate(new Uri(String.Format("/Home"), UriKind.Relative)); } else { mMessageChildWindow = new MessageChildWindow((int)Globals.Message.VerifyError); mMessageChildWindow.Show(); } } catch (Exception) { busyIndicator.IsBusy = false; btLogin.IsEnabled = true; } }
private void client_GetTokenCompleted(object sender, GetTokenCompletedEventArgs e) { try { if (e.Result != null) { foreach (TokenKeyCollection resultKey in e.Result) { ConfigurationSettings.TokenKey = resultKey.TokenKeyString; ConfigurationSettings.TokenKeySecret = resultKey.TokenKeySecretString; ConfigurationSettings.UserName = txtUserName.Text; ConfigurationSettings.Password = txtPassword.Password; } VerifyCredentialsLogin("xml"); } else { mMessageChildWindow = new MessageChildWindow((int)Globals.Message.VerifyError); mMessageChildWindow.Show(); } } catch (Exception) { busyIndicator.IsBusy = false; btLogin.IsEnabled = true; } }