Guest User

Untitled

a guest
Nov 23rd, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. using System;
  2. using System.ComponentModel;
  3. using System.Runtime.CompilerServices;
  4. using System.Threading.Tasks;
  5. using System.Windows.Input;
  6. using ButtonCommandBinding.Views;
  7. using Xamarin.Forms;
  8.  
  9. namespace ButtonCommandBinding.ViewModel
  10. {
  11. public class LoginViewModel : INotifyPropertyChanged
  12. {
  13.  
  14. public ICommand LoginCommand { get; private set; }
  15. public LoginViewModel()
  16. {
  17.  
  18. LoginCommand = new Command
  19. (async () => await LogUser());
  20.  
  21. }
  22.  
  23.  
  24. public event PropertyChangedEventHandler PropertyChanged;
  25. public void OnPropertyChanged([CallerMemberName] string propertyName = null)
  26. {
  27. var handler = PropertyChanged;
  28. handler?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  29. }
  30.  
  31. private string user;
  32. public string User
  33. {
  34. get => user;
  35. set
  36. {
  37. if (user != value) { user = value; }
  38. OnPropertyChanged();
  39. }
  40. }
  41. private string pass;
  42. public string Pass
  43. {
  44. get => pass;
  45. set
  46. {
  47. if (pass != value) { pass = value; }
  48. OnPropertyChanged();
  49. }
  50. }
  51.  
  52. async Task LogUser()
  53. {
  54. // call function to call the webservices;
  55. // bool igetusernameandpasswordastrueorfalse = new MyWebServices(User,Pass);
  56.  
  57. await App.Current.MainPage.Navigation.PushModalAsync(new DashBoardPage());
  58. }
  59.  
  60. }
  61. }
Add Comment
Please, Sign In to add comment