private async Task SelectFromCamera()
        {
            try
            {
                if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
                {
                    await UserDialogs.AlertAsync("No Camera", ":( No camera available.");

                    return;
                }

                var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
                {
                    Directory          = "Test",
                    SaveToAlbum        = true,
                    CompressionQuality = 75,
                    CustomPhotoSize    = 50,
                    PhotoSize          = PhotoSize.MaxWidthHeight,
                    MaxWidthHeight     = 2000,
                    DefaultCamera      = CameraDevice.Front
                });

                if (file == null)
                {
                    return;
                }

                SelectedMediaFile = file;
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp);
            }
        }
        private async Task SelectFromGallery()
        {
            try
            {
                if (!CrossMedia.Current.IsPickPhotoSupported)
                {
                    await UserDialogs.AlertAsync("Photos Not Supported", ":( Permission not granted to photos.");

                    return;
                }

                var file = await CrossMedia.Current.PickPhotoAsync(new PickMediaOptions
                {
                    PhotoSize    = PhotoSize.Medium,
                    SaveMetaData = true
                });


                if (file == null)
                {
                    return;
                }

                SelectedMediaFile = file;
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp);
            }
        }
        async void ExecuteSiguienteIC()
        {
            try
            {
                if (string.IsNullOrEmpty(CodigoCliente))
                {
                    await UserDialogs.AlertAsync("Ingrese un código válido", "Mensaje", "OK");

                    return;
                }

                NavigationParameters parametros = GetNavigationParameters("Servicio");//indicamos que no considere servicio, porque recien sera añadido

                Catalogo empresa = RefNavParameters["Empresa"] as Catalogo;
                parametros.Add("Servicio", ServicioSelected);
                parametros.Add("stringEmpresa", NomEmpresa);
                parametros.Add("stringPicServicio", ServicioSelected.Nombre);
                parametros.Add("stringCodigo", CodigoCliente);

                await NavigationService.NavigateAsync("PagoServicioEmpresa", parametros);

                ServicioSelected = null;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
 async Task ShowSomeAlertToAndroidPhoneUsersOnly()
 {
     if (DeviceService.RuntimePlatform == RuntimePlatform.Android && DeviceService.Idiom == TargetIdiom.Phone)
     {
         await UserDialogs.AlertAsync("Some alert to android phone users only!", "Test");
     }
 }
        async void ExecuteSiguienteIC()
        {
            try
            {
                int mont = 0;
                if (!int.TryParse(Monto, out mont))
                {
                    await UserDialogs.AlertAsync("Ingrese un monto válido", "Mensaje", "OK");

                    return;
                }
                else if (mont <= 0)
                {
                    await UserDialogs.AlertAsync("Ingrese un monto válido", "Mensaje", "OK");

                    return;
                }

                NavigationParameters parametros = GetNavigationParameters();
                parametros.Add("nombreEmpresa", LblEmpresa);
                parametros.Add("nombreServicio", LblServicio);
                parametros.Add("codigo", LblCodigoCliente);
                parametros.Add("monto", Monto);

                Application.Current.Properties["strTipoTransf"]       = "0";
                Application.Current.Properties["strOrigenMisCuentas"] = false;
                Application.Current.Properties["strPageOrigen"]       = "PagoServicioEmpresaView";
                await NavigationService.NavigateAsync(Constantes.pageCtaCargo, parametros);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
예제 #6
0
        public async Task Init()
        {
            while (true)
            {
                try
                {
                    // Get the platform
                    await GetPlatformModelAsync();
                }
                catch (Exception ex)
                {
                    ExceptionService.HandleException(ex);
                }

                if (Settings.DefaultLanguage == null)
                {
                    // No platform and no selected language yet, first time, show connection error
                    await UserDialogs.AlertAsync("Connection error, please make sure you are connected to the internet and press OK");
                }
                else
                {
                    // Language is set, meanse we have platform, continue
                    break;
                }
            }

            SetResources();

            IsBusy = false;
        }
        async void ExecuteAccionCompletarIC()
        {
            try
            {
                if (string.IsNullOrEmpty(Clave))
                {
                    await UserDialogs.AlertAsync("Ingrese una clave válida", "Mensaje", "OK");

                    return;
                }

                Cuenta  cta      = RefNavParameters["CtaCargo"] as Cuenta;
                string  montoStr = RefNavParameters["monto"] as string;
                decimal monto    = decimal.Parse(montoStr);

                string rpta = CuentaService.efectuarMovimiento(cta, monto, "PEN", false);

                if (rpta != "")
                {
                    await UserDialogs.AlertAsync(rpta, Constantes.MSJ_INFO, Constantes.MSJ_BOTON_OK);
                }
                else
                {
                    if (IsOperacionFrecuente)
                    {
                        //RefNavParameters["suboperacionActual"] as SubOperacion;
                        SubOperacion       subope  = RefNavParameters["SubOperacion"] as SubOperacion;
                        Catalogo           empresa = RefNavParameters["Empresa"] as Catalogo;
                        OperacionFrecuente opeFrec = new OperacionFrecuente
                        {
                            FechaOperacion  = DateTime.Now,
                            SubOperacion    = subope,
                            Operacion       = OperacionService.BuscarOperacion(subope.IdOperacion),
                            Servicio        = RefNavParameters["Servicio"] as Servicio,
                            NombreFrecuente = subope.Nombre + ": " + empresa.Nombre
                        };

                        OperacionService.AgregarOperacionFrecuente(opeFrec);
                        EventAggregator.GetEvent <OpeFrecuenteAddedEvent>().Publish();
                    }
                    await UserDialogs.AlertAsync(Constantes.msjExito, "Mensaje", "OK");

                    await NavigationService.GoBackToRootAsync();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
예제 #8
0
        async Task DeleteCustomer(CustomerDto customerDto)
        {
            try
            {
                customerDto.CurrentState = State.Saving;

                await ODataClient.Customers()
                .Key(customerDto.Id)
                .DeleteEntryAsync();

                CustomersView.Remove(customerDto);

                await UserDialogs.AlertAsync($"{customerDto.FullName} Successfully Deleted!");
            }
            finally
            {
                customerDto.CurrentState = State.None;
            }
        }
예제 #9
0
        public async Task Init(Guid postId)
        {
            PostId = postId;

            try
            {
                SetResources();

                var feedResponseModel = await _feedService.GetPostAsync(ApiPriority.UserInitiated, postId);

                var posts = BuildItems(feedResponseModel);

                var post = posts.FirstOrDefault();

                if (post == null)
                {
                    await UserDialogs.AlertAsync(ResKeys.mobile_error_server_error);

                    Debug.WriteLine("Could not find post with id {0} in repository", PostId);

                    Close(this);
                    return;
                }

                var comments = feedResponseModel.Posts.FirstOrDefault()?.Comments.Select(c => c.ToModel());

                // Add post
                var items = new List <IItemBase>(posts);

                // Add comments
                items.AddRange(comments.OrderBy(p => p.DateTime).ToList());

                Items = new ExtendedObservableCollection <IItemBase>(items);
            }
            catch (Exception ex)
            {
                ExceptionService.HandleException(ex);
            }
        }
예제 #10
0
        async Task Login()
        {
            try
            {
                UserName = UserName ?? "";
                Password = Password ?? "";

                if (UserName_HasError || Password_HasError)
                {
                    return;
                }

                using (UserDialogs.Loading(Strings.Login, out CancellationToken cancellationToken))
                {
                    await Task.Run(async() =>
                    {
                        await SecurityService.LoginWithCredentials(UserName, Password, "ToDoLineApp", "secret", cancellationToken: cancellationToken);
                    }, cancellationToken);
                }

                await NavigationService.NavigateAsync("/Master/Nav/ToDoItems");
            }
            catch (Exception ex)
            {
                if (ex.Message.StartsWith("invalid_grant "))
                {
                    string error_description = JToken.Parse(ex.Message.Replace("invalid_grant ", ""))["error_description"].Value <string>();

                    if (error_description == "InvalidUserNameAndOrPassword")
                    {
                        await UserDialogs.AlertAsync(Strings.InvalidUserNameAndOrPassword, Strings.Error);

                        return; // don't throw it.
                    }
                }

                throw;
            }
        }
예제 #11
0
 async void ExecuteEditarIC()
 {
     if (IsEdicion)
     {
         if (!IsAceptaDatos)
         {
             await UserDialogs.AlertAsync("Para guardar los datos, debes leer y aceptar el tratamiento de datos personales.", Constantes.MSJ_INFO, Constantes.MSJ_BOTON_ACEPTAR);
         }
         else
         {
             IsEdicion       = false;
             TxtBtnEditar    = "Editar";
             Cliente.Email   = Email;
             Cliente.Celular = NumCelular;
         }
     }
     else
     {
         IsEdicion    = true;
         TxtBtnEditar = "Ok";
     }
 }
 async Task ShowAppVersion()
 {
     await UserDialogs.AlertAsync(AppVersionService.GetAppVersion(), "AppVersion");
 }
예제 #13
0
 async void ExecuteTapInfoEmailIC()
 {
     await UserDialogs.AlertAsync("Enviaremos las constancias de tus operaciones al e-mail registrado.", Constantes.MSJ_INFO, Constantes.MSJ_BOTON_ACEPTAR);
 }
예제 #14
0
 async void ExecuteTapDatosPersIC()
 {
     await UserDialogs.AlertAsync("Estas son las condiciones que debes aceptar.", "Tratamiento de datos personales", Constantes.MSJ_BOTON_ACEPTAR);
 }
예제 #15
0
 async void ExecuteTapInfoCelularIC()
 {
     await UserDialogs.AlertAsync("Para modificar tu número afiliado a la Clave SMS, debes realizarlo mediante un cajero Global Net.", Constantes.MSJ_INFO, Constantes.MSJ_BOTON_ACEPTAR);
 }