示例#1
0
        public async Task SendGetRequst(string path, bool IsOnlyBackGround = false, bool isHeader = false)
        {
            using (var client = new HttpClient())
            {
                Console.WriteLine("Send Get Request");
                client.BaseAddress = new Uri(host);

                if (!IsOnlyBackGround)
                {
                    await PopupNavigation.PushAsync(loading);
                }
                HttpResponseMessage response = await client.GetAsync(path);

                if (isHeader)
                {
                    client.DefaultRequestHeaders.Add("Accept", "application/json");
                    client.DefaultRequestHeaders.Add("Authorization", usermodel.user.token_type + " " + usermodel.user.access_token);
                    Console.WriteLine("Header Seted");
                }

                string responseBody = await response.Content.ReadAsStringAsync();

                Console.WriteLine("Result: " + responseBody);
                j_resul = responseBody;
                if (!IsOnlyBackGround)
                {
                    PopupNavigation.RemovePageAsync(loading);
                }
                ServerResult = response.IsSuccessStatusCode;
            }
        }
示例#2
0
 protected override bool OnBackButtonPressed()
 {
     try
     {
         if (PopupNavigation.PopupStack[0] == popup_phone)
         {
             PopupNavigation.RemovePageAsync(popup_phone, true);
             return(true);
         }
         else if (PopupNavigation.PopupStack[0] == popup_name)
         {
             PopupNavigation.RemovePageAsync(popup_name, true);
             return(true);
         }
         else if (PopupNavigation.PopupStack[0] == popup_delivery)
         {
             PopupNavigation.RemovePageAsync(popup_delivery, true);
             return(true);
         }
         else
         {
             Global.isOpen_AdressModal = false;
             BasketTabPage.isOpenPage  = false;
             return(base.OnBackButtonPressed());
         }
     }
     catch
     {
         BasketTabPage.isOpenPage = false;
         return(false);
     }
 }
示例#3
0
        private async void cancel_event(object sender, EventArgs e)
        {
            cancel_event_button.IsEnabled = false;
            await PopupNavigation.RemovePageAsync(this);

            cancel_event_button.IsEnabled = false;
        }
        private async void Cancel_Event(object sender, System.EventArgs e)
        {
            cancel_button.IsEnabled = false;
            await PopupNavigation.RemovePageAsync(this);

            cancel_button.IsEnabled = true;
        }
示例#5
0
        async void ValidarCodigo(Entry txtCodigo, Entry txtUsuarioCambioClave, Frame frameCodigo, Button btnConfirmarCodigo,
                                 Frame frameNuevaClave, Frame frameConfirmarNuevaClave, Button btnCambiarClave)
        {
            detailLoading = "Validando código...";
            LoadingPage loadingCodigo = new LoadingPage(detailLoading);
            await PopupNavigation.PushAsync(loadingCodigo);

            await Task.Delay(2000);

            var getUsersClaveCambio = await data.GetUsuariosCambioClave();

            var userCodigo = getUsersClaveCambio.Where(x => x.NombreUsuario == txtUsuarioCambioClave.Text)
                             .Select(y => y.CodigoCambio).FirstOrDefault();

            if (userCodigo == int.Parse(txtCodigo.Text))
            {
                await PopupNavigation.RemovePageAsync(loadingCodigo);

                titleCorrect  = "Código correcto";
                detailCorrect = "Validación exitosa. Puede proceder a cambiar su contraseña.";
                await results.Success(titleCorrect, detailCorrect);

                ControlesNuevaClave(frameCodigo, btnConfirmarCodigo, frameNuevaClave, frameConfirmarNuevaClave, btnCambiarClave);
            }
            else
            {
                await PopupNavigation.RemovePageAsync(loadingCodigo);

                titleError  = "Error";
                detailError = "El código ingresado no es correcto. Intente nuevamente.";
                await results.Unsuccess(titleError, detailError);
            }
        }
示例#6
0
        private async void delete_mark(object sender, System.EventArgs e)
        {
            delete_button.IsEnabled = false;
            busyindicator.IsVisible = true;
            bool connection = true;

            try
            {
                await fireBaseHelperMark.DeleteMark(_mark.MarkID);
            }
            catch (Exception)
            {
                connection = false;
            }
            if (connection)
            {
                await Navigation.PushAsync(new SubjectSelected(_subject), false);

                busyindicator.IsVisible = false;
                Navigation.RemovePage(Navigation.NavigationStack[Navigation.NavigationStack.Count - 1]);
                await PopupNavigation.RemovePageAsync(this);
            }
            else
            {
                busyindicator.IsVisible = false;
                await DisplayAlert("Something went wrong...", "Please check your interner connection", "OK");

                PopupNavigation.RemovePageAsync(this);
            }
        }
        private async void Save_Event(object sender, System.EventArgs e)
        {
            save_button.IsEnabled = false;
            ErrorName.IsVisible   = false;

            string name = event_name.Text;
            string desc = event_description.Text;

            start_Date = new DateTime(startDate.Date.Year, startDate.Date.Month, startDate.Date.Day, startTimePicker.Time.Hours, startTimePicker.Time.Minutes, startTimePicker.Time.Seconds);
            end_Date   = new DateTime(endDate.Date.Year, endDate.Date.Month, endDate.Date.Day, endTimePicker.Time.Hours, endTimePicker.Time.Minutes, endTimePicker.Time.Seconds);
            checkDates(start_Date, end_Date);
            Color colorEvent = colorSelected(color);

            if (!string.IsNullOrEmpty(name) && !string.IsNullOrWhiteSpace(name))
            {
                try
                {
                    await fireBaseHelper.AddEvent(name, desc, start_Date, end_Date, colorEvent);

                    await PopupNavigation.RemovePageAsync(this);
                }
                catch (Exception)
                {
                }
            }
            else
            {
                ErrorName.IsVisible = true;
            }
            save_button.IsEnabled = true;

            // repopulating the calendar
            await SimplePage.Instance.refreshCalendar();
        }
示例#8
0
        private async void Save_Account(object sender, EventArgs e)
        {
            busyindicator.IsVisible       = true;
            save_profile_button.IsEnabled = false;
            bool validate = true;

            ErrorName.IsVisible    = false;
            ErrorInstite.IsVisible = false;

            if (string.IsNullOrEmpty(userName.Text) || string.IsNullOrWhiteSpace(userName.Text))
            {
                validate                = false;
                ErrorName.IsVisible     = true;
                busyindicator.IsVisible = false;
            }
            if (validate)
            {
                if (string.IsNullOrWhiteSpace(userInstitute.Text) || string.IsNullOrEmpty(userInstitute.Text))
                {
                    validate = false;
                    ErrorInstite.IsVisible  = true;
                    busyindicator.IsVisible = false;
                }
            }
            if (validate)
            {
                bool connection = true;
                try
                {
                    var studentToEdit = await fireBaseHelperStudent.GetStudent(user.StudentID);
                }
                catch (Exception)
                {
                    connection = false;
                }
                try
                {
                    await fireBaseHelperStudent.UpdateAccount(user.StudentID, userName.Text, userInstitute.Text);
                }
                catch (Exception)
                {
                    connection = false;
                }
                if (connection)
                {
                    busyindicator.IsVisible = false;
                    await Navigation.PushAsync(new MyAccount(), false);

                    Navigation.RemovePage(Navigation.NavigationStack[Navigation.NavigationStack.Count - 1]);
                    await PopupNavigation.RemovePageAsync(this);
                }
                else
                {
                    busyindicator.IsVisible = false;
                    await DisplayAlert("Something went wrong...", "Please check your interner connection", "OK");
                }
            }
            save_profile_button.IsEnabled = true;
        }
        public static async Task Load(Task task)
        {
            var loadingPage = new PopUpLoadingPage();
            await PopupNavigation.PushAsync(loadingPage);

            await task;
            await PopupNavigation.RemovePageAsync(loadingPage);
        }
示例#10
0
 public void HideProgress()
 {
     if (progressDialog != null)
     {
         PopupNavigation.RemovePageAsync(progressDialog);
         progressDialog = null;
     }
 }
示例#11
0
        public async Task ShowExampleAsync(string message, string exampleImage, string acceptButtonText)
        {
            var tcs   = new TaskCompletionSource <bool>();
            var alert = new ExamplePopup(tcs, message, exampleImage, acceptButtonText);
            await PopupNavigation.PushAsync(alert);

            await tcs.Task;
            await PopupNavigation.RemovePageAsync(alert);
        }
示例#12
0
        /*public async Task ShowTermsAndConditionsAsync(string title, string termsAndConditions, string continueButtonText)
         * {
         *  var tcs = new TaskCompletionSource<bool>();
         *  var alert = new TermsAndConditionsPopUp(tcs, title, termsAndConditions, continueButtonText);
         *  await PopupNavigation.PushAsync(alert);
         *  await tcs.Task;
         *  await PopupNavigation.RemovePageAsync(alert);
         * }*/

        public async Task ShowTermsAndConditionsAsync(string title, string termsAndConditions, string title2, string privacity, string continueButtonText)
        {
            var tcs   = new TaskCompletionSource <bool>();
            var alert = new TermsAndConditionsPopUp(tcs, title, termsAndConditions, title2, privacity, continueButtonText);
            await PopupNavigation.PushAsync(alert);

            await tcs.Task;
            await PopupNavigation.RemovePageAsync(alert);
        }
示例#13
0
        private async void EditEvent(object sender, EventArgs e)
        {
            edit_event_button.IsEnabled = false;
            await PopupNavigation.RemovePageAsync(this);

            await PopupNavigation.PushAsync(new EditCalendarEvent(appointment, sourcePage));

            edit_event_button.IsEnabled = true;
        }
示例#14
0
        /// <summary>
        /// Shows the error list async.
        /// </summary>
        /// <returns>The error list async.</returns>
        /// <param name="errorList">Error list.</param>
        /// <param name="acceptButtonText">Accept button text.</param>
        public async Task ShowErrorListAsync(IList <string> errorList, string acceptButtonText)
        {
            var tcs   = new TaskCompletionSource <bool>();
            var alert = new AlertPopup(tcs, NotificationType.Error, ToErrorString(errorList), acceptButtonText);
            await PopupNavigation.PushAsync(alert);

            await tcs.Task;
            await PopupNavigation.RemovePageAsync(alert);
        }
示例#15
0
        /// <summary>
        /// Hides the progress async.
        /// </summary>
        /// <returns>The progress async.</returns>
        public async Task HideProgressAsync(bool animate = false)
        {
            if (progressDialog != null)
            {
                await Task.Delay(1000);

                await PopupNavigation.RemovePageAsync(progressDialog, animate);
            }
        }
示例#16
0
        public async Task ShowSuccessMessageAsync(string message, string acceptButtonText)
        {
            var tcs   = new TaskCompletionSource <bool>();
            var alert = new AlertPopup(tcs, NotificationType.Success, message, acceptButtonText);
            await PopupNavigation.PushAsync(alert);

            await tcs.Task;
            await PopupNavigation.RemovePageAsync(alert);
        }
示例#17
0
        public async void RedIncorrecta()
        {
            await PopupNavigation.PushAsync(loadingRed = new LoadingPage(textLoadingDetail));

            await Task.Delay(2500);

            await PopupNavigation.RemovePageAsync(loadingRed);

            await PopupNavigation.PushAsync(redIncorrecta = new IncorrectNetworkPage(textTitleError, textDetailError));
        }
示例#18
0
        public async void AlertaVPN()
        {
            await PopupNavigation.PushAsync(loadingRed = new LoadingPage(textLoadingDetail));

            await Task.Delay(2500);

            await PopupNavigation.RemovePageAsync(loadingRed);

            await PopupNavigation.PushAsync(alertaVPN = new AlertNetworkPage());
        }
示例#19
0
        public async void RedCorrecta()
        {
            await PopupNavigation.PushAsync(loadingRed = new LoadingPage(textLoadingDetail));

            await Task.Delay(2500);

            await PopupNavigation.RemovePageAsync(loadingRed);

            await PopupNavigation.PushAsync(redCorrecta = new CorrectValidationPage(textTitleCorrect, textDetailCorrect));
        }
示例#20
0
        public async Task <bool> ShowQuestionAsync(string title, string message, string acceptButtonText, string cancelButtonText)
        {
            var tcs   = new TaskCompletionSource <bool>();
            var alert = new QuestionPopup(tcs, title, message, acceptButtonText, cancelButtonText);
            await PopupNavigation.PushAsync(alert);

            var result = await tcs.Task;
            await PopupNavigation.RemovePageAsync(alert);

            return(result);
        }
        private async void btnDesactivarUsuario_Clicked(object sender, EventArgs e)
        {
            if (selectedUser == null)
            {
                titleAlert  = "Seleccione un usuario";
                detailAlert = "Debe seleccionar el usuario que desea desactivar o activar.";
                await results.Alert(titleAlert, detailAlert);
            }
            else if (selectedUser.UsuarioEstado == "Activo")
            {
                detailLoading = "Desactivando usuario...";
                LoadingPage loading = new LoadingPage(detailLoading);
                await PopupNavigation.PushAsync(loading);

                await Task.Delay(1000);

                await data.UpdateUsuario(selectedUser.UsuarioID, selectedUser.UsuarioNombreReal, selectedUser.UsuarioCorreo, selectedUser.UsuarioNombre,
                                         selectedUser.UsuarioClave, selectedUser.UsuarioRol, selectedUser.Acceso, "Inactivo");

                MessagingCenter.Send(this, "RefreshUsuariosPage");
                await SecureStorage.SetAsync("estadoUsuario", "Inactivo");

                await PopupNavigation.RemovePageAsync(loading);

                titleCorrect  = "Usuario desactivado";
                detailCorrect = "Se ha desactivado el usuario correctamente.";
                await results.Success(titleCorrect, detailCorrect);

                selectedUser = null;
            }
            else if (selectedUser.UsuarioEstado == "Inactivo")
            {
                detailLoading = "Activando usuario...";
                LoadingPage loading = new LoadingPage(detailLoading);
                await PopupNavigation.PushAsync(loading);

                await Task.Delay(1000);

                await data.UpdateUsuario(selectedUser.UsuarioID, selectedUser.UsuarioNombreReal, selectedUser.UsuarioCorreo, selectedUser.UsuarioNombre,
                                         selectedUser.UsuarioClave, selectedUser.UsuarioRol, selectedUser.Acceso, "Activo");

                MessagingCenter.Send(this, "RefreshUsuariosPage");

                await SecureStorage.SetAsync("estadoUsuario", "Inactivo");

                await PopupNavigation.RemovePageAsync(loading);

                titleCorrect  = "Usuario activado";
                detailCorrect = "Se ha activado el usuario correctamente.";
                await results.Success(titleCorrect, detailCorrect);

                selectedUser = null;
            }
        }
示例#22
0
        internal async void SendBackgroundClick()
        {
            BackgroundClicked?.Invoke(this, EventArgs.Empty);

            var isClose = OnBackgroundClicked();

            if (isClose)
            {
                await PopupNavigation.RemovePageAsync(this);
            }
        }
示例#23
0
        public async Task <string> ShowListAsync(string title, IEnumerable <string> list, string cancelButtonText)
        {
            var tcs   = new TaskCompletionSource <string>();
            var alert = new ListPopup(tcs, title, list, cancelButtonText);
            await PopupNavigation.PushAsync(alert);

            var result = await tcs.Task;
            await PopupNavigation.RemovePageAsync(alert);

            return(result);
        }
示例#24
0
        public async Task <DownloadBillPopupResult> ShowDownloadBillAsync(string nis, string first, string second, string third, string acceptButtonText)
        {
            var tcs   = new TaskCompletionSource <DownloadBillPopupResult>();
            var alert = new DownloadBillPopup(tcs, nis, first, second, third, acceptButtonText);
            await PopupNavigation.PushAsync(alert);

            var result = await tcs.Task;
            await PopupNavigation.RemovePageAsync(alert);

            return(result);
        }
        private async void Save_Event(object sender, EventArgs e)
        {
            save_button.IsEnabled = false;
            ErrorName.IsVisible   = false;
            bool validate = true;

            EventModel thisEvent = await fireBaseHelper.GetEvent
                                       (thisAppointment.Subject,
                                       thisAppointment.Notes,
                                       thisAppointment.StartTime.Date.ToLongDateString(),
                                       thisAppointment.StartTime.ToShortTimeString(),
                                       thisAppointment.EndTime.Date.ToLongDateString(),
                                       thisAppointment.EndTime.ToShortTimeString(),
                                       thisAppointment.Color);

            start_Date = new DateTime(startDate.Date.Year, startDate.Date.Month, startDate.Date.Day, startTimePicker.Time.Hours, startTimePicker.Time.Minutes, startTimePicker.Time.Seconds);
            end_Date   = new DateTime(endDate.Date.Year, endDate.Date.Month, endDate.Date.Day, endTimePicker.Time.Hours, endTimePicker.Time.Minutes, endTimePicker.Time.Seconds);
            checkDates(start_Date, end_Date);
            Color colorEvent = changeColor(color);

            if (string.IsNullOrEmpty(event_name.Text) || string.IsNullOrWhiteSpace(event_name.Text))
            {
                validate            = false;
                ErrorName.IsVisible = true;
            }
            if (validate)
            {
                try
                {
                    await fireBaseHelper.UpdateEvent(thisEvent.EventID, event_name.Text, event_description.Text, start_Date, end_Date, colorEvent);
                }
                catch (Exception)
                {
                }
            }
            save_button.IsEnabled = true;
            if (validate)
            {
                if (sourcePage == "SimplePage")
                {
                    await PopupNavigation.RemovePageAsync(this);
                }
                else if (sourcePage == "MyAccount")
                {
                    await Navigation.PushAsync(new MyAccount(), false);

                    Navigation.RemovePage(Navigation.NavigationStack[Navigation.NavigationStack.Count - 1]);
                    await PopupNavigation.RemovePageAsync(this);
                }
            }
            await SimplePage.Instance.refreshCalendar();
        }
        public async Task <Result> ReadBarcodeResultAsync()
        {
            await PopupNavigation.PushAsync(this);

            await Task.Run(() => { while (!HasResult)
                                   {
                                   }
                           });

            await PopupNavigation.RemovePageAsync(this);

            return(Result);
        }
        public void Build()
        {
            int categoriesMax = dataModel.categories.Count();

            for (int i = 0; i < categoriesMax; i++)
            {
                CatigogiesView category = new CatigogiesView();
                //category.SetData(dataModel.categories[i].id, dataModel.categories[i].name, dataModel.categories[i].description);
                //category.SetDelegate(CategoryPick);
                scrollContent.Children.Add(category);
            }
            PopupNavigation.RemovePageAsync(loading);
        }
示例#28
0
        private async void btnLogin_Clicked(object sender, EventArgs e)
        {
            LoadingGeneralPage LoadingPage = new LoadingGeneralPage();
            await PopupNavigation.PushAsync(LoadingPage);

            await Task.Delay(3000);

            if (txtUsuario.Text == "nadia" && txtClave.Text == "1234")
            {
                await Navigation.PushAsync(new RegistroUsuarioPage());

                await PopupNavigation.RemovePageAsync(LoadingPage);
            }
        }
示例#29
0
        private async void btnActualizarPerfil_Clicked(object sender, EventArgs e)
        {
            detailLoading = "Actualizando perfil...";
            LoadingPage loading = new LoadingPage(detailLoading);
            await PopupNavigation.PushAsync(loading);

            await Task.Delay(1000);

            try
            {
                var usuarioExiste = usuarios.Where(x => x.UsuarioNombre == txtUsuarioPerfil.Text && x.UsuarioID != userID)
                                    .Select(y => y.UsuarioNombre).FirstOrDefault();

                if (usuarioExiste != null)
                {
                    await PopupNavigation.RemovePageAsync(loading);

                    titleError  = "Usuario incorrecto";
                    detailError = "El nombre de usuario es incorrecto. Intente nuevamente.";
                    await results.Unsuccess(titleError, detailError);
                }
                else
                {
                    claveEncriptada = DataSecurity.Encrypt(txtClavePerfil.Text, "sblw-3hn8-sqoy19");
                    await data.UpdateUsuario(userID, txtNombreRealPerfil.Text, txtCorreoPerfil.Text, txtUsuarioPerfil.Text, claveEncriptada,
                                             perfilUsuario.UsuarioRol, perfilUsuario.Acceso, perfilUsuario.UsuarioEstado);

                    refreshUsuario = txtNombreRealPerfil.Text;
                    await SecureStorage.SetAsync("nombreUsuario", txtNombreRealPerfil.Text);

                    MasterMenuHabitantePage.usuarioRefresh = txtNombreRealPerfil.Text;
                    MasterMenuPage.usuarioRefresh          = txtNombreRealPerfil.Text;
                    await PopupNavigation.RemovePageAsync(loading);

                    titleCorrect  = "Perfil actualizado";
                    detailCorrect = "Se ha actualizado su perfl correctamente.";
                    await results.Success(titleCorrect, detailCorrect);
                }
            }
            catch (Exception)
            {
                await PopupNavigation.RemovePageAsync(loading);

                titleError  = "Error";
                detailError = "Ha ocurrido un error procesando la actualización de datos. Intente nuevamente.";
                await results.Unsuccess(titleError, detailError);
            }
        }
示例#30
0
        private async void delete_mark(object sender, System.EventArgs e)
        {
            try
            {
                await fireBaseHelperMark.DeleteMark(_mark.MarkID);

                await Navigation.PushAsync(new SubjectSelected(_subject), false);
                await DisplayAlert(_mark.Category, "The " + _mark.MarkName + " was deleted", "ok");

                Navigation.RemovePage(Navigation.NavigationStack[Navigation.NavigationStack.Count - 1]);
                await PopupNavigation.RemovePageAsync(this);
            }
            catch (Exception)
            {
                await DisplayAlert("Error", "Please try again", "Ok");
            }
        }