Guest User

Untitled

a guest
Oct 22nd, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. using System;
  2.  
  3. using Xamarin.Forms;
  4. using Xamarin.Forms.Xaml;
  5.  
  6. using MyStore.Services;
  7. using MyStore.Models;
  8.  
  9. namespace MyStore.EmployeesApp.Pages
  10. {
  11. [XamlCompilation(XamlCompilationOptions.Compile)]
  12. public partial class LoginPage : ContentPage
  13. {
  14. public LoginPage ()
  15. {
  16. InitializeComponent ();
  17. }
  18.  
  19. public async void SignInButton_Clicked(object sender, EventArgs e)
  20. {
  21. var username = UserNameEntry.Text;
  22. var password = PasswordEntry.Text;
  23.  
  24. var employee = await StoreWebApiClient.Instance.Login(username, password);
  25.  
  26. if (employee != default(EmployeeDTO))
  27. {
  28. App.CurrentEmployee = employee;
  29. await DisplayAlert("Welcome!", $"Welcome {employee.FullName}", "OK");
  30. await Navigation.PushAsync(new CustomerListPage());
  31. }
  32. else
  33. {
  34. await DisplayAlert("Error!", "Wrong credentials!", "OK");
  35. }
  36. }
  37. }
  38. }
Add Comment
Please, Sign In to add comment