Beispiel #1
0
        private async void Save()
        {
            string x = DateTime.Now.ToString("yyyy:MM:dd:HH:mm:ss");

            UserDialogs.Instance.ShowLoading("Espere");
            stream?.Seek(0, SeekOrigin.Begin);
            await ServiceWebApi.UpdateUser(App.User, stream, x);

            App.User = await ServiceWebApi.GetUser(App.User.IdUser.Value, x);

            UserDialogs.Instance.HideLoading();
            MainViewModels.GetInstance().Home = new HomeViewModel();
            await App.Current.MainPage.DisplayAlert("Información", "Perfil actualizado", "Aceptar");

            await App.Current.MainPage.Navigation.PopAsync();
        }
Beispiel #2
0
        private async void Next()
        {
            UserDialogs.Instance.ShowLoading("Espere");
            var data = await ServiceWebApi.InsertUser(this.User);

            if (data == null)
            {
                UserDialogs.Instance.HideLoading();
                await App.Current.MainPage.DisplayAlert("Error", "Tu registro no fue aceptado", "Aceptar");

                this.User = null;
            }
            UserDialogs.Instance.HideLoading();
            await App.Current.MainPage.DisplayAlert("Bienvenido", $"Es momento de ingresar {data.Name}", "Aceptar");

            MainViewModels.GetInstance().Login = new LoginViewModel();
            this.User = null;
            await App.Current.MainPage.Navigation.PopToRootAsync();
        }
Beispiel #3
0
        private async void Login()
        {
            UserDialogs.Instance.ShowLoading("Espere");
            if (string.IsNullOrEmpty(Nick))
            {
                Nick     = string.Empty;
                Password = string.Empty;
                await App.Current.MainPage.DisplayAlert("Error", "Debes completar los campos", "Aceptar");

                UserDialogs.Instance.HideLoading();
                return;
            }
            if (string.IsNullOrEmpty(Password))
            {
                Password = string.Empty;
                await App.Current.MainPage.DisplayAlert("Error", "Debes completar los campos", "Aceptar");

                UserDialogs.Instance.HideLoading();
                return;
            }

            App.User = await ServiceWebApi.GetUserByCredentials(Nick, Password);

            if (App.User != null)
            {
                Nick     = string.Empty;
                Password = string.Empty;
                MainViewModels.GetInstance().Home = new HomeViewModel();
                await App.Current.MainPage.Navigation.PushAsync(new HomePage(), true);

                UserDialogs.Instance.HideLoading();
            }
            else
            {
                Nick     = string.Empty;
                Password = string.Empty;
                UserDialogs.Instance.HideLoading();
                await App.Current.MainPage.DisplayAlert("Error", "Credenciales no válidas", "Aceptar");
            }
        }