Exemplo n.º 1
0
        private void Control_EditorAction(object sender, TextView.EditorActionEventArgs e)
        {
            if (_view.ReturnType != ReturnType.Next)
            {
                _view.Unfocus();
            }

            // Call all the methods attached to base_entry event handler Completed
            _view.InvokeCompleted();
        }
Exemplo n.º 2
0
        public InicioSesion()
        {
            MessagingCenter.Subscribe <CambioContrasenia>(this, "Cambio", (sender) =>
            {
                Usuario.Text     = sender.user;
                Contrasenia.Text = sender.contrasenia.Text.Trim();
            });
            Usuario = new ExtendedEntry()
            {
                AutomationId     = "LoginUser",
                Keyboard         = Keyboard.Text,
                Placeholder      = "USUARIO",
                PlaceholderColor = Color.FromHex("91a5af"),
                FontFamily       = Device.OnPlatform("Montserrat-Regular", "Montserrat-Regular", null),
                TextColor        = Color.FromHex("CDCDCD"),
                BackgroundColor  = Color.Transparent,
                Text             = string.Empty,
                FontSize         = Device.OnPlatform(16, 22, 12),
                HeightRequest    = Device.OnPlatform(40, 50, 12),
                HasBorder        = false,
                Margin           = new Thickness(15, 0),
                VerticalOptions  = LayoutOptions.Center,
                ReturnKeyType    = ReturnKeyTypes.Next
            };
            Usuario.Completed += (sender, e) => { /*Usuario.Unfocus();*/ Contrasenia.Focus(); };
            Contrasenia        = new ExtendedEntry()
            {
                AutomationId     = "LoginPass",
                Placeholder      = "CONTRASEÑA",
                PlaceholderColor = Color.FromHex("91a5af"),
                FontFamily       = Device.OnPlatform("Montserrat-Regular", "Montserrat-Regular", null),
                TextColor        = Color.FromHex("CDCDCD"),
                BackgroundColor  = Color.Transparent,
                Text             = string.Empty,
                FontSize         = Device.OnPlatform(16, 22, 12),
                HeightRequest    = Device.OnPlatform(40, 50, 12),
                HasBorder        = false,
                Margin           = new Thickness(15, 0),
                VerticalOptions  = LayoutOptions.Center,
                IsPassword       = true,
                ReturnKeyType    = ReturnKeyTypes.Go
            };
            Contrasenia.Completed += (sender, e) => { Contrasenia.Unfocus(); Login(); };

            var ingreso = new StackLayout
            {
                Orientation       = StackOrientation.Vertical,
                Padding           = new Thickness(20, 0),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Spacing           = 10,
                Children          =
                {
                    //Usuario,
                    new Grid
                    {
                        HeightRequest     = Device.OnPlatform(40, 50, 12),
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Children          =
                        {
                            new RoundedBoxView.Forms.Plugin.Abstractions.RoundedBoxView
                            {
                                BackgroundColor   = Color.Transparent,
                                BorderThickness   = 2,
                                CornerRadius      = 20,
                                BorderColor       = Color.FromHex("94a8c1"),
                                HeightRequest     = Device.OnPlatform(40, 50, 12),
                                HorizontalOptions = LayoutOptions.FillAndExpand,
                            },
                            Usuario
                        },
                    },
                    new Grid
                    {
                        HeightRequest = Device.OnPlatform(40, 50, 12),
                        Children      =
                        {
                            new RoundedBoxView.Forms.Plugin.Abstractions.RoundedBoxView
                            {
                                BackgroundColor = Color.Transparent,
                                BorderThickness = 2,
                                CornerRadius    = 20,
                                BorderColor     = Color.FromHex("94a8c1"),
                                HeightRequest   = Device.OnPlatform(40, 50, 12),
                                //WidthRequest = 128,
                            },
                            Contrasenia
                        },
                    }
                }
            };
            var fIngreso = new Frame
            {
                WidthRequest      = 300,
                Padding           = new Thickness(0, 0, 0, 0),
                BackgroundColor   = Color.Transparent,
                OutlineColor      = Color.Transparent,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                HasShadow         = false,
                Content           = ingreso
            };

            var logo = new Image
            {
                Source            = "logo.png",
                HorizontalOptions = LayoutOptions.Center,
                Margin            = new Thickness(50, 0)
            };

            content_ingreso = new StackLayout
            {
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Spacing         = 25,
                Children        = { logo, fIngreso }
            };

            login = new Button
            {
                AutomationId      = "Login",
                Text              = "INGRESAR",
                TextColor         = Color.FromHex("3E1152"),
                FontFamily        = Device.OnPlatform("Montserrat-Bold", "Montserrat-Bold", null),
                FontSize          = 15,
                HorizontalOptions = LayoutOptions.Center,
                BackgroundColor   = Color.FromHex("ffffff"),
                WidthRequest      = 200,
                HeightRequest     = 35,
                BorderRadius      = 20
            };
            login.Clicked += Login_Clicked;


            var indicador = new ActivityIndicator
            {
                IsVisible         = true,
                IsRunning         = true,
                BindingContext    = this,
                Color             = Color.FromHex("f7efd9"),
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            indicador.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy");

            forget = new Label
            {
                Text       = "Recuperar contraseña.",
                TextColor  = Color.FromHex("f7efd9"),
                FontFamily = Device.OnPlatform("Montserrat-Regular", "Montserrat-Regular", null),
                FontSize   = 14,
                //Margin = new Thickness(0, 0, 0, 40),
                //VerticalOptions = LayoutOptions.EndAndExpand,
                HorizontalOptions = LayoutOptions.Center
            };

            contactenos = new Label
            {
                //https://goo.gl/yAnQD4
                //https://waze.com/ul?ll=14.52459,-90.76137
                Text              = "¿Tienes dudas? contáctanos.",
                TextColor         = Color.FromHex("f7efd9"),
                FontFamily        = Device.OnPlatform("Montserrat-Regular", "Montserrat-Regular", null),
                FontSize          = 14,
                Margin            = new Thickness(0, 0, 0, 40),
                VerticalOptions   = LayoutOptions.EndAndExpand,
                HorizontalOptions = LayoutOptions.Center
            };
            var tap2 = new TapGestureRecognizer();

            tap2.Tapped += (s, e) =>
            {
                Device.OpenUri(new Uri("https://goo.gl/F2LzXD"));
            };
            contactenos.GestureRecognizers.Add(tap2);


            var tap = new TapGestureRecognizer();

            tap.Tapped += (s, e) => Forget_Clicked();
            forget.GestureRecognizers.Add(tap);

            var acceso = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing         = 15,
                Children        = { new Grid {
                                        Children =  { indicador,login }
                                    }, forget, contactenos }
            };

            BackgroundImage = "fondo.png";
            Content         = new ScrollView
            {
                Content =
                    new StackLayout
                {
                    VerticalOptions = LayoutOptions.FillAndExpand,
                    Spacing         = 20,
                    Padding         = new Thickness(0, 20, 0, 0),
                    Children        = { content_ingreso, acceso }
                }
            };
        }
Exemplo n.º 3
0
        public EventoDatosViewModel()
        {
            idPaciente = new ExtendedEntry
            {
                Placeholder      = "SELECCIONE CAPACITADOR",
                PlaceholderColor = Color.FromHex("B2B2B2"),
                TextColor        = Color.FromHex("3F3F3F"),
                HasBorder        = false,
                FontSize         = 14,
                FontFamily       = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                XAlign           = TextAlignment.End,
                Margin           = new Thickness(0, 0, 15, 0)
                                   //HeightRequest = 25,
            };

            idPaciente.Focused += IdPaciente_Focused;

            /*idPaciente.TextChanged += delegate (object sender, TextChangedEventArgs args)
             * {
             *  pacientesLista.IsVisible = true;
             *  if (string.IsNullOrEmpty(idPaciente.Text))
             *  {
             *      //pacientesLista.ItemsSource = pacientes;
             *      pacientesLista.IsVisible = false;
             *  }
             *
             *  else
             *  {
             *      //pacientesLista.ItemsSource= pacientes.Where(t => t.nombrePila.ToLower().Contains(idPaciente.ToLower())).ToList().ForEach(t => Pacientes.Add(t));
             *
             *      var resultados = pacientes.Where(x => x.nombrePila.ToLower().Contains(idPaciente.Text.ToLower()));
             *      if (resultados.Count() == 0)
             *      {
             *          tituloFooterPacientes.IsVisible = true;
             *          pacientesLista.Footer = tituloFooterPacientes;
             *          pacientesLista.ItemsSource = resultados;
             *      }
             *      else
             *      {
             *          pacientesLista.Footer = "";
             *          pacientesLista.ItemsSource = resultados;
             *
             *      }
             *  }
             * };*/

            MessagingCenter.Subscribe <AsistentesFiltradoPage>(this, "OK", (sender) =>
            {
                idPacienteFocused   = false;
                empleados asistente = (empleados)sender.Pacientes.SelectedItem;
                idPaciente.Text     = asistente.nombre;
                //asunto.Text = asistente.nombrePila;
                idPaciente.TextColor            = Color.FromHex("3F3F3F");
                idPaciente.PlaceholderTextColor = Color.FromHex("B2B2B2");
                idPaciente.Unfocus();
                System.Diagnostics.Debug.WriteLine(idPacienteFocused);
                Constants.DatosEvento.idcapacitador = asistente.idEmpleado;
                foreach (var asis in Constants.AsistentesEvento)
                {
                    asis.rol = "Asistente";
                }
                if (Constants.AsistentesEvento.Any((asistent) => asistent.nombre.Equals(((empleados)sender.Pacientes.SelectedItem).nombre)))
                {
                    System.Diagnostics.Debug.WriteLine("Asistente ya esta en la lista");
                    Constants.AsistentesEvento.Remove((empleados)sender.Pacientes.SelectedItem);
                }
                ((empleados)sender.Pacientes.SelectedItem).rol = "Capacitador";
                Constants.AsistentesEvento.Add((empleados)sender.Pacientes.SelectedItem);
                MessagingCenter.Send <EventoDatosViewModel>(this, "OK_B");
            });

            MessagingCenter.Subscribe <AccionesFiltradoPage>(this, "OK", (sender) =>
            {
                if (Constants.AccionesEvento.Any((action) => action.idAccion == ((acciones)sender.AccionesContenido.SelectedItem).idAccion))
                {
                    System.Diagnostics.Debug.WriteLine("Action ya esta en la lista");
                }
                else
                {
                    Constants.AccionesEvento.Add((acciones)sender.AccionesContenido.SelectedItem);
                    ActionsColumns.Add(new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Auto)
                    });
                }
                int cnt = 0;
                Actions.Children.Clear();
                foreach (var accion in Constants.AccionesEvento)
                {
                    Actions.Children.Add(new Grid
                    {
                        WidthRequest  = 25,
                        HeightRequest = 25,
                        Children      =
                        {
                            new Image
                            {
                                Source = accion.icono,
                                Aspect = Aspect.AspectFit
                            }
                        }
                    }, cnt, 0);
                    cnt++;
                    System.Diagnostics.Debug.WriteLine(accion.Nombre);
                }
            });

            MessagingCenter.Subscribe <AplicacionesFiltradoPage>(this, "OK", (sender) =>
            {
                if (Constants.AplicacionesEvento.Any((app) => app.idAplicacion == ((aplicaciones)sender.AplicacionesContenido.SelectedItem).idAplicacion))
                {
                    System.Diagnostics.Debug.WriteLine("App ya esta en la lista");
                }
                else
                {
                    Constants.AplicacionesEvento.Add((aplicaciones)sender.AplicacionesContenido.SelectedItem);
                    AppsColumns.Add(new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Auto)
                    });
                }

                int cnt = 0;
                Apps.Children.Clear();
                foreach (var aplicacion in Constants.AplicacionesEvento)
                {
                    Apps.Children.Add(new Grid
                    {
                        WidthRequest  = 25,
                        HeightRequest = 25,
                        Children      =
                        {
                            new Image
                            {
                                Source = aplicacion.icono,
                                Aspect = Aspect.AspectFit
                            }
                        }
                    }, cnt, 0);
                    cnt++;
                    System.Diagnostics.Debug.WriteLine(aplicacion.Nombre);
                }
            });

            idPacienteFocused = false;
            Image FiltradoPaciente = new Image
            {
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Center,
                Source            = "idropdown.png",
                WidthRequest      = 10
            };
            var tapGestureRecognizer = new TapGestureRecognizer();

            tapGestureRecognizer.Tapped += (sender, e) =>
            {
                System.Diagnostics.Debug.WriteLine(idPacienteFocused);
                if (!idPacienteFocused && idPaciente.IsEnabled)
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        idPaciente.Focus();
                    });/*
                        * idPacienteFocused = true;
                        * var modeloVista = new VistaModelos.Pacientes.PacientesModeloVista() { Navigation = Navigation };
                        * //Navigation.PushAsync(new PacientesVista(modeloVista));
                        * await Navigation.PushModalAsync(new PacientesFiltradoVista(modeloVista));
                        * idPacienteFocused = false;
                        * return;*/
                }
                else
                {
                    return;
                }
            };
            FiltradoPaciente.GestureRecognizers.Add(tapGestureRecognizer);


            AddApp = new Image
            {
                Source        = "iFABPb",
                Aspect        = Aspect.AspectFill,
                WidthRequest  = 32,
                HeightRequest = 32,
            };

            TapGestureRecognizer AddAppTAP = new TapGestureRecognizer();

            AddAppTAP.Tapped += AddAppTAP_Tapped;
            AddApp.GestureRecognizers.Add(AddAppTAP);

            AddAction = new Image
            {
                Source        = "iFABPb",
                Aspect        = Aspect.AspectFill,
                WidthRequest  = 32,
                HeightRequest = 32,
            };

            TapGestureRecognizer AddActionTAP = new TapGestureRecognizer();

            AddActionTAP.Tapped += AddActionTAP_Tapped;;
            AddAction.GestureRecognizers.Add(AddActionTAP);

            asunto = new ExtendedEntry
            {
                Placeholder      = "INGRESA EL NOMBRE DEL EVENTO",
                PlaceholderColor = Color.FromHex("B2B2B2"),
                TextColor        = Color.FromHex("3F3F3F"),
                HasBorder        = false,
                //WidthRequest = 15,
                FontFamily = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                FontSize   = 14,
                XAlign     = TextAlignment.End,
                Margin     = new Thickness(0, 0, 15, 0)
            };
            asunto.SetBinding(Entry.TextProperty, "asunto");
            asunto.TextChanged += (sender, e) =>
            {
                //((ExtendedEntry)sender).Text=((ExtendedEntry)sender).Text.ToUpper();
                if (((ExtendedEntry)sender).Text.Length < 4)
                {
                    ((ExtendedEntry)sender).TextColor = Color.Red;
                }
                else
                {
                    ((ExtendedEntry)sender).TextColor = Color.FromHex("3F3F3F");
                }
            };
            asunto.Unfocused += (sender, e) =>
            {
                Constants.DatosEvento.nombre = asunto.Text.Trim();
            };
            lugar = new ExtendedEntry
            {
                PlaceholderColor = Color.FromHex("B2B2B2"),
                TextColor        = Color.FromHex("3F3F3F"),
                BackgroundColor  = Color.Transparent,
                HasBorder        = false,
                FontFamily       = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                FontSize         = 14,
                Placeholder      = "INGRESE LUGAR DEL EVENTO",
                XAlign           = TextAlignment.End,
                Margin           = new Thickness(0, 0, 15, 0)
            };
            lugar.TextChanged += Lugar_TextChanged;



            globalizacion = new System.Globalization.CultureInfo("es-GT");

            fecha = new ExtendedDatePicker
            {
                HasBorder         = false,
                Format            = globalizacion.DateTimeFormat.ShortDatePattern,
                Date              = hInicio.Date,
                Margin            = new Thickness(0, 5),
                HorizontalOptions = LayoutOptions.Center,
                TextColor         = Color.FromHex("3F3F3F"),
                Font              = Device.OnPlatform <Font>(Font.OfSize("OpenSans-Bold", 14), Font.OfSize("OpenSans-Bold", 14), Font.Default)
            };
            horaInicio = new ExtendedTimePicker
            {
                HasBorder         = false,
                Format            = globalizacion.DateTimeFormat.ShortTimePattern,
                Time              = hInicio.TimeOfDay,
                Margin            = new Thickness(0, 5),
                HorizontalOptions = LayoutOptions.Center,
                TextColor         = Color.FromHex("3F3F3F"),
                Font              = Device.OnPlatform <Font>(Font.OfSize("OpenSans-Bold", 14), Font.OfSize("OpenSans-Bold", 14), Font.Default)
            };
            horaInicio.PropertyChanged += (sender, e) =>
            {
                if (e.PropertyName == TimePicker.TimeProperty.PropertyName)
                {
                    if (horaInicio.Time.Hours.Equals(23))
                    {
                        horaFin.Time = new DateTime(hInicio.Year, hInicio.Month, hInicio.Day, horaInicio.Time.Hours, 59, 59, DateTimeKind.Local).TimeOfDay;
                    }
                    else
                    {
                        horaFin.Time = horaInicio.Time.Add(TimeSpan.FromHours(1));
                    }
                }
            };
            fechaInicio = new DateTimeControl(fecha, horaInicio);//2018-11-24T00:17:06.242Z
            Constants.DatosEvento.fechaInicio = fechaInicio.Value.ToString(@"yyyy-MM-ddTHH:mm:ss.fffZ");
            horaInicio.Unfocused += (sender, e) =>
            {
                fechaInicio = new DateTimeControl(fecha, horaInicio);
                Constants.DatosEvento.fechaInicio = fechaInicio.Value.ToString(@"yyyy-MM-ddTHH:mm:ss.fffZ");
            };
            horaFin = new ExtendedTimePicker
            {
                HasBorder         = false,
                Format            = globalizacion.DateTimeFormat.ShortTimePattern,
                Time              = hInicio.AddHours(1).TimeOfDay,
                Margin            = new Thickness(0, 5),
                HorizontalOptions = LayoutOptions.Center,
                TextColor         = Color.FromHex("3F3F3F"),
                Font              = Device.OnPlatform <Font>(Font.OfSize("OpenSans-Bold", 14), Font.OfSize("OpenSans-Bold", 14), Font.Default)
            };
            fechaFin = new DateTimeControl(fecha, horaFin);
            Constants.DatosEvento.fechaFin = fechaFin.Value.ToString(@"yyyy-MM-ddTHH:mm:ss.fffZ");
            horaFin.Unfocused += (sender, e) =>
            {
                fechaFin = new DateTimeControl(fecha, horaFin);
                Constants.DatosEvento.fechaFin = fechaFin.Value.ToString(@"yyyy-MM-ddTHH:mm:ss.fffZ");
            };
            horaFin.PropertyChanged += async(sender, e) =>
            {
                if (e.PropertyName == TimePicker.TimeProperty.PropertyName)
                {
                    if (horaInicio.Time > horaFin.Time)
                    {
                        //await DisplayAlert("¡Advertencia!", "La hora final de la cita debe ser mayor a la inicial.", "Aceptar");
                        if (horaInicio.Time.Hours.Equals(23))
                        {
                            horaFin.Time = new DateTime(hInicio.Year, hInicio.Month, hInicio.Day, horaInicio.Time.Hours, 59, 59, DateTimeKind.Local).TimeOfDay;
                        }
                        else
                        {
                            horaFin.Time = horaInicio.Time.Add(TimeSpan.FromHours(1));
                        }
                        return;
                    }
                }
            };


            Grid horas = new Grid
            {
                ColumnSpacing     = 10,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Auto)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Auto)
                    }
                }
            };

            horas.Children.Add(
                new Label {
                Text = "Hora inicio", TextColor = Color.FromHex("3F3F3F")
            }, 0, 0);
            horas.Children.Add(
                new Label {
                Text = "Hora fin", TextColor = Color.FromHex("3F3F3F")
            }, 2, 0);
            horas.Children.Add(horaInicio, 0, 1);
            horas.Children.Add(
                new Image
            {
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Center,
                Source            = "idropdown.png",
                WidthRequest      = 10
            }, 1, 1);
            horas.Children.Add(horaFin, 2, 1);
            horas.Children.Add(
                new Image
            {
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Center,
                Source            = "idropdown.png",
                WidthRequest      = 10
            }, 3, 1);


            Grid Fechas = new Grid
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                ColumnSpacing     = 10,
                //HeightRequest = 50,
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(45, GridUnitType.Auto)
                    },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                }
            };

            Grid AppsHeader = new Grid
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                ColumnSpacing     = 10,
                //HeightRequest = 50,
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(32, GridUnitType.Absolute)
                    },
                }
            };

            AppsHeader.Children.Add(new Label
            {
                VerticalOptions       = LayoutOptions.Center,
                VerticalTextAlignment = TextAlignment.Center,
                Text           = "APLICACIONES A MONITOREAR:",
                FontSize       = 13,
                TextColor      = Color.FromHex("432161"),
                FontAttributes = FontAttributes.Bold,
                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
            }, 0, 0);

            AppsHeader.Children.Add(AddApp, 1, 0);

            Grid ActionsHeader = new Grid
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                ColumnSpacing     = 10,
                //HeightRequest = 50,
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(45, GridUnitType.Auto)
                    },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(32, GridUnitType.Absolute)
                    },
                }
            };

            ActionsHeader.Children.Add(new Label
            {
                VerticalOptions       = LayoutOptions.Center,
                VerticalTextAlignment = TextAlignment.Center,
                Text           = "ACCIONES:",
                FontSize       = 13,
                TextColor      = Color.FromHex("432161"),
                FontAttributes = FontAttributes.Bold,
                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
            }, 0, 0);

            ActionsHeader.Children.Add(AddAction, 1, 0);


            Apps = new Grid
            {
                Padding           = new Thickness(0, 10),
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.Center,
                ColumnSpacing     = 15,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                },
                ColumnDefinitions = AppsColumns
            };

            Actions = new Grid
            {
                Padding           = new Thickness(0, 10),
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.Center,
                ColumnSpacing     = 15,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                },
                ColumnDefinitions = ActionsColumns
            };

            RelativeLayout componenteInicio = new RelativeLayout();

            componenteInicio.Children.Add(
                new RoundedBoxView.Forms.Plugin.Abstractions.RoundedBoxView
            {
                BackgroundColor = Color.FromHex("B2B2B2"),
                CornerRadius    = 6,
            },
                Constraint.Constant(-4),
                Constraint.Constant(4),
                Constraint.RelativeToParent((parent) => { return(parent.Width + 4); }),
                Constraint.RelativeToParent((parent) => { return(parent.Height - 4); }));
            componenteInicio.Children.Add(
                new RoundedBoxView.Forms.Plugin.Abstractions.RoundedBoxView
            {
                BackgroundColor = Color.FromHex("E5E5E5"),
                CornerRadius    = 6,
            },
                Constraint.Constant(-4),
                Constraint.Constant(0),
                Constraint.RelativeToParent((parent) => { return(parent.Width); }),
                Constraint.RelativeToParent((parent) => { return(parent.Height - 4); }));

            Fechas.Children.Add(
                componenteInicio, 0, 0);
            Fechas.Children.Add(
                new StackLayout
            {
                Padding           = new Thickness(15, 10),
                Spacing           = 0,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Children          =
                {
                    new Label
                    {
                        Text              = "INICIO",
                        FontSize          = 13,
                        TextColor         = Color.FromHex("432161"),
                        FontAttributes    = FontAttributes.Bold,
                        HorizontalOptions = LayoutOptions.Start,
                        FontFamily        = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
                    },
                    new StackLayout
                    {
                        Spacing           = 0,
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                        VerticalOptions   = LayoutOptions.CenterAndExpand,
                        Children          =
                        {
                            fecha,
                            new BoxView {
                                BackgroundColor = Color.FromHex("432161"),HeightRequest                                          = 2
                            },
                            horaInicio
                        }
                    }
                }
            }, 0, 0);

            RelativeLayout componenteFinal = new RelativeLayout();

            componenteFinal.Children.Add(
                new RoundedBoxView.Forms.Plugin.Abstractions.RoundedBoxView
            {
                BackgroundColor = Color.FromHex("B2B2B2"),
                CornerRadius    = 6,
            },
                Constraint.Constant(4),
                Constraint.Constant(4),
                Constraint.RelativeToParent((parent) => { return(parent.Width + 4); }),
                Constraint.RelativeToParent((parent) => { return(parent.Height - 4); }));
            componenteFinal.Children.Add(
                new RoundedBoxView.Forms.Plugin.Abstractions.RoundedBoxView
            {
                BackgroundColor = Color.FromHex("E5E5E5"),
                CornerRadius    = 6,
            },
                Constraint.Constant(0),
                Constraint.Constant(0),
                Constraint.RelativeToParent((parent) => { return(parent.Width + 4); }),
                Constraint.RelativeToParent((parent) => { return(parent.Height - 4); }));
            Fechas.Children.Add(
                componenteFinal, 1, 0);
            Fechas.Children.Add(
                new StackLayout
            {
                Padding           = new Thickness(15, 10),
                Spacing           = 0,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Children          =
                {
                    new Label
                    {
                        Text              = "FINAL",
                        FontSize          = 13,
                        TextColor         = Color.FromHex("432161"),
                        FontAttributes    = FontAttributes.Bold,
                        HorizontalOptions = LayoutOptions.Start,
                        FontFamily        = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
                    },
                    new StackLayout
                    {
                        Spacing           = 0,
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                        VerticalOptions   = LayoutOptions.CenterAndExpand,
                        Children          =
                        {
                            new Label
                            {
                                Text = "--",
                                HorizontalOptions = LayoutOptions.Center,
                                Margin            = new Thickness(0, Device.OnPlatform(5, 7, 0)),
                                FontSize          = 14,
                                TextColor         = Color.FromHex("B2B2B2"),
                                FontFamily        = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                            },
                            new BoxView {
                                BackgroundColor = Color.FromHex("432161"), HeightRequest = 2
                            },
                            horaFin
                        }
                    }
                }
            }, 1, 0);

            contenidoCreacionEdicion = new ScrollView
            {
                Padding = new Thickness(0, 0, 0, 15),
                Content = new StackLayout
                {
                    Spacing  = 10,
                    Children =
                    {
                        new StackLayout
                        {
                            Spacing  = 0,
                            Children =
                            {
                                new StackLayout
                                {
                                    Padding         = new Thickness(15, 5, 15, 10),
                                    Spacing         = 0,
                                    BackgroundColor = Color.FromHex("E5E5E5"),
                                    Children        =
                                    {
                                        /*new StackLayout
                                         * {
                                         *  Orientation = StackOrientation.Horizontal,
                                         *  HorizontalOptions = LayoutOptions.CenterAndExpand,
                                         *  Children =
                                         *  {
                                         *      new IconView
                                         *      {
                                         *          Source = "iNCinfo.png",
                                         *          WidthRequest = 15,
                                         *          Foreground = Color.FromHex("432161"),
                                         *          VerticalOptions = LayoutOptions.Center
                                         *      },
                                         *      new Label
                                         *      {
                                         *          Text = "Datos de evento",
                                         *          TextColor = Color.FromHex("432161"),
                                         *          FontFamily = Device.OnPlatform("OpenSans-ExtraBold", "OpenSans-ExtraBold", null),
                                         *          FontSize = 18,
                                         *          VerticalOptions = LayoutOptions.Center
                                         *      }
                                         *  }
                                         * },*/
                                        new StackLayout
                                        {
                                            Spacing  = 0,
                                            Children =
                                            {
                                                new Label
                                                {
                                                    Text           = "NOMBRE DEL EVENTO:*",
                                                    FontSize       = 13,
                                                    TextColor      = Color.FromHex("432161"),
                                                    FontAttributes = FontAttributes.Bold,
                                                    FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
                                                },
                                                new StackLayout
                                                {
                                                    Spacing  = 1,
                                                    Children =
                                                    {
                                                        asunto,
                                                        new BoxView {
                                                            BackgroundColor = Color.FromHex("432161"),HeightRequest                                         = 2
                                                        },
                                                    }
                                                }
                                            }
                                        }
                                    }
                                },
                                new BoxView                         {
                                    VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.FromHex("B3B3B3"), HeightRequest = 4
                                },
                            }
                        },
                        new StackLayout
                        {
                            Spacing  = 0,
                            Children =
                            {
                                new StackLayout
                                {
                                    Padding         = new Thickness(15, 5, 15, 10),
                                    Spacing         = 0,
                                    BackgroundColor = Color.FromHex("E5E5E5"),
                                    Children        =
                                    {
                                        new StackLayout
                                        {
                                            Spacing  = 0,
                                            Children =
                                            {
                                                new Label
                                                {
                                                    Text           = "DIRECCIÓN:*",
                                                    FontSize       = 13,
                                                    TextColor      = Color.FromHex("432161"),
                                                    FontAttributes = FontAttributes.Bold,
                                                    FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
                                                },
                                                new StackLayout
                                                {
                                                    Spacing  = 1,
                                                    Children =
                                                    {
                                                        lugar,
                                                        new BoxView {
                                                            BackgroundColor = Color.FromHex("432161"),HeightRequest                                          = 2
                                                        },
                                                    }
                                                }
                                            }
                                        }
                                    }
                                },
                                new BoxView                         {
                                    VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.FromHex("B3B3B3"), HeightRequest = 4
                                },
                            }
                        },
                        new StackLayout
                        {
                            Spacing  = 0,
                            Children =
                            {
                                new StackLayout
                                {
                                    Padding         = new Thickness(15, 5, 15, 10),
                                    Spacing         = 0,
                                    BackgroundColor = Color.FromHex("E5E5E5"),
                                    Children        =
                                    {
                                        new StackLayout
                                        {
                                            Spacing  = 0,
                                            Children =
                                            {
                                                new Label
                                                {
                                                    Text           = "CAPACITADOR:*",
                                                    TextColor      = Color.FromHex("432161"),
                                                    FontSize       = 13,
                                                    FontAttributes = FontAttributes.Bold,
                                                    FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
                                                },
                                                new StackLayout
                                                {
                                                    Spacing  = 1,
                                                    Children =
                                                    {
                                                        //entry, myListView ,
                                                        new Grid
                                                        {
                                                            Children =
                                                            {
                                                                new StackLayout
                                                                {
                                                                    Children =
                                                                    {
                                                                        idPaciente,
                                                                        //pacientesLista
                                                                    }
                                                                },
                                                                FiltradoPaciente
                                                            }
                                                        },
                                                        new BoxView {
                                                            BackgroundColor = Color.FromHex("432161"), HeightRequest = 2
                                                        },
                                                    }
                                                }
                                            }
                                        }
                                    }
                                },
                                new BoxView                         {
                                    VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.FromHex("B3B3B3"), HeightRequest = 4
                                },
                            }
                        },
                        Fechas,
                        new StackLayout
                        {
                            Spacing  = 0,
                            Children =
                            {
                                new StackLayout
                                {
                                    Padding         = new Thickness(15, 5),
                                    BackgroundColor = Color.FromHex("E5E5E5"),
                                    Children        =
                                    {
                                        new StackLayout
                                        {
                                            Spacing  = 0,
                                            Children =
                                            {
                                                AppsHeader,
                                                Apps
                                            }
                                        }
                                    }
                                },
                                new BoxView                         {
                                    VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.FromHex("B3B3B3"), HeightRequest = 4
                                },
                            }
                        },
                        new StackLayout
                        {
                            Spacing  = 0,
                            Children =
                            {
                                new StackLayout
                                {
                                    Padding         = new Thickness(15, 5),
                                    BackgroundColor = Color.FromHex("E5E5E5"),
                                    Children        =
                                    {
                                        new StackLayout
                                        {
                                            Spacing  = 0,
                                            Children =
                                            {
                                                ActionsHeader,
                                                Actions
                                            }
                                        }
                                    }
                                },
                                new BoxView                         {
                                    VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.FromHex("B3B3B3"), HeightRequest = 4
                                },
                            }
                        }
                    }
                }
            };

            Content = contenidoCreacionEdicion;
        }
        public AsistentesFiltradoPage(bool capacitador)
        {
            Title            = "Filtrado";
            this.capacitador = capacitador;

            indicadorFooterPacientes = new ActivityIndicator
            {
                IsRunning         = true,
                Color             = Color.Accent,
                HorizontalOptions = LayoutOptions.End,
                WidthRequest      = 20
            };
            tituloFooterPacientes = new Label
            {
                FontFamily        = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                Text = "Cargando empleados..."
            };
            Grid PacientesFooter = new Grid
            {
                HeightRequest     = 60,
                Padding           = new Thickness(5, 0, 5, 0),
                RowSpacing        = 1,
                ColumnSpacing     = 1,
                BackgroundColor   = Color.Transparent,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Auto)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                }
            };

            PacientesFooter.Children.Add(indicadorFooterPacientes, 0, 0);
            PacientesFooter.Children.Add(tituloFooterPacientes, 1, 0);

            BusquedaRapida =
                new ExtendedEntry
            {
                Placeholder      = "Buscar",
                HasBorder        = false,
                BackgroundColor  = Color.Transparent,
                Margin           = new Thickness(10, 0),
                HeightRequest    = 30,
                PlaceholderColor = Color.FromHex("432161"),
                FontSize         = 14,
                TextColor        = Color.FromHex("432161"),
                FontFamily       = Device.OnPlatform("OpenSans", "OpenSans-Regular", null)
            };

            BusquedaRapida.TextChanged += BusquedaRapida_TextChanged;

            Grid PacientesHeader = new Grid
            {
                //Padding = new Thickness(0,0,10,0),
                ColumnSpacing     = 5,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Auto)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Auto)
                    },
                }
            };
            Image cancelar = new Image
            {
                //Foreground = Color.FromHex("F7B819"),
                Source        = "iCancelarB.png",
                HeightRequest = 25,
                WidthRequest  = 25,
            };
            TapGestureRecognizer cancelarTAP = new TapGestureRecognizer();

            cancelarTAP.Tapped += (sender, e) => { Navigation.PopModalAsync(); };
            cancelar.GestureRecognizers.Add(cancelarTAP);
            Image buscar = new Image
            {
                Source        = "iBusqueda.png",
                HeightRequest = 25,
                WidthRequest  = 25,
            };
            TapGestureRecognizer buscarTAP = new TapGestureRecognizer();

            buscarTAP.Tapped += async(sender, e) =>
            {
                /*OcultarModal();
                 * if (String.IsNullOrEmpty(BusquedaRapida.Text))
                 * {
                 *  await DisplayAlert("Búsqueda avanzada", "Debe ingresar una expresión para buscar en la nube.", "Aceptar");
                 *  return;
                 * }
                 * tituloFooterPacientes.Text = "Buscando coincidencias...";
                 * indicadorFooterPacientes.IsRunning = true;
                 *
                 *
                 * SelectForList peticion = new SelectForList
                 * {
                 *  searchText = BusquedaRapida.Text
                 * };
                 * await App.ManejadorDatos.SelectForListAsync(peticion, true);
                 * var PacientesActualizados = new ObservableCollection<pacientes>(App.Database.GetPacientesOrderByNombre());
                 * try
                 * {
                 *  VistaModelo.FiltrarPacientes(BusquedaRapida.Text.Trim(), PacientesActualizados.ToList());
                 *  Pacientes.ItemsSource = VistaModelo.PacientesAgrupados;
                 * }
                 * finally
                 * {
                 *  indicadorFooterPacientes.IsRunning = false;
                 *  if (VistaModelo.Pacientes.Count != 0)
                 *      tituloFooterPacientes.Text = VistaModelo.Pacientes.Count + " paciente(s) encontrados";
                 *  else
                 *  {
                 *      iBusquedaIndicador.IsVisible = false;
                 *      tituloFooterPacientes.Text = VistaModelo.Pacientes.Count + " paciente(s) encontrados";
                 *      ModalMensaje.Text = "Lo lamentamos, tampoco hemos encontrado resultados para tu búsqueda: '" + BusquedaRapida.Text + "' en medicloud.me (web) intente con otra expresión.";
                 *      ModalInstruccion.Text = "";
                 *      Contenido.Children.Add(Modal,
                 *              xConstraint: Constraint.Constant(0),
                 *              yConstraint: Constraint.RelativeToView(HeaderPacientes, (parent, view) => { return (view.Y + view.Height); }),
                 *              widthConstraint: Constraint.RelativeToParent((parent) => { return parent.Width; }),
                 *              heightConstraint: Constraint.RelativeToView(HeaderPacientes, (parent, view) => { return (parent.Height - view.Height); })
                 *          );
                 *  }
                 * }*/
            };
            buscar.GestureRecognizers.Add(buscarTAP);
            PacientesHeader.Children.Add(
                new RoundedBoxView.Forms.Plugin.Abstractions.RoundedBoxView
            {
                BackgroundColor = Color.FromHex("E5E5E5"),
                CornerRadius    = 6,
                HeightRequest   = 20,
                //WidthRequest = 128,
            }, 0, 0);
            PacientesHeader.Children.Add(BusquedaRapida, 0, 0);
            PacientesHeader.Children.Add(cancelar, 1, 0);
            PacientesHeader.Children.Add(buscar, 2, 0);

            HeaderPacientes = new StackLayout
            {
                Padding  = new Thickness(10, 10, 10, 20),
                Children = { PacientesHeader }
            };



            Modal = new Grid();
            Modal.Children.Add(new Grid
            {
                BackgroundColor = Color.Black,
                Opacity         = 0.65,
                Padding         = new Thickness(0, 0, 0, 0),
                WidthRequest    = 200,
                HeightRequest   = 200,
            });

            ModalMensaje = new Label
            {
                TextColor  = Color.White,
                FontFamily = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                FontSize   = 18,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
            };
            ModalInstruccion = new Label
            {
                TextColor  = Color.White,
                FontFamily = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                FontSize   = 18,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
            };
            iBusquedaIndicador = new Image
            {
                VerticalOptions   = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.End,
                WidthRequest      = 25,
                HeightRequest     = 25,
                Source            = "iBusquedaIndicador.png"
            };
            StackLayout ModalContenido = new StackLayout
            {
                Padding           = 15,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    iBusquedaIndicador,
                    new StackLayout
                    {
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                        VerticalOptions   = LayoutOptions.CenterAndExpand,
                        Spacing           = 15,
                        Padding           = 30,
                        Children          =
                        {
                            ModalMensaje,
                            ModalInstruccion
                        }
                    }
                }
            };

            Modal.Children.Add(ModalContenido);



            var GestoModal = new TapGestureRecognizer();

            GestoModal.Tapped += (s, e) =>
            {
                ActualizarPacientes();
                OcultarModal();
                BusquedaRapida.Focus();
            };

            ModalContenido.GestureRecognizers.Add(GestoModal);
            Pacientes = new ListView
            {
                BackgroundColor   = Color.Transparent,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                //IsScrollEnable = false,
                ItemsSource            = App.Database.GetEmpleados(Convert.ToInt32(Settings.session_idUsuario)).ToList(),
                ItemTemplate           = new DataTemplate(typeof(EventoEmpleadosDTViewModel)),
                Margin                 = 0,
                RowHeight              = 55, //Convert.ToInt32((App.DisplayScreenHeight / 13.533333333333333)),
                IsPullToRefreshEnabled = false,
                SeparatorVisibility    = SeparatorVisibility.None,
                SeparatorColor         = Color.Transparent,
                HasUnevenRows          = false,
                VerticalOptions        = LayoutOptions.FillAndExpand,
            };

            //Pacientes.IsPullToRefreshEnabled
            Pacientes.Refreshing   += Pacientes_Refreshing;
            Pacientes.ItemSelected += Pacientes_ItemSelected;
            Pacientes.Focused      += (sender, e) =>
            {
                System.Diagnostics.Debug.WriteLine("entro a focus lista");
                try { BusquedaRapida.Unfocus(); }
                catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); }
            };

            Contenido = new RelativeLayout();
            Contenido.Children.Add(HeaderPacientes,
                                   xConstraint: Constraint.Constant(0),
                                   yConstraint: Constraint.Constant(0),
                                   widthConstraint: Constraint.RelativeToParent(parent => parent.Width));
            Padding = new Thickness(0, 40, 0, 0);
            Content = Contenido;
            PacientesVistaVisible    = false;
            PacientesVistaPresentado = true;
        }
        public ServiciosAsociadosDTModeloVista()
        {
            Titulo = new ExtendedEntry()
            {
                Margin            = 0,
                IsEnabled         = false,
                Keyboard          = Keyboard.Text,
                Placeholder       = "Alias de servicio",
                PlaceholderColor  = Color.FromHex("D9D9D9"),
                FontFamily        = Device.OnPlatform("Montserrat-Bold", "Montserrat-Bold", null),
                TextColor         = Color.FromHex("4D4D4D"),
                BackgroundColor   = Color.Transparent,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                HasBorder         = false,
                FontSize          = App.DisplayScreenWidth / 25.066666666666667
            };

            Titulo.SetBinding(ExtendedEntry.TextProperty, "alias");

            Titulo.Focused += (sender, e) =>
            {
                Titulo.TextChanged += Titulo_TextChanged;
            };
            Titulo.Unfocused += (sender, e) =>
            {
                Titulo.TextChanged -= Titulo_TextChanged;
                servicios ContextoActual = (servicios)this.BindingContext;

                /*if (ContextoActual != null && !string.IsNullOrEmpty(ContextoActual.name))
                 *  App.Database.InsertLista(ContextoActual);*/
            };

            IconView Editar = new IconView
            {
                Source        = "iEditar",
                Foreground    = Color.FromHex("BFBFBF"),
                WidthRequest  = App.DisplayScreenWidth / 25.066666666666667,
                HeightRequest = App.DisplayScreenHeight / 25.066666666666667
            };

            TapGestureRecognizer EditarTAP = new TapGestureRecognizer {
                NumberOfTapsRequired = 1
            };

            EditarTAP.Tapped += (sender, e) =>
            {
                if (Titulo.IsEnabled)
                {
                    Titulo.Unfocus();
                    Titulo.IsEnabled = false;
                }

                else
                {
                    Titulo.IsEnabled = true;
                    Titulo.Focus();
                }
            };
            Editar.GestureRecognizers.Add(EditarTAP);

            Label Proveedor = new Label
            {
                BackgroundColor = Color.Transparent,
                FontFamily      = Device.OnPlatform("Montserrat-Regular", "Montserrat-Regular", null),
                TextColor       = Color.FromHex("4D4D4D"),
                FontSize        = (App.DisplayScreenWidth / 37.6)
            };

            Proveedor.SetBinding(Label.TextProperty, "proveedor");

            Image iProveedor = new Image
            {
                Source            = "iEEGSA",
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Center,
                WidthRequest      = App.DisplayScreenWidth / 3.159663865546218,
                HeightRequest     = App.DisplayScreenWidth / 6.121784435037447,
                Aspect            = Aspect.Fill
            };

            Label Categoria = new Label
            {
                BackgroundColor = Color.Transparent,
                FontFamily      = Device.OnPlatform("Montserrat-Regular", "Montserrat-Regular", null),
                TextColor       = Color.FromHex("4D4D4D"),
                FontSize        = (App.DisplayScreenWidth / 37.6)
            };

            Categoria.SetBinding(Label.TextProperty, "categoria");

            Label Saldo = new Label
            {
                HorizontalTextAlignment = TextAlignment.End,
                BackgroundColor         = Color.Transparent,
                FontFamily = Device.OnPlatform("Montserrat-Bold", "Montserrat-Bold", null),
                TextColor  = Color.FromHex("4D4D4D"),
                FontSize   = (App.DisplayScreenWidth / 31.333333333333333)
            };

            Saldo.SetBinding(Label.TextProperty, "saldo");

            Label Aviso = new Label
            {
                HorizontalTextAlignment = TextAlignment.End,
                BackgroundColor         = Color.Transparent,
                FontFamily = Device.OnPlatform("Montserrat-Regular", "Montserrat-Regular", null),
                TextColor  = Color.FromHex("4D4D4D"),
                FontSize   = (App.DisplayScreenWidth / 37.6)
            };

            Aviso.SetBinding(Label.TextProperty, "aviso");

            Label Vencimiento = new Label
            {
                HorizontalTextAlignment = TextAlignment.End,
                BackgroundColor         = Color.Transparent,
                FontFamily = Device.OnPlatform("Montserrat-Regular", "Montserrat-Regular", null),
                TextColor  = Color.FromHex("4D4D4D"),
                FontSize   = (App.DisplayScreenWidth / 37.6)
            };

            Vencimiento.SetBinding(Label.TextProperty, "vencimiento");


            Header = new Grid
            {
                Padding           = 0,
                ColumnSpacing     = App.DisplayScreenWidth / 37.6,
                RowSpacing        = 0,
                VerticalOptions   = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    }
                },

                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Auto)
                    }
                }
            };

            Header.Children.Add(Titulo, 0, 0);
            Header.Children.Add(Proveedor, 0, 1);
            Header.Children.Add(Categoria, 0, 2);
            Header.Children.Add(Editar, 1, 0);


            Footer = new Grid
            {
                Padding           = 0,
                RowSpacing        = 0,
                VerticalOptions   = LayoutOptions.End,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    }
                },

                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    }
                }
            };

            Footer.Children.Add(Saldo, 0, 0);
            Footer.Children.Add(Aviso, 0, 1);
            Footer.Children.Add(Vencimiento, 0, 2);

            Grid Contenido = new Grid
            {
                Padding           = new Thickness((App.DisplayScreenWidth / 10.742857142857143), (App.DisplayScreenWidth / 16.347826086956522), (App.DisplayScreenWidth / 10.742857142857143), (App.DisplayScreenWidth / 18.8)),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                RowSpacing        = App.DisplayScreenWidth / 26.666666666666667,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                }
            };

            Contenido.Children.Add(Header, 0, 0);
            Contenido.Children.Add(new Grid
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    iProveedor,
                    Footer
                }
            }, 0, 1);



            View = new Grid
            {
                Padding  = new Thickness((App.DisplayScreenWidth / 12.533333333333333), (App.DisplayScreenWidth / 37.6), 0, (App.DisplayScreenWidth / 37.6)),
                Children =
                {
                    new Frame
                    {
                        Padding           = 0,
                        HeightRequest     = App.DisplayScreenWidth / 2.211764705882353,
                        BackgroundColor   = Color.Transparent,
                        HasShadow         = true,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Content           = new Grid
                        {
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            VerticalOptions   = LayoutOptions.FillAndExpand,
                            Padding           = 0,
                            Children          =
                            {
                                new Image
                                {
                                    Source = "iServicioBackground",
                                    Aspect = Aspect.Fill
                                },
                                Contenido
                            }
                        }
                    }
                }
            };
        }
        public EmpleadosDTViewModel()
        {
            MessagingCenter.Subscribe <EmpleadoPage>(this, "DisplayAlert", (sender) =>
            {
                System.Diagnostics.Debug.WriteLine("Método para obtener empleados");
            });

            MessagingCenter.Subscribe <MainPage>(this, "CargaEmpleados", (sender) =>
            {
                ActualizarPacientes();
            });

            BusquedaRapida =
                new ExtendedEntry
            {
                Placeholder      = "Buscar",
                HasBorder        = false,
                BackgroundColor  = Color.Transparent,
                Margin           = new Thickness(10, 0),
                HeightRequest    = 30,
                PlaceholderColor = Color.FromHex("432161"),
                FontSize         = 14,
                TextColor        = Color.FromHex("432161"),
                FontFamily       = Device.OnPlatform("OpenSans", "OpenSans-Regular", null)
            };

            BusquedaRapida.TextChanged += BusquedaRapida_TextChanged;

            Grid PacientesHeader = new Grid
            {
                //Padding = new Thickness(0,0,10,0),
                ColumnSpacing     = 5,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Auto)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Auto)
                    },
                }
            };
            Image cancelar = new Image
            {
                //Foreground = Color.FromHex("F7B819"),
                Source        = "iCancelarB.png",
                HeightRequest = 25,
                WidthRequest  = 25,
            };
            TapGestureRecognizer cancelarTAP = new TapGestureRecognizer();

            cancelarTAP.Tapped += (sender, e) => { Navigation.PopModalAsync(); };
            cancelar.GestureRecognizers.Add(cancelarTAP);
            Image buscar = new Image
            {
                //Foreground = Color.FromHex("F7B819"),
                Source        = "iBusqueda.png",
                HeightRequest = 25,
                WidthRequest  = 25,
            };
            TapGestureRecognizer buscarTAP = new TapGestureRecognizer();

            buscarTAP.Tapped += async(sender, e) =>
            {
                /*OcultarModal();
                 * if (String.IsNullOrEmpty(BusquedaRapida.Text))
                 * {
                 *  await DisplayAlert("Búsqueda avanzada", "Debe ingresar una expresión para buscar en la nube.", "Aceptar");
                 *  return;
                 * }
                 * tituloFooterPacientes.Text = "Buscando coincidencias...";
                 * indicadorFooterPacientes.IsRunning = true;
                 *
                 *
                 * SelectForList peticion = new SelectForList
                 * {
                 *  searchText = BusquedaRapida.Text
                 * };
                 * await App.ManejadorDatos.SelectForListAsync(peticion, true);
                 * var PacientesActualizados = new ObservableCollection<pacientes>(App.Database.GetPacientesOrderByNombre());
                 * try
                 * {
                 *  VistaModelo.FiltrarPacientes(BusquedaRapida.Text.Trim(), PacientesActualizados.ToList());
                 *  Pacientes.ItemsSource = VistaModelo.PacientesAgrupados;
                 * }
                 * finally
                 * {
                 *  indicadorFooterPacientes.IsRunning = false;
                 *  if (VistaModelo.Pacientes.Count != 0)
                 *      tituloFooterPacientes.Text = VistaModelo.Pacientes.Count + " paciente(s) encontrados";
                 *  else
                 *  {
                 *      iBusquedaIndicador.IsVisible = false;
                 *      tituloFooterPacientes.Text = VistaModelo.Pacientes.Count + " paciente(s) encontrados";
                 *      ModalMensaje.Text = "Lo lamentamos, tampoco hemos encontrado resultados para tu búsqueda: '" + BusquedaRapida.Text + "' en medicloud.me (web) intente con otra expresión.";
                 *      ModalInstruccion.Text = "";
                 *      Contenido.Children.Add(Modal,
                 *              xConstraint: Constraint.Constant(0),
                 *              yConstraint: Constraint.RelativeToView(HeaderPacientes, (parent, view) => { return (view.Y + view.Height); }),
                 *              widthConstraint: Constraint.RelativeToParent((parent) => { return parent.Width; }),
                 *              heightConstraint: Constraint.RelativeToView(HeaderPacientes, (parent, view) => { return (parent.Height - view.Height); })
                 *          );
                 *  }
                 * }*/
            };
            buscar.GestureRecognizers.Add(buscarTAP);
            PacientesHeader.Children.Add(
                new RoundedBoxView.Forms.Plugin.Abstractions.RoundedBoxView
            {
                BackgroundColor = Color.FromHex("E5E5E5"),
                CornerRadius    = 6,
                HeightRequest   = 20,
                //WidthRequest = 128,
            }, 0, 0);
            PacientesHeader.Children.Add(BusquedaRapida, 0, 0);
            PacientesHeader.Children.Add(cancelar, 1, 0);
            PacientesHeader.Children.Add(buscar, 2, 0);

            HeaderPacientes = new StackLayout
            {
                Padding  = new Thickness(10, 10, 10, 20),
                Children = { PacientesHeader }
            };

            Pacientes = new ListView
            {
                BackgroundColor   = Color.Transparent,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                //IsScrollEnable = false,
                ItemsSource            = Empleados,
                ItemTemplate           = new DataTemplate(typeof(EmpleadoDTViewModel)),
                Margin                 = 0,
                RowHeight              = 55, //Convert.ToInt32((App.DisplayScreenHeight / 13.533333333333333)),
                IsPullToRefreshEnabled = false,
                SeparatorVisibility    = SeparatorVisibility.None,
                SeparatorColor         = Color.Transparent,
                HasUnevenRows          = false,
                VerticalOptions        = LayoutOptions.FillAndExpand,
            };

            //Pacientes.sour
            Pacientes.ItemSelected += Pacientes_ItemSelected;
            Pacientes.Focused      += (sender, e) =>
            {
                System.Diagnostics.Debug.WriteLine("entro a focus lista");
                try { BusquedaRapida.Unfocus(); }
                catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); }
            };

            try
            {
                addFAB = new FloatingActionButton
                {
                    Image       = "iFABPa",
                    ButtonColor = Color.FromHex("F7B819"),
                    BorderColor = Color.FromHex("F7B819"),
                    TextColor   = Color.FromHex("F7B819"),
                    //BackgroundColor = Color.FromHex("F7B819")
                };
                addFAB.Clicked += AddFAB_Clicked;;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }

            Contenido = new RelativeLayout();
            Contenido.Children.Add(HeaderPacientes,
                                   xConstraint: Constraint.Constant(0),
                                   yConstraint: Constraint.Constant(0),
                                   widthConstraint: Constraint.RelativeToParent(parent => parent.Width));
            Padding = new Thickness(0, 10, 0, 0);
            Content = Contenido;
            PacientesVistaVisible    = false;
            PacientesVistaPresentado = true;
            Contenido.Children.Add(new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Spacing           = 0,
                Children          =
                {
                    new Grid
                    {
                        BackgroundColor   = Color.FromHex("E5E5E5"),
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        VerticalOptions   = LayoutOptions.FillAndExpand,
                        Padding           = new Thickness(20, 0),
                        Children          = { Pacientes             }
                    },
                    new BoxView {
                        BackgroundColor = Color.FromHex("B3B3B3"), HeightRequest = 4
                    }
                }
            },
                                   xConstraint: Constraint.Constant(0),
                                   // yConstraint: Constraint.Constant(0),
                                   yConstraint: Constraint.RelativeToView(HeaderPacientes, (parent, view) => { return(view.Height); }),
                                   widthConstraint: Constraint.RelativeToParent(parent => parent.Width),
                                   heightConstraint: Constraint.RelativeToView(HeaderPacientes, (parent, view) => { return(parent.Height - view.Height); })
                                   );
            Contenido.Children.Add(addFAB,
                                   xConstraint: Constraint.RelativeToParent((parent) => { return(parent.Width - 66); }),
                                   yConstraint: Constraint.RelativeToParent((parent) => { return(parent.Height - 66); })
                                   );
        }
Exemplo n.º 7
0
        public Forget(String user)
        {
            Usuario = new ExtendedEntry()
            {
                Keyboard         = Keyboard.Email,
                HasBorder        = false,
                IsPassword       = false,
                Placeholder      = "Toca para ingresar",
                PlaceholderColor = Color.FromHex("91a5af"),
                FontFamily       = Device.OnPlatform("Montserrat-Regular", "Montserrat-Regular", null),
                TextColor        = Color.FromHex("CDCDCD"),
                XAlign           = TextAlignment.End,
                FontSize         = 14,
                Margin           = 0,
                ReturnKeyType    = ReturnKeyTypes.Go
            };

            Usuario.Completed += (sender, e) => { Usuario.Unfocus(); recuperacion(); };

            if (!string.IsNullOrEmpty(user))
            {
                Usuario.Text = user.Trim();
            }



            recuperar = new Button
            {
                Text              = "RECUPERAR",
                VerticalOptions   = LayoutOptions.Start,
                TextColor         = Color.FromHex("ffffff"),
                FontFamily        = Device.OnPlatform("Montserrat-Bold", "Montserrat-Bold", null),
                FontSize          = 15,
                HorizontalOptions = LayoutOptions.Center,
                BackgroundColor   = Color.FromHex("3E1152"),
                WidthRequest      = 200,
                HeightRequest     = 35,
                BorderRadius      = 20,
            };
            recuperar.Clicked += Recuperar_Clicked;

            IconView cerrar = new IconView
            {
                //Margin = new Thickness(0, 0, 10, 0),
                HorizontalOptions = LayoutOptions.End,
                Source            = "iCancelarEdicion.png",
                Foreground        = Color.FromHex("a2b3bb"),
                WidthRequest      = 20,
                HeightRequest     = 20
            };
            TapGestureRecognizer cerrarTAP = new TapGestureRecognizer();

            cerrarTAP.Tapped += async(sender, e) =>
            {
                bool accion = await DisplayAlert("", "¿Desea cancelar la recuperación?", "Cancelar", "Regresar");

                if (accion)
                {
                    await Navigation.PopPopupAsync();
                }
            };
            cerrar.GestureRecognizers.Add(cerrarTAP);


            var indicador = new ActivityIndicator
            {
                IsVisible         = true,
                IsRunning         = true,
                BindingContext    = this,
                Color             = Color.FromHex("2AB4EE"),
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            indicador.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy");


            envioCodigo = new StackLayout
            {
                Padding  = new Thickness(20, 5),
                Spacing  = 25,
                Children =
                {
                    new Label
                    {
                        Text = "RECUPERACIÓN DE CONTRASEÑA",
                        HorizontalTextAlignment = TextAlignment.Center,
                        TextColor       = Color.FromHex("3E1152"),
                        FontFamily      = Device.OnPlatform("Montserrat-Bold", "Montserrat-Bold", null),
                        FontSize        = 18,
                        VerticalOptions = LayoutOptions.Center
                    },
                    new StackLayout
                    {
                        Spacing  = 0,
                        Children =
                        {
                            new Label
                            {
                                Text       = "USUARIO: *",
                                FontSize   = 13,
                                TextColor  = Color.FromHex("3E1152"),
                                FontFamily = Device.OnPlatform("Montserrat-Bold", "Montserrat-Bold", null),
                            },
                            new StackLayout
                            {
                                Spacing  = 1,
                                Children =
                                {
                                    new Grid
                                    {
                                        Children =
                                        {
                                            Usuario,
                                        }
                                    },
                                    new BoxView {
                                        BackgroundColor = Color.FromHex("3E1152"), HeightRequest = 2
                                    },
                                    new BoxView {
                                        HeightRequest = 0
                                    }
                                }
                            }
                        }
                    },
                    indicador,
                    recuperar
                }
            };


            Padding = new Thickness(15, 0);;
            Content = new Frame
            {
                VerticalOptions   = LayoutOptions.Center,
                Padding           = 5,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                OutlineColor      = Color.White,
                HasShadow         = true,
                BackgroundColor   = Color.White,
                Content           = new StackLayout
                {
                    Padding  = 5,
                    Spacing  = 0,
                    Children =
                    {
                        cerrar,
                        new ScrollView
                        {
                            Padding           = 0,
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            VerticalOptions   = LayoutOptions.FillAndExpand,
                            Content           = new StackLayout
                            {
                                Children =
                                {
                                    envioCodigo
                                }
                            }
                        }
                    }
                }
            };
        }