Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.ComponentModel;
- using System.Runtime.CompilerServices;
- using System.Threading.Tasks;
- using System.Windows.Input;
- using ButtonCommandBinding.Views;
- using Xamarin.Forms;
- namespace ButtonCommandBinding.ViewModel
- {
- public class LoginViewModel : INotifyPropertyChanged
- {
- public ICommand LoginCommand { get; private set; }
- public LoginViewModel()
- {
- LoginCommand = new Command
- (async () => await LogUser());
- }
- public event PropertyChangedEventHandler PropertyChanged;
- public void OnPropertyChanged([CallerMemberName] string propertyName = null)
- {
- var handler = PropertyChanged;
- handler?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
- private string user;
- public string User
- {
- get => user;
- set
- {
- if (user != value) { user = value; }
- OnPropertyChanged();
- }
- }
- private string pass;
- public string Pass
- {
- get => pass;
- set
- {
- if (pass != value) { pass = value; }
- OnPropertyChanged();
- }
- }
- async Task LogUser()
- {
- // call function to call the webservices;
- // bool igetusernameandpasswordastrueorfalse = new MyWebServices(User,Pass);
- await App.Current.MainPage.Navigation.PushModalAsync(new DashBoardPage());
- }
- }
- }
Add Comment
Please, Sign In to add comment