private async void LoginButton_Click(object sender, EventArgs e) { loginButton.Enabled = false; try { await GlobalServices.XjtuSite.Account.LoginAsync(userNameView.Text, passwordView.Text); // ±£´æÉèÖᣠusing (var pref = GetPreferences(FileCreationMode.Private)) { var edit = pref.Edit(); var savePassword = savePasswordCheckBox.Checked; edit.PutString("userName", userNameView.Text); edit.PutString("password", savePassword ? passwordView.Text : ""); edit.PutBoolean("savePassword", savePassword); edit.Commit(); } GlobalServices.SaveState(); DroidUtility.ShowToast(this, "µÇ¼³É¹¦¡£"); } catch (Exception ex) { DroidUtility.ReportException(this, ex); } finally { loginButton.Enabled = true; } }
public async Task <bool> UpdateAccountStatus() { if (GlobalServices.XjtuSite.Account.IsInvalidated) { DroidUtility.ShowToast(this, "ÕýÔÚ²éѯµÇ¼״̬¡¡"); await GlobalServices.XjtuSite.Account.UpdateAsync(); } if (GlobalServices.XjtuSite.Account.IsLoggedIn) { var intent = new Intent(this, typeof(MainActivity)); StartActivity(intent); this.Finish(); return(true); } return(false); }