private async void Signup_Clicked(object sender, EventArgs e) { signup.BackgroundColor = Color.LightCyan; AzureService az_serv = new AzureService(); var user = new User { firstName = FirstName.Text, username = Username.Text, role = Role.Text, password = Password.Text, registrationNo = RegistrationNo.Text, myclass = ClassName.Text, mycourse = CourseName.Text }; IsBusy = true; try { await az_serv.AddUser(user); await Navigation.PushModalAsync(new NavigationPage(new LoginPage())); } catch (Exception ex) { await this.DisplayAlert("Error", "Failed to Register: " + ex.Message, "OK"); } finally { IsBusy = false; } }
async Task ExecuteAddCoffeeCommandAsync(string first, string second, string em, string pass, string phone) { string confirm = conf_Pass.Text; azureService = new AzureService(); if (IsBusy) { return; } bool exists; try { IsBusy = true; exists = await azureService.CheckUser(em); if (exists == false) { if (pass == confirm) { var coffee = await azureService.AddUser(first, second, em, pass, phone); Coffees.Add(coffee); await DisplayAlert("Alert", "Account Created", "Ok"); await Navigation.PushAsync(new MenuPage(first)); } else { await DisplayAlert("Alert", "Passwords do not match!", "Ok"); } } } catch (Exception ex) { Debug.WriteLine("da error: " + ex); } finally { IsBusy = false; } }