public LoginPageViewModel(INavigationService navigationService, IPageDialogService pageDialogService)
        {
            _navigationService = navigationService;

            loginModel = new LoginModel();

            try
            {
                SaveLoginCommand = new DelegateCommand(async() =>
                {
                    if (ConnectionValidation.HaveInternetConnection())
                    {
                        await LoginValidations(loginModel);
                    }
                    else
                    {
                        await pageDialogService.DisplayAlertAsync(ErrorCodes.Error, ErrorCodes.NoInternet, ErrorCodes.Cancel);
                    }
                });

                ToRegisterPageCommand = new DelegateCommand(async() =>
                {
                    await ToRegisterPage();
                });
            }
            catch (Exception ex)
            {
                pageDialogService.DisplayAlertAsync(ErrorCodes.Error, ex.Message, ErrorCodes.Cancel);
            }
        }
Example #2
0
 public RegisterPageViewModel(INavigationService navigationService, IPageDialogService pageDialogService)
 {
     registerModel = new RegisterModel();
     try
     {
         SaveRegisterCommand = new DelegateCommand(async() =>
         {
             if (ConnectionValidation.HaveInternetConnection())
             {
                 await RegisterValidations(registerModel);
             }
             else
             {
                 await pageDialogService.DisplayAlertAsync(ErrorCodes.Error, ErrorCodes.NoInternet, ErrorCodes.Cancel);
             }
         });
     }
     catch (Exception ex)
     {
         pageDialogService.DisplayAlertAsync(ErrorCodes.Error, ex.Message, ErrorCodes.Cancel);
     }
 }