async Task Save()
        {
            if (IsBusy)
            {
                return;
            }

            try
            {
                var results = Validate();
                if (results.Count > 0)
                {
                    SetResults(results);
                    return;
                }

                IsBusy = true;
                await AuthenticationService.SignupAsync(Username, FirstName, LastName, Email, Password);

                IsBusy = false;

                NavigateTo <LoginViewModel>();
            }
            catch (Exception ex)
            {
                ExceptionsManager.Manage(this, ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Esempio n. 2
0
        async void SendCart()
        {
            try
            {
                IsBusy = true;
                await CartService.SendCartAsync();

                Movies.Clear();
                Refresh();
                IsBusy = false;
            }
            catch (Exception ex)
            {
                ExceptionsManager.Manage(this, ex);
            }
        }
        public override async void OnViewAppearing()
        {
            if (TopRatedMovies != null && TopRatedMovies.Count > 0)
            {
                return;
            }

            try
            {
                IsBusy = true;
                var movies = await MoviesService.GetTopRatedAsync();

                TopRatedMovies = new ObservableCollection <Movie>(movies);
                IsBusy         = false;
            }
            catch (Exception ex)
            {
                ExceptionsManager.Manage(this, ex);
            }
        }
        async Task Login()
        {
            if (IsBusy)
            {
                return;
            }

            try
            {
                var results = Validate();
                if (results.Count > 0)
                {
                    SetResults(results);
                    return;
                }

                IsBusy = true;
                var user = await AuthenticationService.LoginAsync(Username, Password);

                IsBusy = false;

                if (user == null)
                {
                    IsBusy = false;
                    SetResult(new ErrorResult(Localize("Usuario o contraseña incorrectos")));
                    return;
                }

                NavigateTo <MainMenuViewModel>();
            }
            catch (Exception ex)
            {
                ExceptionsManager.Manage(this, ex);
            }
            finally
            {
                IsBusy = false;
            }
        }