Esempio n. 1
0
        private async Task ExecuteRegistroCommand()
        {
            bool isRegistroSuccess = false;

            if (IsBusy)
            {
                return;
            }

            IsBusy = true;
            registroCommand.ChangeCanExecute();

            try
            {
                //  isRegistroSuccess = await cpFeeds.GetAccessToken(this.UserName, this.Password);

                isRegistroSuccess =
                    await
                    cpFeeds.PostIncluirUsuario(this.Email, this.UserName, this.FirstName, this.LastName,
                                               this.Password, this.ConfirmPassword);
            }
            catch (Exception ex)
            {
                isRegistroSuccess = false;
            }

            finally
            {
                IsBusy = false;
                registroCommand.ChangeCanExecute();
            }

            if (isRegistroSuccess)
            {
                await page.Navigation.PushModalAsync(new RootPage());

                if (Device.OS == TargetPlatform.Android)
                {
                    Application.Current.MainPage = new RootPage();
                }
            }
            else
            {
                await page.DisplayAlert("Erro no Registro", "Erro ao tentar registrar! por favor tente novamente", "Ok");
            }
        }