public UsersPage() { var vm = new UsersViewModel(); this.BindingContext = vm; vm.DisplaySaveSucessPrompt += () => DisplayAlert("Success", "New User has been registered successfully", "OK"); vm.DisplayUserExistPrompt += () => DisplayAlert("Error", "The username has already been registered", "OK"); vm.DisplaySaveFailedPrompt += () => DisplayAlert("Error", "User registration failed, Please try again", "OK"); vm.DisplayRequriedFieldPrompt += () => DisplayAlert("Error", "User, Password, Firstname and Lastname Fields are required", "OK"); InitializeComponent(); Username.Completed += (object sender, EventArgs e) => { Password.Focus(); }; Password.Completed += (object sender, EventArgs e) => { Firstname.Focus(); }; Firstname.Completed += (object sender, EventArgs e) => { Lastname.Focus(); }; Lastname.Completed += (object sender, EventArgs e) => { Phonenumber.Focus(); }; Phonenumber.Completed += (object sender, EventArgs e) => { vm.SubmitCommand.Execute(null); }; }
public PatientsPage() { //var vm = new PatientsViewModel(); //this.BindingContext = vm; InitializeComponent(); BindingContext = _viewModel = new PatientsViewModel(); _viewModel.DisplayClientAlreadyRegisteredPrompt += () => DisplayAlert("Error", "The Patient is Aready Registered", "OK"); _viewModel.DisplayRegistrationSuccessPrompt += () => DisplayAlert("Success", "The Patient has been registered successfully", "OK"); _viewModel.DisplayRegistrationFailedPrompt += () => DisplayAlert("Error", "User registration failed, Please try again", "OK"); _viewModel.DisplayRequiredFieldPrompt += () => DisplayAlert("Error", "OPD Number, First Name, Last Name and Village Fields are required", "OK"); _viewModel.activity = activity; Opdnumber.Completed += (object sender, EventArgs e) => { Firstname.Focus(); }; Firstname.Completed += (object sender, EventArgs e) => { Lastname.Focus(); }; Housenumber.Completed += (object sender, EventArgs e) => { Village.Focus(); }; Village.Completed += (object sender, EventArgs e) => { Phonenumber.Focus(); }; Phonenumber.Completed += (object sender, EventArgs e) => { _viewModel.SubmitCommand.Execute(null); }; }
private void SetupEventHandlers() { Email.Completed += (sender, e) => { Phonenumber.Focus(); }; Phonenumber.Completed += (sender, e) => { Password.Focus(); }; Password.Completed += (sender, e) => { RePassword.Focus(); }; RePassword.Completed += (sender, e) => { SignupBtn.Focus(); }; }