/// <summary>
 /// Sets the global styles for <see cref="MaterialAlertDialog"/>, <see cref="MaterialLoadingDialog"/>, <see cref="MaterialSimpleDialog"/>, <see cref="MaterialConfirmationDialog"/>, and <see cref="MaterialSnackbar"/>. Parameters can be null.
 /// </summary>
 /// <param name="dialogConfiguration">Global style for <see cref="MaterialAlertDialog"/>.</param>
 /// <param name="loadingDialogConfiguration">Global style for <see cref="MaterialLoadingDialog"/>.</param>
 /// <param name="snackbarConfiguration">Global style for <see cref="MaterialSnackbar"/>.</param>
 /// <param name="simpleDialogConfiguration">Global style for <see cref="MaterialSimpleDialog"/>.</param>
 /// <param name="confirmationDialogConfiguration">Global style for <see cref="MaterialConfirmationDialog"/>.</param>
 /// <param name="inputDialogConfiguration">Global style for <see cref="MaterialInputDialog"/>.</param>
 public void SetGlobalStyles(MaterialAlertDialogConfiguration dialogConfiguration = null, MaterialLoadingDialogConfiguration loadingDialogConfiguration = null, MaterialSnackbarConfiguration snackbarConfiguration = null, MaterialSimpleDialogConfiguration simpleDialogConfiguration = null, MaterialConfirmationDialogConfiguration confirmationDialogConfiguration = null, MaterialInputDialogConfiguration inputDialogConfiguration = null, MaterialAlertDialogConfiguration customContentDialogConfiguration = null)
 {
     MaterialAlertDialog.GlobalConfiguration        = dialogConfiguration;
     MaterialLoadingDialog.GlobalConfiguration      = loadingDialogConfiguration;
     MaterialSnackbar.GlobalConfiguration           = snackbarConfiguration;
     MaterialSimpleDialog.GlobalConfiguration       = simpleDialogConfiguration;
     MaterialConfirmationDialog.GlobalConfiguration = confirmationDialogConfiguration;
     MaterialInputDialog.GlobalConfiguration        = inputDialogConfiguration;
     MaterialDialogFragment.GlobalConfiguration     = customContentDialogConfiguration;
 }
 /// <summary>
 /// Shows an dialog for confirmation with a custom content. Returns true when the confirm button was clicked, false if the dismiss button was clicked, and null if the alert dialog was dismissed.
 /// </summary>
 /// <param name="view">The additional custom content of the dialog.</param>
 /// <param name="message">The message of the dialog.</param>
 /// <param name="title">The title of the dialog.</param>
 /// <param name="confirmingText">The text of the confirmation button.</param>
 /// <param name="dismissiveText">The text of the dismissive button</param>
 /// <param name="configuration">The style of the dialog.</param>
 /// <exception cref="ArgumentNullException" />
 public Task <bool?> ShowCustomContentAsync(View view, string message, string title = null, string confirmingText = "Ok", string dismissiveText = "Cancel", MaterialAlertDialogConfiguration configuration = null)
 {
     return(MaterialDialogFragment.ShowAsync(view, message, title, confirmingText, dismissiveText, configuration));
 }
Exemplo n.º 3
0
 internal static async Task AlertAsync(string message, string title, string acknowledgementText = "Ok", MaterialAlertDialogConfiguration configuration = null)
 {
     var dialog = new MaterialAlertDialog(message, title, acknowledgementText, null, configuration: configuration);
     await dialog.ShowAsync();
 }
Exemplo n.º 4
0
        internal static async Task <bool?> ConfirmAsync(string message, string title, string confirmingText, string dismissiveText = "Cancel", MaterialAlertDialogConfiguration configuration = null)
        {
            var dialog = new MaterialAlertDialog(message, title, confirmingText, dismissiveText, configuration)
            {
                InputTaskCompletionSource = new TaskCompletionSource <bool?>()
            };

            await dialog.ShowAsync();

            return(await dialog.InputTaskCompletionSource.Task);
        }
Exemplo n.º 5
0
 internal MaterialAlertDialog(string message, string title, string action1Text, string action2Text, MaterialAlertDialogConfiguration configuration = null) : this(configuration)
 {
     Message.Text           = message;
     DialogTitle.Text       = title;
     PositiveButton.Text    = action1Text;
     PositiveButton.Command = new Command(async() =>
     {
         await this.DismissAsync();
         this.InputTaskCompletionSource?.SetResult(true);
     });
     NegativeButton.Text    = action2Text;
     NegativeButton.Command = new Command(async() =>
     {
         await this.DismissAsync();
         this.InputTaskCompletionSource?.SetResult(false);
     });
 }
Exemplo n.º 6
0
 internal MaterialAlertDialog(MaterialAlertDialogConfiguration configuration)
 {
     this.InitializeComponent();
     this.Configure(configuration);
 }
 internal MaterialDialogFragment(MaterialAlertDialogConfiguration configuration)
 {
     this.InitializeComponent();
     this.Configure(configuration);
     this.InputTaskCompletionSource = new TaskCompletionSource <bool?>();
 }
Exemplo n.º 8
0
        private async void Button_Clicked(object sender, EventArgs e)
        {
            if (String.IsNullOrWhiteSpace(nombre.Text) &&
                String.IsNullOrWhiteSpace(codigo.Text) &&
                String.IsNullOrWhiteSpace(cant.Text) &&
                String.IsNullOrWhiteSpace(price.Text)
                )
            {
                var alertDialogConfiguration = new MaterialAlertDialogConfiguration
                {
                    BackgroundColor  = Color.FromHex("#c62828"),
                    TitleTextColor   = Color.White,
                    MessageTextColor = Color.FromHex("#DEFFFFFF"),
                    TintColor        = Color.White,
                    CornerRadius     = 8,
                    ScrimColor       = Color.FromHex("#232F34").MultiplyAlpha(0.32),
                    ButtonAllCaps    = false
                };

                await MaterialDialog.Instance.AlertAsync(message : "Llene los campos",
                                                         title : "Alerta",
                                                         acknowledgementText : "Ok",
                                                         configuration : alertDialogConfiguration);
            }
            else if (String.IsNullOrWhiteSpace(nombre.Text))
            {
                control.ShowAlert("Campo Nombre medicamento es obligatorio!!", "Error", "Ok");
            }
            else if (String.IsNullOrWhiteSpace(price.Text))
            {
                control.ShowAlert("Campo Precio es obligatorio!!", "Error", "Ok");
            }
            else if (String.IsNullOrWhiteSpace(cant.Text))
            {
                control.ShowAlert("Campo cantidad es obligatorio!!", "Error", "Ok");
            }
            else if (String.IsNullOrWhiteSpace(codigo.Text))
            {
                control.ShowAlert("Campo codigo es obligatorio!!", "Error", "Ok");
            }
            else
            {
                try
                {
                    MaterialControls control = new MaterialControls();
                    control.ShowLoading("Registrando");
                    string       date  = fecha.Date.ToString("dd/MM/yy");
                    Medicamentos citas = new Medicamentos
                    {
                        nom_Medicamento = nombre.Text,
                        cod_Medicamento = codigo.Text,
                        cantidad        = Convert.ToInt32(cant.Text),
                        precio_U        = float.Parse(price.Text),
                        fecha_V         = date
                    };

                    HttpClient client      = new HttpClient();
                    string     controlador = "/Api/medicamentos/create.php";
                    client.BaseAddress = new Uri(baseurl);

                    string json    = JsonConvert.SerializeObject(citas);
                    var    content = new StringContent(json, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync(controlador, content);

                    if (response.IsSuccessStatusCode)
                    {
                        control.ShowAlert("Registrado!!", "Exito", "Ok");
                    }
                    else
                    {
                        control.ShowAlert("Ocurrio un error al registrar!!", "Error", "Ok");
                    }
                } catch (Exception ex) {
                    await DisplayAlert("Ocurrio un error " + ex, "Error", "Ok");
                }
            }
        }
 /// <summary>
 /// Shows an alert dialog for confirmation. Returns true when the confirm button was clicked, false if the dismiss button was clicked or if the alert dialog was dismissed.
 /// </summary>
 /// <param name="message">The message of the alert dialog.</param>
 /// <param name="title">The title of the alert dialog.</param>
 /// <param name="confirmingText">The text of the confirmation button.</param>
 /// <param name="dismissiveText">The text of the dismissive button</param>
 /// <param name="configuration">The style of the alert dialog.</param>
 public static async Task <bool> ShowConfirmAsync(string message, string title, string confirmingText = "Ok", string dismissiveText = "Cancel", MaterialAlertDialogConfiguration configuration = null)
 {
     return(await MaterialAlertDialog.ConfirmAsync(message, title, confirmingText, dismissiveText, configuration) ?? false);
 }
Exemplo n.º 10
0
        private async void Button_Clicked(object sender, EventArgs e)
        {
            if (String.IsNullOrWhiteSpace(e_nombre.Text) &&
                String.IsNullOrWhiteSpace(e_apellido.Text) &&
                String.IsNullOrWhiteSpace(Convert.ToString(e_sexo.SelectedItem)) &&
                String.IsNullOrWhiteSpace(Convert.ToString(e_estado.SelectedItem)) &&
                String.IsNullOrWhiteSpace(e_correo.Text) &&
                String.IsNullOrWhiteSpace(e_departamento.Text) &&
                String.IsNullOrWhiteSpace(e_dir.Text) &&
                String.IsNullOrWhiteSpace(e_telefono.Text) &&
                String.IsNullOrWhiteSpace(e_dui.Text) &&
                String.IsNullOrWhiteSpace(e_nit.Text) &&
                String.IsNullOrWhiteSpace(e_municipio.Text) &&
                String.IsNullOrWhiteSpace(e_celular.Text)
                )
            {
                var alertDialogConfiguration = new MaterialAlertDialogConfiguration
                {
                    BackgroundColor  = Color.FromHex("#c62828"),
                    TitleTextColor   = Color.White,
                    MessageTextColor = Color.FromHex("#DEFFFFFF"),
                    TintColor        = Color.White,
                    CornerRadius     = 8,
                    ScrimColor       = Color.FromHex("#232F34").MultiplyAlpha(0.32),
                    ButtonAllCaps    = false
                };

                await MaterialDialog.Instance.AlertAsync(message : "Llene todos los campos",
                                                         title : "Alerta",
                                                         acknowledgementText : "Ok",
                                                         configuration : alertDialogConfiguration);
            }

            else if (String.IsNullOrWhiteSpace(e_nombre.Text))
            {
                control.ShowAlert("Campo Nombre es Obligatorio!!", "Error", "Ok");
            }
            else if (String.IsNullOrWhiteSpace(e_apellido.Text))
            {
                control.ShowAlert("Campo Apellido es Obligatorio!!", "Error", "Ok");
            }
            else if (String.IsNullOrWhiteSpace(Convert.ToString(e_sexo.SelectedItem)))
            {
                control.ShowAlert("Seleccione un sexo", "Error", "Ok");
            }
            else if (String.IsNullOrWhiteSpace(Convert.ToString(e_estado.SelectedItem)))
            {
                control.ShowAlert("Seleccione un estado", "Error", "Ok");
            }
            else if (String.IsNullOrWhiteSpace(e_dui.Text))
            {
                control.ShowAlert("Campo DUI es Obligatorio!!", "Error", "Ok");
            }
            else if (String.IsNullOrWhiteSpace(e_nit.Text))
            {
                control.ShowAlert("Campo DUI es Obligatorio!!", "Error", "Ok");
            }
            else if (String.IsNullOrWhiteSpace(e_telefono.Text))
            {
                control.ShowAlert("Campo telefono es Obligatorio!!", "Error", "Ok");
            }
            else if (String.IsNullOrWhiteSpace(e_correo.Text))
            {
                control.ShowAlert("Campo correo es Obligatorio!!", "Error", "Ok");
            }
            else if (String.IsNullOrWhiteSpace(e_celular.Text))
            {
                control.ShowAlert("Campo celular es Obligatorio!!", "Error", "Ok");
            }
            else if (String.IsNullOrWhiteSpace(e_departamento.Text))
            {
                control.ShowAlert("Campo departamento es Obligatorio!!", "Error", "Ok");
            }
            else if (String.IsNullOrWhiteSpace(e_municipio.Text))
            {
                control.ShowAlert("Campo municipio es Obligatorio!!", "Error", "Ok");
            }
            else if (String.IsNullOrWhiteSpace(e_dir.Text))
            {
                control.ShowAlert("Campo direccion es Obligatorio!!", "Error", "Ok");
            }
            else if (TextValidator.Ok == false || ValidateEmail.Ok == false || NumeroValidator.Ok == false)
            {
                control.ShowAlert("Al parecer hay algunos errores", "Error", "Ok");
            }
            else
            {
                try
                {
                    MaterialControls control = new MaterialControls();
                    control.ShowLoading("Registrando");
                    string    fecha     = e_nac.Date.ToString("yy/MM/dd");
                    Empleados empleados = new Empleados
                    {
                        idempleado   = ids,
                        nombres      = e_nombre.Text,
                        apellidos    = e_apellido.Text,
                        fecha_Nac    = fecha,
                        sexo         = Convert.ToString(e_sexo.SelectedItem),
                        estado_Civil = Convert.ToString(e_estado.SelectedItem),
                        especialidad = Convert.ToString(e_especialidad.SelectedItem),
                        dui          = e_dui.Text,
                        telefono     = e_telefono.Text,
                        email        = e_correo.Text,
                        departamento = e_departamento.Text,
                        celular      = e_celular.Text,
                        municipio    = e_municipio.Text,
                        direccion    = e_dir.Text,
                        nit          = e_nit.Text
                    };



                    HttpClient client      = new HttpClient();
                    string     controlador = "/Api/empleado/update.php";
                    client.BaseAddress = new Uri(baseurl);

                    string json    = JsonConvert.SerializeObject(empleados);
                    var    content = new StringContent(json, Encoding.UTF8, "application/json");

                    var response = await client.PutAsync(controlador, content);

                    if (response.IsSuccessStatusCode)
                    {
                        control.ShowAlert("Actualizado", "Exito", "Ok");
                    }
                    else
                    {
                        control.ShowAlert("Ocurrio un error actualizar", "Error", "Ok");
                    }
                }
                catch (Exception ex)
                {
                    await DisplayAlert("Ocurrio un error " + ex, "Error", "Ok");
                }
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// Shows an alert dialog for acknowledgement. It only has a single, dismissive action used for acknowledgement.
 /// </summary>
 /// <param name="message">The message of the alert dialog.</param>
 /// <param name="title">The title of the alert dialog.</param>
 /// <param name="acknowledgementText">The text of the acknowledgement button.</param>
 /// <param name="configuration">The style of the alert dialog.</param>
 public static async Task ShowAlertAsync(string message, string title, string acknowledgementText, MaterialAlertDialogConfiguration configuration = null)
 {
     await MaterialAlertDialog.AlertAsync(message, title, acknowledgementText, configuration);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Shows an alert dialog for acknowledgement. It only has a single, dismissive action used for acknowledgement.
 /// </summary>
 /// <param name="message">The message of the alert dialog.</param>
 /// <param name="configuration">The style of the alert dialog.</param>
 public static async Task ShowAlertAsync(string message, MaterialAlertDialogConfiguration configuration = null)
 {
     await MaterialAlertDialog.AlertAsync(message, configuration : configuration);
 }
Exemplo n.º 13
0
        private async void Button_Clicked(object sender, EventArgs e)
        {
            if (String.IsNullOrWhiteSpace(title.Text) && String.IsNullOrWhiteSpace(description.Text))
            {
                var alertDialogConfiguration = new MaterialAlertDialogConfiguration
                {
                    BackgroundColor  = Color.FromHex("#c62828"),
                    TitleTextColor   = Color.White,
                    MessageTextColor = Color.FromHex("#DEFFFFFF"),
                    TintColor        = Color.White,
                    CornerRadius     = 8,
                    ScrimColor       = Color.FromHex("#232F34").MultiplyAlpha(0.32),
                    ButtonAllCaps    = false
                };

                await MaterialDialog.Instance.AlertAsync(message : "Llene los campos",
                                                         title : "Alerta",
                                                         acknowledgementText : "Ok",
                                                         configuration : alertDialogConfiguration);
            }
            else if (String.IsNullOrWhiteSpace(description.Text))
            {
                control.ShowAlert("Campo Descripcion es obligatorio!!", "Error", "Ok");
            }
            else if (String.IsNullOrWhiteSpace(title.Text))
            {
                control.ShowAlert("Campo Titulo es obligatorio!!", "Error", "Ok");
            }
            else
            {
                try
                {
                    control.ShowLoading("Publicando..");
                    Models.Tips citas = new Models.Tips
                    {
                        titulo      = title.Text,
                        descripcion = description.Text
                    };



                    HttpClient client      = new HttpClient();
                    string     controlador = "/Api/tips/create.php";
                    client.BaseAddress = new Uri(baseurl);

                    string json    = JsonConvert.SerializeObject(citas);
                    var    content = new StringContent(json, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync(controlador, content);

                    if (response.IsSuccessStatusCode)
                    {
                        control.ShowAlert("Publicado!!", "Exito", "Ok");
                    }
                    else
                    {
                        control.ShowAlert("Ocurrio un error al publicar!!", "Error", "Ok");
                    }
                }
                catch (Exception ex)
                {
                    await DisplayAlert("Ocurrio un error " + ex, "Error", "Ok");
                }
            }
        }
 /// <summary>
 /// Shows an alert dialog for acknowledgement. It only has a single, dismissive action used for acknowledgement.
 /// </summary>
 /// <param name="message">The message of the alert dialog.</param>
 /// <param name="title">The title of the alert dialog.</param>
 /// <param name="configuration">The style of the alert dialog.</param>
 public Task AlertAsync(string message, string title, MaterialAlertDialogConfiguration configuration = null)
 {
     return(MaterialAlertDialog.AlertAsync(message, title, configuration));
 }
 public static async Task <bool?> ShowAsync(View view, string message, string title, string positiveButtonText, string negativeButtonText, MaterialAlertDialogConfiguration configuration)
 {
     var d = new MaterialDialogFragment(configuration)
     {
         container      = { Content = view ?? throw new ArgumentNullException(nameof(view)) },
 /// <summary>
 /// Shows an alert dialog for acknowledgement. It only has a single, dismissive action used for acknowledgement.
 /// </summary>
 /// <param name="message">The message of the alert dialog.</param>
 /// <param name="title">The title of the alert dialog.</param>
 /// <param name="acknowledgementText">The text of the acknowledgement button.</param>
 /// <param name="configuration">The style of the alert dialog.</param>
 public Task AlertAsync(string message, string title, string acknowledgementText, MaterialAlertDialogConfiguration configuration = null)
 {
     return(MaterialAlertDialog.AlertAsync(message, title, acknowledgementText, configuration));
 }
Exemplo n.º 17
0
        private async void Button_Clicked(object sender, EventArgs e)
        {
            if (String.IsNullOrWhiteSpace(nombre.Text) || String.IsNullOrWhiteSpace(number.Text))
            {
                var alertDialogConfiguration = new MaterialAlertDialogConfiguration
                {
                    BackgroundColor  = Color.FromHex("#c62828"),
                    TitleTextColor   = Color.White,
                    MessageTextColor = Color.FromHex("#DEFFFFFF"),
                    TintColor        = Color.White,
                    CornerRadius     = 8,
                    ScrimColor       = Color.FromHex("#232F34").MultiplyAlpha(0.32),
                    ButtonAllCaps    = false
                };

                await MaterialDialog.Instance.AlertAsync(message : "Llene los campos",
                                                         title : "Alerta",
                                                         acknowledgementText : "Ok",
                                                         configuration : alertDialogConfiguration);
            }
            else if (TextValidator.Ok == false || NumeroValidator.Ok == false)
            {
                var alertDialogConfiguration = new MaterialAlertDialogConfiguration
                {
                    BackgroundColor  = Color.FromHex("#c62828"),
                    TitleTextColor   = Color.White,
                    MessageTextColor = Color.FromHex("#DEFFFFFF"),
                    TintColor        = Color.White,
                    CornerRadius     = 8,
                    ScrimColor       = Color.FromHex("#232F34").MultiplyAlpha(0.32),
                    ButtonAllCaps    = false
                };
                await MaterialDialog.Instance.AlertAsync(message : "Al paracer algunos campos estan incorrectos",
                                                         title : "Alerta",
                                                         acknowledgementText : "Ok", configuration : alertDialogConfiguration);
            }
            else
            {
                try
                {
                    control.ShowLoading("Registrando");
                    Lista_Espera empleados = new Lista_Espera
                    {
                        nombre          = nombre.Text,
                        num_Consultorio = Convert.ToInt32(number.Text)
                    };



                    HttpClient client      = new HttpClient();
                    string     controlador = "/Api/lista_espera/create.php";
                    client.BaseAddress = new Uri(baseurl);

                    string json    = JsonConvert.SerializeObject(empleados);
                    var    content = new StringContent(json, Encoding.UTF8, "application/json");

                    var response = await client.PostAsync(controlador, content);

                    if (response.IsSuccessStatusCode)
                    {
                        control.ShowAlert("Agregado!!", "Exito", "Ok");
                    }
                    else
                    {
                        control.ShowAlert("Ocurrio un error al agregar!!", "Error", "Ok");
                    }
                }
                catch (Exception ex)
                {
                    await DisplayAlert("Ocurrio un error", "Error " + ex, "Ok");
                }
            }
        }