public MainPage() { InitializeComponent(); var user = LoginActivity.LoadUser(); if (user.Name == null || user.Pass == null) { return; } LoginActivity.AttemptLogin(user); GoToMenu(user); }
private void Submit_OnClicked(object sender, EventArgs e) { bool sw = _sc.On; string url = _ec.Text; if (string.IsNullOrEmpty(url)) { DisplayAlert("Warning", "Url must not be empty.", "OK"); return; } if (sw == false) { LoginActivity.DeleteUser(); DisplayAlert("Success", "Login settings removed.", "OK"); return; } LoginActivity.SaveUser(_user); DisplayAlert("Success", "Login settings saved.", "OK"); }
private void ButtonLogin_OnClicked(object sender, EventArgs e) { User user; try { user = new User(EntryUsername.Text, EntryPassword.Text) { Save = RememberSwitch.On }; user = LoginActivity.AttemptLogin(user); } catch (Exception ex) { DisplayAlert("Exception", ex.ToString(), "Uh-oh!"); return; } if (RememberSwitch.On) { LoginActivity.SaveUser(user); } GoToMenu(user); }