/// <summary> /// Sets the color of the placeholder text. /// </summary> /// <param name="view">The view.</param> private void SetPlaceholderTextColor(ExtendedDatePicker view) { if (view.PlaceholderTextColor != Color.Default) { Control.SetHintTextColor(view.PlaceholderTextColor.ToAndroid()); } }
/// <summary> /// Set text based on nullable value /// </summary> /// <param name="view"></param> private void SetNullableText(ExtendedDatePicker view) { if (view.NullableDate == null) { Control.Text = string.Empty; } }
/// <summary> /// Sets the font. /// </summary> /// <param name="view">The view.</param> private void SetFont(ExtendedDatePicker view) { if (view.Font != Font.Default) { Control.TextSize = view.Font.ToScaledPixel(); //Control.Typeface = view.Font.ToExtendedTypeface(Context); } }
/// <summary> /// Sets the color of the placeholder text. /// </summary> /// <param name="view">The view.</param> private void SetPlaceholderTextColor(ExtendedDatePicker view) { if (!string.IsNullOrEmpty(view.Placeholder)) { var foregroundUIColor = view.PlaceholderTextColor.ToUIColor(SeventyPercentGrey); var backgroundUIColor = view.BackgroundColor.ToUIColor(); var targetFont = Control.Font; Control.AttributedPlaceholder = new NSAttributedString(view.Placeholder, targetFont, foregroundUIColor, backgroundUIColor); } }
public DateQuestionInputView(DateQuestion question, SurveyPageAppearance appearance) : base(appearance) { var picker = new ExtendedDatePicker (); picker.HorizontalOptions = LayoutOptions.StartAndExpand; picker.VerticalOptions = LayoutOptions.CenterAndExpand; picker.PlaceholderText = question.Text; picker.BindingContext = question; picker.SetBinding (ExtendedDatePicker.ValueProperty, new Binding ("Response", BindingMode.TwoWay)); Content = picker; }
private void SetFont(ExtendedDatePicker view) { UIFont uiFont; if (view.Font != Font.Default && (uiFont = view.Font.ToUIFont()) != null) { Control.Font = uiFont; } else if (view.Font == Font.Default) { Control.Font = UIFont.SystemFontOfSize(14f); } }
private void SetTextAlignment(ExtendedDatePicker view) { switch (view.XAlign) { case TextAlignment.Center: Control.TextAlignment = UITextAlignment.Center; break; case TextAlignment.End: Control.TextAlignment = UITextAlignment.Right; break; case TextAlignment.Start: Control.TextAlignment = UITextAlignment.Left; break; } }
/// <summary> /// Sets the text alignment. /// </summary> /// <param name="view">The view.</param> private void SetTextAlignment(ExtendedDatePicker view) { switch (view.XAlign) { case Xamarin.Forms.TextAlignment.Center: Control.Gravity = GravityFlags.CenterHorizontal; break; case Xamarin.Forms.TextAlignment.End: Control.Gravity = GravityFlags.End; break; case Xamarin.Forms.TextAlignment.Start: Control.Gravity = GravityFlags.Start; break; } }
private void SetFont(ExtendedDatePicker view) { UIFont uiFont = null; float fontSize = view.FontSize != 0 ? (float)view.FontSize : 17f; if (!string.IsNullOrEmpty(view.FontFamily)) { if (!UIFont.FamilyNames.Contains(view.FontFamily)) { uiFont = UIFont.FromName(view.FontFamily, fontSize); } } Control.Font = uiFont ?? UIFont.SystemFontOfSize(fontSize); //if (view.Font != Font.Default && (uiFont = view.Font.ToUIFont()) != null) // Control.Font = uiFont; //else if (view.Font == Font.Default) // Control.Font = UIFont.SystemFontOfSize(17f); }
private void SetBorder(ExtendedDatePicker view) { Control.BorderStyle = view.HasBorder ? UITextBorderStyle.RoundedRect : UITextBorderStyle.None; }
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; }
private void InitPage() { ContentLayout.Children.Add( new StackLayout { HorizontalOptions = LayoutOptions.Start, Children = { new Label() { Text = "Reading Date", Style = (Style)Resources["LabelText"] } } } ); datePicker = new ExtendedDatePicker { Format = "MM/dd/yyyy", HeightRequest = 45, CornerRadiusExtended = 0, BorderWidthExtended = 1, BorderColorExtended = Color.FromHex("#CCCCCC") }; ContentLayout.Children.Add(datePicker); if (_reading.ReadingType == "1000") { systolicEntry = new CustomFontEntry { PlaceHolderColorExtended = Color.FromHex("#CAC9CE"), Style = (Style)Resources["EntryStyle"], Placeholder = "Systolic" }; diastolicEntry = new CustomFontEntry { PlaceHolderColorExtended = Color.FromHex("#CAC9CE"), Style = (Style)Resources["EntryStyle"], Placeholder = "Diastolic" }; ContentLayout.Children.Add(systolicEntry); ContentLayout.Children.Add(diastolicEntry); } else { Grid grid = new Grid { RowSpacing = 0, ColumnSpacing = 0, RowDefinitions = { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } } }; valueEntry = new CustomFontEntry { PlaceHolderColorExtended = Color.FromHex("#CAC9CE"), Style = (Style)Resources["EntryStyle"], Placeholder = "Unit" }; var unitLabel = new Label { Text = _reading.Unit, VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.Start, }; var wrapperUnitLabel = new StackLayout { Padding = new Thickness(10, 0, 0, 0), Children = { unitLabel } }; grid.Children.Add(valueEntry, 0, 0); grid.Children.Add(wrapperUnitLabel, 1, 0); ContentLayout.Children.Add(grid); } noteEntry = new CustomFontEntry { PlaceHolderColorExtended = Color.FromHex("#CAC9CE"), Style = (Style)Resources["EntryStyle"], Placeholder = "Note" }; ContentLayout.Children.Add(noteEntry); var button = new CustomFontButton { BackgroundColorExtended = Color.FromHex("#37A600"), BorderColorExtended = Color.FromHex("#3EC951"), BorderWidthExtended = 1, CornerRadiusExtended = 7, FontSize = 16, Text = "Save", HeightRequest = 40, HorizontalOptions = LayoutOptions.FillAndExpand }; button.Clicked += ButtonOnClicked; ContentLayout.Children.Add(new StackLayout { Padding = new Thickness(0, 20, 0, 0), Children = { button } }); }
/// <summary> /// Set the placeholder /// </summary> /// <param name="view"></param> private void SetPlaceholder(ExtendedDatePicker view) { Control.Hint = view.Placeholder; }
public ReportesPage() { Title = "Reporte de eventos"; var opcionesToolBar = new ToolbarItem { Icon = "mas.png", Text = "Más" }; refrescar = new Button { Text = "Refrescar", BackgroundColor = Color.Transparent, WidthRequest = 130, HeightRequest = 40, FontFamily = Device.OnPlatform("OpenSans", "OpenSans-Regular", null) }; refrescar.Clicked += async(sender, e) => { /*var stack = Navigation.NavigationStack; * if (!VistaModelo.IsBusy && refrescar.IsEnabled && filtrar.IsEnabled && filtrarGesture.IsEnabled && isContextual && MenuContextual.IsVisible && !Constantes.ModalAbierto && (stack[stack.Count - 1].GetType() != typeof(Indicador)) && (stack[stack.Count - 1].GetType() != typeof(CajaDetalleModeloVista))) * { * refrescar.IsEnabled = false; * VistaModelo.IsBusy = true; * MenuContextual.IsVisible = false; * isContextual = false; * BusquedaActiva = false; * mostrar_MenuContextual(false); * BusquedaActiva = true; * await ActualizarCaja(); * VistaModelo.IsBusy = false; * refrescar.IsEnabled = true; * } * else * System.Diagnostics.Debug.WriteLine("Actualizacion activa.");*/ }; MenuContextual = new StackLayout { Padding = new Thickness(0, 0), Spacing = 0, BackgroundColor = Color.White, Children = { refrescar, } }; MenuContextual.IsVisible = false; opcionesToolBar.Clicked += OpcionesToolBar_Clicked; this.ToolbarItems.Add(opcionesToolBar); /*MessagingCenter.Subscribe<CajaDetalleModeloVista>(this, "deseleccionado", (sender) => * { * isSelected = false; * Constantes.ModalAbierto = false; * }); * MessagingCenter.Subscribe<CajaAgrupacionModeloVista>(this, "seleccionado", async (sender) => * { * var stack = Navigation.NavigationStack; * if (!VistaModelo.IsBusy && ContenidoCaja.IsEnabled && filtrar.IsEnabled && filtrarGesture.IsEnabled && refrescar.IsEnabled && !isSelected && (stack[stack.Count - 1].GetType() != typeof(Indicador)) && (stack[stack.Count - 1].GetType() != typeof(CajaDetalleModeloVista))) * { * ContenidoCaja.IsEnabled = false; * isSelected = true; * if (string.IsNullOrEmpty(sender.transaccionSeleccionada.Paciente.expediente)) * { * await Navigation.PushPopupAsync(new Indicador("Obteniendo datos", Color.White)); * SelectByID peticion = new SelectByID * { * PatientID = sender.transaccionSeleccionada.Patient_ID.ToString() * }; * await App.ManejadorDatos.SelectByIDAsync(peticion); * sender.transaccionSeleccionada.Patient_ID = sender.transaccionSeleccionada.Patient_ID; * await Navigation.PopAllPopupAsync(); * } * await Navigation.PushPopupAsync(new CajaDetalleModeloVista(sender.transaccionSeleccionada)); * ContenidoCaja.IsEnabled = true; * } * else * System.Diagnostics.Debug.WriteLine("Modal abierto actualmente"); * });*/ notificacionCajaVacia = new Label { FontFamily = Device.OnPlatform("OpenSans", "OpenSans-Regular", null), FontSize = 11, HorizontalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.Center, TextColor = Color.FromHex("3F3F3F"), Text = "NO SE HA ENCONTRADO CONTENIDO PARA MOSTRAR", IsVisible = false }; notificacionFiltrado = new Label { FontFamily = Device.OnPlatform("OpenSans", "OpenSans-Regular", null), FontSize = 11, HorizontalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.Center, TextColor = Color.FromHex("B2B2B2"), Text = "FILTRANDO POR PACIENTE", IsVisible = false }; if (Device.OS == TargetPlatform.Android) { notificacionFiltrado.IsVisible = true; } BusquedaRapida = new ExtendedEntry { Placeholder = "Filtrar por evento", HasBorder = false, BackgroundColor = Color.Transparent, Margin = new Thickness(10, 0), PlaceholderColor = Color.FromHex("808080"), FontSize = 14, TextColor = Color.FromHex("3F3F3F"), FontFamily = Device.OnPlatform("OpenSans", "OpenSans-Regular", null) }; BusquedaRapida.TextChanged += BusquedaRapida_TextChanged; Grid PacientesHeader = new Grid { Padding = new Thickness(10, 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) }, } }; IconView cancelar = new IconView { Foreground = Color.FromHex("F7B819"), Source = "iCancelarA.png", HeightRequest = 25, WidthRequest = 25, }; TapGestureRecognizer cancelarTAP = new TapGestureRecognizer(); cancelarTAP.Tapped += async(sender, e) => { cancelar.Source = "iCancelarB.png"; BusquedaRapida.Text = ""; await Task.Delay(500); cancelar.Source = "iCancelarA"; }; cancelar.GestureRecognizers.Add(cancelarTAP); Image buscar = new Image { Source = "iBusqueda.png", HeightRequest = 25, WidthRequest = 25, }; TapGestureRecognizer buscarTAP = new TapGestureRecognizer(); buscarTAP.Tapped += async(sender, e) => { await FiltrarTransacciones(); }; buscar.GestureRecognizers.Add(buscarTAP); filtrar = new IconView { Foreground = Color.White, Source = "iContinuar.png", HeightRequest = 25, WidthRequest = 25, }; filtrarGesture = new StackLayout { BackgroundColor = Color.Transparent, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; TapGestureRecognizer filtrarTAP = new TapGestureRecognizer(); filtrarTAP.Tapped += async(sender, e) => { /*var stack = Navigation.NavigationStack; * if (!VistaModelo.IsBusy && filtrar.IsEnabled && filtrarGesture.IsEnabled && refrescar.IsEnabled && !Constantes.ModalAbierto && (stack[stack.Count - 1].GetType() != typeof(Indicador)) && (stack[stack.Count - 1].GetType() != typeof(CajaDetalleModeloVista))) * { * filtrar.IsEnabled = false; * filtrarGesture.IsEnabled = false; * VistaModelo.IsBusy = true; * await ActualizarCaja(); * VistaModelo.IsBusy = false; * filtrar.IsEnabled = true; * filtrarGesture.IsEnabled = true; * } * else * System.Diagnostics.Debug.WriteLine("Actualizando o modal abierto actualmente");*/ }; filtrar.GestureRecognizers.Add(filtrarTAP); filtrarGesture.GestureRecognizers.Add(filtrarTAP); 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); Grid Header = new Grid { Padding = 0, HeightRequest = 120, VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, RowDefinitions = { new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } } }; Header.Children.Add( new Image() { Source = "headerReportes.png", Aspect = Aspect.AspectFill }); Grid Filtrado = new Grid { ColumnSpacing = 5, RowSpacing = 0, HorizontalOptions = LayoutOptions.Center, 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.Auto) }, new ColumnDefinition { Width = new GridLength(15, GridUnitType.Absolute) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) } } }; globalizacion = new System.Globalization.CultureInfo("es-GT"); fechaInicial = new ExtendedDatePicker { HasBorder = false, TextColor = Color.White, MaximumDate = DateTime.Now, Format = globalizacion.DateTimeFormat.ShortDatePattern, XAlign = TextAlignment.Center, Font = Device.OnPlatform <Font>(Font.OfSize("OpenSans-Bold", 14), Font.OfSize("OpenSans-Bold", 14), Font.Default) }; fechaFinal = new ExtendedDatePicker { HasBorder = false, TextColor = Color.White, MaximumDate = DateTime.Now, Format = globalizacion.DateTimeFormat.ShortDatePattern, XAlign = TextAlignment.Center, Font = Device.OnPlatform <Font>(Font.OfSize("OpenSans-Bold", 14), Font.OfSize("OpenSans-Bold", 14), Font.Default) }; fechaInicial.Focused += (sender, e) => { if (fechaFinal.IsFocused) { fechaInicial.Unfocus(); return; } fechaInicial.TextColor = Color.FromHex("00ffff"); }; fechaFinal.Focused += (sender, e) => { if (fechaInicial.IsFocused) { fechaFinal.Unfocus(); return; } fechaFinal.TextColor = Color.FromHex("00ffff"); }; fechaInicial.Unfocused += (sender, e) => { fechaInicial.TextColor = Color.White; }; fechaFinal.Unfocused += (sender, e) => { fechaFinal.TextColor = Color.White; }; fechaInicial.PropertyChanged += (sender, e) => { if (e.PropertyName == DatePicker.DateProperty.PropertyName) { if (fechaInicial.Date.Date > fechaFinal.Date.Date) { fechaFinal.Date = fechaInicial.Date; } } }; fechaFinal.PropertyChanged += async(sender, e) => { if (e.PropertyName == DatePicker.DateProperty.PropertyName) { if (fechaInicial.Date.Date > fechaFinal.Date.Date) { await DisplayAlert("¡Advertencia!", "La fecha final de filtrado debe ser mayor a la inicial.", "Aceptar"); fechaFinal.Date = fechaInicial.Date; return; } } }; Filtrado.Children.Add(fechaInicial, 0, 0); Filtrado.Children.Add( new Label { TextColor = Color.White, FontSize = 12, HorizontalOptions = LayoutOptions.Center, HorizontalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.CenterAndExpand, VerticalTextAlignment = TextAlignment.Center, Opacity = 0.90, FontFamily = Device.OnPlatform("OpenSans", "OpenSans-Regular", null), Text = "a" }, 1, 0); Filtrado.Children.Add(fechaFinal, 2, 0); Filtrado.Children.Add(new BoxView { BackgroundColor = Color.White, Opacity = 0.80, HeightRequest = 0.5 }, 0, 1); Filtrado.Children.Add(new BoxView { BackgroundColor = Color.White, Opacity = 0.80, HeightRequest = 0.5 }, 2, 1); Header.Children.Add( new StackLayout { HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, Spacing = 0, Children = { new Label { TextColor = Color.White, FontSize = 12, HorizontalOptions = LayoutOptions.Center, HorizontalTextAlignment = TextAlignment.Center, Opacity = 0.80, FontFamily = Device.OnPlatform("OpenSans", "OpenSans-Regular", null), Text = "MOSTRANDO DE" }, Filtrado } }); HeaderPacientes = new StackLayout { Padding = new Thickness(0, 0, 0, 5), HorizontalOptions = LayoutOptions.FillAndExpand, Spacing = 10, Children = { Header, PacientesHeader, notificacionFiltrado } }; Modal = new Grid(); ModalBackground = new Grid { BackgroundColor = Color.Black, Padding = new Thickness(0, 0, 0, 0), WidthRequest = 200, HeightRequest = 200, }; Modal.Children.Add(ModalBackground); var GestoModal = new TapGestureRecognizer(); GestoModal.Tapped += (s, e) => { if (BusquedaActiva) { BusquedaRapida.Text = ""; } OcultarModal(); }; Modal.GestureRecognizers.Add(GestoModal); ModalBackground.GestureRecognizers.Add(GestoModal); ContenidoCaja = new ScrollView { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; refreshView = new PullToRefreshLayout() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, RefreshColor = Color.Accent, Content = ContenidoCaja }; refreshView.RefreshCommand = RefreshCommand;; //refreshView.SetBinding<CajaModeloVista>(PullToRefreshLayout.IsRefreshingProperty, vm => vm.IsBusy, BindingMode.OneWay); Contenido = new RelativeLayout(); Contenido.Children.Add(HeaderPacientes, xConstraint: Constraint.Constant(0), yConstraint: Constraint.Constant(0), widthConstraint: Constraint.RelativeToParent(parent => parent.Width)); Contenido.Children.Add(MenuContextual, xConstraint: Constraint.Constant(0), yConstraint: Constraint.Constant(0)); Contenido.Children.Add( filtrarGesture, Constraint.RelativeToView(HeaderPacientes, (parent, view) => { return((view.Width / 5) * 3.95); }), Constraint.Constant(20), Constraint.RelativeToView(HeaderPacientes, (parent, view) => { return((view.Width / 5) * 2); }), Constraint.Constant(80) ); Contenido.Children.Add( filtrar, Constraint.RelativeToView(HeaderPacientes, (parent, view) => { return((view.Width / 6.2) * 5); }), Constraint.Constant((120 / 2.2)) ); Contenido.Children.Add(notificacionCajaVacia, xConstraint: Constraint.Constant(0), yConstraint: Constraint.RelativeToView(HeaderPacientes, (parent, view) => { return(view.Y + view.Height); }), widthConstraint: Constraint.RelativeToParent(parent => parent.Width), heightConstraint: Constraint.RelativeToView(HeaderPacientes, (parent, view) => { return(parent.Height - view.Height); }) ); Content = Contenido; PacientesVistaVisible = false; CajaVistaPresentado = true; }