public Forget() { Usuario = new ExtendedEntry() { Keyboard = Keyboard.Email, TextColor = Color.FromHex("3F3F3F"), HasBorder = false, IsPassword = false, Placeholder = "Toca para ingresar", PlaceholderColor = Color.FromHex("B2B2B2"), XAlign = TextAlignment.End, FontFamily = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null), FontSize = 14, Margin = new Thickness(0, 0, 35, 0) }; codigo = new ExtendedEntry { Keyboard = Keyboard.Numeric, TextColor = Color.FromHex("3F3F3F"), HasBorder = false, IsPassword = false, Placeholder = "Toca para ingresar", PlaceholderColor = Color.FromHex("B2B2B2"), XAlign = TextAlignment.End, FontFamily = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null), FontSize = 14, Margin = new Thickness(0, 0, 35, 0) }; codigo.TextChanged += (sender, e) => { if (!codigo.Text.Equals(PwdReset_ID)) { codigo.TextColor = Color.FromHex("E9242A"); } else { codigo.TextColor = Color.FromHex("53A946"); } }; IconView emailView = new IconView { HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center, Source = "email.png", Foreground = Color.FromHex("B2B2B2"), WidthRequest = 20 }; IconView codigoView = new IconView { HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center, Source = "iSeguridad.png", Foreground = Color.FromHex("B2B2B2"), WidthRequest = 15 }; IconView contraseniaView = new IconView { HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center, Source = "iPassView.png", Foreground = Color.FromHex("B2B2B2"), WidthRequest = 25 }; IconView contraseniaConfirmacionView = new IconView { HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center, Source = "iPassView.png", Foreground = Color.FromHex("B2B2B2"), WidthRequest = 25 }; TapGestureRecognizer contraseniaViewTAP = new TapGestureRecognizer(); TapGestureRecognizer contraseniaConfirmacionViewTAP = new TapGestureRecognizer(); contraseniaViewTAP.Tapped += (sender, e) => { if (contrasenia.IsPassword) { contrasenia.IsPassword = false; contraseniaView.Foreground = Color.FromHex("312851"); } else { contrasenia.IsPassword = true; contraseniaView.Foreground = Color.FromHex("B2B2B2"); } }; contraseniaConfirmacionViewTAP.Tapped += (sender, e) => { if (confirmacionContrasenia.IsPassword) { confirmacionContrasenia.IsPassword = false; contraseniaConfirmacionView.Foreground = Color.FromHex("312851"); } else { confirmacionContrasenia.IsPassword = true; contraseniaConfirmacionView.Foreground = Color.FromHex("B2B2B2"); } }; contraseniaView.GestureRecognizers.Add(contraseniaViewTAP); contraseniaConfirmacionView.GestureRecognizers.Add(contraseniaConfirmacionViewTAP); recuperar = new Button { Text = "RECUPERAR", FontSize = 18, TextColor = Color.White, FontAttributes = FontAttributes.Bold, FontFamily = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null), VerticalOptions = LayoutOptions.Start, BackgroundColor = Color.FromHex("F7B819"), WidthRequest = 128, HeightRequest = 38, }; recuperar.Clicked += Recuperar_Clicked; continuar = new Button { Text = "VALIDAR", FontSize = 18, TextColor = Color.White, FontAttributes = FontAttributes.Bold, FontFamily = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null), VerticalOptions = LayoutOptions.Start, BackgroundColor = Color.FromHex("F7B819"), WidthRequest = 128, HeightRequest = 38, }; continuar.Clicked += Continuar_Clicked; cambiar = new Button { Text = "CONFIRMAR", FontSize = 18, TextColor = Color.White, FontAttributes = FontAttributes.Bold, FontFamily = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null), VerticalOptions = LayoutOptions.Start, BackgroundColor = Color.FromHex("F7B819"), WidthRequest = 138, HeightRequest = 38, }; cambiar.Clicked += Cambiar_Clicked; gridBotonRecuperar = new RelativeLayout { WidthRequest = 130, HeightRequest = 42, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.End, }; gridBotonRecuperar.Children.Add( new RoundedBoxView.Forms.Plugin.Abstractions.RoundedBoxView { BackgroundColor = Color.FromHex("B2B2B2"), CornerRadius = 6, HeightRequest = 40, WidthRequest = 128, }, Constraint.Constant(2), Constraint.Constant(2)); gridBotonRecuperar.Children.Add(recuperar, Constraint.Constant(0), Constraint.Constant(0)); RelativeLayout gridBotonValidar = new RelativeLayout { WidthRequest = 130, HeightRequest = 42, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.End, }; gridBotonValidar.Children.Add( new RoundedBoxView.Forms.Plugin.Abstractions.RoundedBoxView { BackgroundColor = Color.FromHex("B2B2B2"), CornerRadius = 6, HeightRequest = 40, WidthRequest = 128, }, Constraint.Constant(2), Constraint.Constant(2)); gridBotonValidar.Children.Add(continuar, Constraint.Constant(0), Constraint.Constant(0)); RelativeLayout gridBoton = new RelativeLayout { WidthRequest = 140, HeightRequest = 42, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.End, }; gridBoton.Children.Add( new RoundedBoxView.Forms.Plugin.Abstractions.RoundedBoxView { BackgroundColor = Color.FromHex("B2B2B2"), CornerRadius = 6, HeightRequest = 40, WidthRequest = 138, }, Constraint.Constant(2), Constraint.Constant(2)); gridBoton.Children.Add(cambiar, Constraint.Constant(0), Constraint.Constant(0)); IconView cerrar = new IconView { //Margin = new Thickness(0, 0, 10, 0), HorizontalOptions = LayoutOptions.End, Source = Images.Cancelar, 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 = "Ingresa\r\ntu correo electrónico", HorizontalTextAlignment = TextAlignment.Center, TextColor = Color.FromHex("373152"), FontFamily = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null), FontSize = 18, VerticalOptions = LayoutOptions.Center }, new StackLayout { Spacing = 0, Children = { new Label { Text = "CORREO ELECTRÓNICO: *", FontSize = 13, TextColor = Color.FromHex("373152"), FontAttributes = FontAttributes.Bold, FontFamily = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null) }, new StackLayout { Spacing = 1, Children = { new Grid { Children = { Usuario, emailView } }, new BoxView { BackgroundColor = Color.FromHex("373152"), HeightRequest = 2 }, new BoxView { HeightRequest = 0 } } } } }, indicador, gridBotonRecuperar } }; confirmacionCodigo = new StackLayout { IsVisible = false, Padding = new Thickness(20, 5), Spacing = 25, Children = { new Label { Text = "Ingresa el código \r\nque has recibido \r\nen tu badeja de entrada", HorizontalTextAlignment = TextAlignment.Center, TextColor = Color.FromHex("312851"), FontFamily = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null), FontSize = 18, VerticalOptions = LayoutOptions.Center }, new StackLayout { Spacing = 0, Children = { new Label { Text = "CÓDIGO DE SEGURIDAD: *", FontSize = 13, TextColor = Color.FromHex("312851"), FontAttributes = FontAttributes.Bold, FontFamily = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null) }, new StackLayout { Spacing = 1, Children = { new Grid { Children = { codigo, codigoView } }, new BoxView { BackgroundColor = Color.FromHex("312851"), HeightRequest = 2 }, new BoxView { HeightRequest = 0 } } } } }, gridBotonValidar } }; contrasenia = new ExtendedEntry { TextColor = Color.FromHex("3F3F3F"), HasBorder = false, IsPassword = false, Placeholder = "Toca para ingresar", PlaceholderColor = Color.FromHex("B2B2B2"), XAlign = TextAlignment.End, FontFamily = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null), FontSize = 14, Margin = new Thickness(0, 0, 35, 0) }; confirmacionContrasenia = new ExtendedEntry { TextColor = Color.FromHex("3F3F3F"), HasBorder = false, IsPassword = false, Placeholder = "Toca para confirmar contraseña", PlaceholderColor = Color.FromHex("B2B2B2"), XAlign = TextAlignment.End, FontFamily = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null), FontSize = 14, Margin = new Thickness(0, 0, 35, 0) }; confirmacionContrasenia.TextChanged += (sender, e) => { if (!confirmacionContrasenia.Text.Equals(contrasenia.Text)) { confirmacionContrasenia.TextColor = Color.FromHex("E9242A"); contrasenia.TextColor = Color.FromHex("3F3F3F"); } else { contrasenia.TextColor = Color.FromHex("53A946"); confirmacionContrasenia.TextColor = Color.FromHex("53A946"); } }; cambioContrasenia = new StackLayout { IsVisible = false, Padding = new Thickness(20, 5), Spacing = 25, Children = { new StackLayout { HorizontalOptions = LayoutOptions.CenterAndExpand, Children = { new IconView { Source = "iSeguridad.png", WidthRequest = 15, HeightRequest = 15, Foreground = Color.FromHex("312851"), VerticalOptions = LayoutOptions.Center }, new Label { Text = "Ingresa y confirma\r\ntu nueva contraseña", HorizontalTextAlignment = TextAlignment.Center, TextColor = Color.FromHex("312851"), FontFamily = Device.OnPlatform("OpenSans-ExtraBold", "OpenSans-ExtraBold", null), FontSize = 18, VerticalOptions = LayoutOptions.Center } } }, new StackLayout { Spacing = 0, Children = { new Label { Text = "NUEVA CONTRASEÑA:*", FontSize = 13, TextColor = Color.FromHex("312851"), FontAttributes = FontAttributes.Bold, FontFamily = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null) }, new StackLayout { Spacing = 1, Children = { new Grid { Children = { contrasenia, contraseniaView } }, new BoxView { BackgroundColor = Color.FromHex("312851"), HeightRequest = 2 }, new BoxView { HeightRequest = 0 } } } } }, new StackLayout { Spacing = 0, Children = { new Label { Text = "CONFIRMAR CONTRASEÑA:*", FontSize = 13, TextColor = Color.FromHex("312851"), FontAttributes = FontAttributes.Bold, FontFamily = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null) }, new StackLayout { Spacing = 1, Children = { new Grid { Children = { confirmacionContrasenia, contraseniaConfirmacionView } }, new BoxView { BackgroundColor = Color.FromHex("312851"), HeightRequest = 2 }, new BoxView { HeightRequest = 0 } } } } }, gridBoton } }; 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, confirmacionCodigo, cambioContrasenia } } } } } }; contrasenia.IsPassword = true; confirmacionContrasenia.IsPassword = true; }
public HoraView(DateTime hora, List <eventos> evento) { StackLayout contenido = new StackLayout() { Spacing = 0, Padding = 0 }; TapGestureRecognizer doubletap = new TapGestureRecognizer(); doubletap.NumberOfTapsRequired = 2; doubletap.Tapped += (sender, e) => { var stack = Navigation.NavigationStack; if (this.IsEnabled && !Constants.PantallaAbierta && (stack[stack.Count - 1].GetType() != typeof(Indicador)) /*&& (stack[stack.Count - 1].GetType() != typeof(PacienteNuevo_EdicionVista))*/ && (stack[stack.Count - 1].GetType() != typeof(EventoPage))) { this.IsEnabled = false; Constants.PantallaAbierta = true; Constants.AccionesEvento.Clear(); Constants.AplicacionesEvento.Clear(); Constants.AsistentesEvento.Clear(); Constants.DatosEvento = new RegistrarEvento(); Navigation.PushAsync(new EventoPage(hora, new eventos())); this.IsEnabled = true; } }; bool segundo = false; foreach (var Evento in evento) { if ((Evento.Fecha.Date.Equals(hora.Date)) && (Evento.horaInicioCita.StartsWith(hora.ToString(@"hh"))) && (Evento.horaTiempoCita.StartsWith(hora.ToString(@"tt", new System.Globalization.CultureInfo("es-GT")).ToLower()))) { if (!segundo) { contenido.Children.Add(new EventoDTViewModel(Evento)); segundo = true; } else { contenido.Children.Add(new StackLayout { HeightRequest = 1, Padding = new Thickness(3, 0), Children = { new BoxView { VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.FromHex("B3B3B3"), HeightRequest = 1 } } }); contenido.Children.Add(new EventoDTViewModel(Evento)); } } } if (contenido.Children.Count == 0) { contenido.Children.Add(new Label { FontSize = 12, HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, TextColor = Color.FromHex("B3B3B3"), FontAttributes = FontAttributes.Bold, Text = "DOBLE TAP PARA AGREGAR EVENTO", FontFamily = Device.OnPlatform("OpenSans", "OpenSans-Regular", null) }); contenido.HeightRequest = 60; contenido.GestureRecognizers.Add(doubletap); } Label lHora1 = new Label { VerticalOptions = LayoutOptions.Center, TextColor = Color.FromHex("432161"), FontSize = 15, Text = hora.ToString(@"hh"), HorizontalTextAlignment = TextAlignment.Center, FontFamily = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null) }; Label lHora2 = new Label { VerticalOptions = LayoutOptions.End, TextColor = Color.FromHex("432161"), FontSize = 10, Text = hora.ToString(@"tt", new System.Globalization.CultureInfo("en-US")).ToUpper(), HorizontalTextAlignment = TextAlignment.Center, FontFamily = Device.OnPlatform("OpenSans", "OpenSans-Regular", null) }; if (hora.Hour == DateTime.Now.Hour) { lHora1.TextColor = Color.FromHex("53A946"); lHora2.TextColor = Color.FromHex("53A946"); } Grid grid = new Grid { BackgroundColor = Color.FromHex("E2E3E3"), RowSpacing = 0, ColumnSpacing = 0, RowDefinitions = { new RowDefinition { Height = new GridLength(60, GridUnitType.Auto) }, }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, } }; grid.Children.Add( new StackLayout { HeightRequest = 60, WidthRequest = 50, Padding = 0, Spacing = 0, Children = { new StackLayout { VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, Orientation = StackOrientation.Horizontal, Padding = 0, Spacing = 1, Children = { lHora1, lHora2 } } } } , 0, 0); grid.Children.Add( new StackLayout { Spacing = 0, Padding = new Thickness(0, 5), Orientation = StackOrientation.Horizontal, Children = { new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand, Children = { new BoxView { VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.FromHex("432161"), WidthRequest = 2 }, } }, new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, Spacing = 0, Children = { contenido } } } }, 1, 0); this.Padding = new Thickness(0, 0, 0, 5); this.BackgroundColor = Color.Transparent; RoundedBoxView.Forms.Plugin.Abstractions.RoundedBoxView casilla = new RoundedBoxView.Forms.Plugin.Abstractions.RoundedBoxView { BackgroundColor = Color.FromHex("919BB3"), HeightRequest = 10, WidthRequest = 100, BorderColor = Color.Blue, CornerRadius = 10 }; RoundedBoxView.Forms.Plugin.Abstractions.RoundedBoxView sombra = new RoundedBoxView.Forms.Plugin.Abstractions.RoundedBoxView { BackgroundColor = Color.FromHex("919BB3"), Opacity = 0.5, HeightRequest = 10, WidthRequest = 100, BorderColor = Color.Blue, CornerRadius = 10 }; Contenido = new RelativeLayout(); Contenido.Children.Add(sombra, xConstraint: Constraint.Constant(2), yConstraint: Constraint.Constant(2), widthConstraint: Constraint.RelativeToParent(parent => parent.Width), heightConstraint: Constraint.RelativeToParent(parent => parent.Height) ); Contenido.Children.Add(casilla, xConstraint: Constraint.Constant(0), yConstraint: Constraint.Constant(0), widthConstraint: Constraint.RelativeToParent(parent => (parent.Width - 2)), heightConstraint: Constraint.RelativeToParent(parent => (parent.Height - 2)) ); Contenido.Children.Add(grid, xConstraint: Constraint.Constant(0), yConstraint: Constraint.Constant(0), widthConstraint: Constraint.RelativeToParent(parent => parent.Width) ); Content = new StackLayout { Spacing = 0, Padding = 0, Children = { grid, new BoxView { VerticalOptions = LayoutOptions.FillAndExpand,BackgroundColor = Color.FromHex("B3B3B3"), HeightRequest = 4 } } }; }
private void initializeMilestones() { //TODO: Have the Initialize Components View show up. this.BindingContext = viewModel; this.BackgroundColor = Color.Black; RelativeLayout view = new RelativeLayout(); //Initialize card stack and add in listener functions. cardStack = new CardStackView(); cardStack.SetBinding(CardStackView.ItemsSourceProperty, "ItemsList"); cardStack.SwipedLeft += SwipedLeft; cardStack.SwipedRight += SwipedRight; //Dislike_button is our no button. var dislike_but = new ImageButton() { HeightRequest = 90, WidthRequest = 200, ImageHeightRequest = 90, ImageWidthRequest = 200, BackgroundColor = Color.Transparent, Orientation = ImageOrientation.ImageToLeft, Source = ImageSource.FromFile("no_blue_big.png") }; //Like button is our yes button var like_but = new ImageButton() { HeightRequest = 90, WidthRequest = 200, ImageHeightRequest = 90, ImageWidthRequest = 200, BackgroundColor = Color.Transparent, Orientation = ImageOrientation.ImageToRight, Source = ImageSource.FromFile("yes_blue_big.png") }; // Click Events. When Like and dislike is handled. dislike_but.Clicked += Dislike_but_Clicked; like_but.Clicked += Like_but_Clicked; // Add card stack to view model view.Children.Add(cardStack, Constraint.Constant(30), Constraint.Constant(60), Constraint.RelativeToParent((parent) => { return(parent.Width - 60); }), Constraint.RelativeToParent((parent) => { return(parent.Height - 140); })); // Add dislike buttons to viewmodel view.Children.Add(dislike_but, Constraint.RelativeToParent((parent) => { return(parent.Width - parent.Width + 45); }), Constraint.RelativeToParent((parent) => { return(parent.Height - 80); }), //Constraint.RelativeToParent((parent) => { return parent.Height - 80; }), //MIDDLE Constraint.Constant(135), Constraint.Constant(50)); // Add like buttons to viewmodel view.Children.Add(like_but, Constraint.RelativeToParent((parent) => { return(parent.Width - 175); }), Constraint.RelativeToParent((parent) => { return(parent.Height - 80); }), //Constraint.RelativeToParent((parent) => { return parent.Height - 80; }), //MIDDLE Constraint.Constant(135), Constraint.Constant(50)); this.LayoutChanged += (object sender, EventArgs e) => { cardStack.CardMoveDistance = (int)(this.Width / 3); }; try { this.Content = view; } catch (Exception e) { // Do nothing. TODO: Figure out if this is critically wrong. } }
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; }
public LoginPage() { BindingContext = loginViewModel = new LoginViewModel(this); var activityIndicator = new ActivityIndicator { Color = Color.FromHex("#8BC34A"), }; activityIndicator.SetBinding(IsVisibleProperty, "IsBusy"); activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy"); // BackgroundColor = Color.Blue; BackgroundImage = "LoginScreen.png"; var layout = new StackLayout { Padding = 20 }; layout.Children.Add(activityIndicator); var label = new Label { FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), TextColor = Color.White, VerticalOptions = LayoutOptions.CenterAndExpand, XAlign = TextAlignment.Center, YAlign = TextAlignment.Center, }; var backgroundImage = new Image() { Aspect = Aspect.Fill, Source = FileImageSource.FromFile("LoginScreen.png") }; layout.Children.Add(label); var username = new Entry { Placeholder = "UserName", TextColor = Color.Gray }; username.SetBinding(Entry.TextProperty, LoginViewModel.UsernamePropertyName); layout.Children.Add(username); var password = new Entry { Placeholder = "Password", IsPassword = true, TextColor = Color.Gray }; password.SetBinding(Entry.TextProperty, LoginViewModel.PasswordPropertyName); layout.Children.Add(password); var relativelayout = new RelativeLayout(); var button = new Button { Text = "Log In", TextColor = Color.White, BackgroundColor = Color.FromHex("#8BC34A") }; button.SetBinding(Button.CommandProperty, LoginViewModel.LoginCommandPropertyName); layout.Children.Add(button); relativelayout.Children.Add(backgroundImage, Constraint.Constant(0), Constraint.Constant(0), Constraint.RelativeToParent((parent) => { return(parent.Width); }), Constraint.RelativeToParent((parent) => { return(parent.Height); })); relativelayout.Children.Add(layout, Constraint.Constant(0), Constraint.Constant(0), Constraint.RelativeToParent((parent) => { return(parent.Width); }), Constraint.RelativeToParent((parent) => { return(parent.Height); })); ////button.Clicked += (sender, e) => { //// if (String.IsNullOrEmpty(username.Text) || String.IsNullOrEmpty(password.Text)) //// { //// DisplayAlert("Validation Error", "Username and Password are required", "Re-try"); //// } else { //// // REMEMBER LOGIN STATUS! //// App.Current.Properties["IsLoggedIn"] = true; //// //ilm.ShowRootPage(); //// } ////}; Content = new ScrollView { Content = relativelayout }; }
public LoginPage() { BackgroundColor = Color.FromHex("#3498db"); Padding = GetPagePadding(); _logo = new Image { Source = "xamarin_logo" }; _logoSlogan = new StyledLabel { Opacity = 0, Text = "Delighting Developers." }; _usernameEntry = new StyledEntry { Placeholder = "Username" }; _usernameEntry.SetBinding(Entry.TextProperty, nameof(ViewModel.UsernameEntryText)); CustomReturnEffect.SetReturnType(_usernameEntry, ReturnType.Next); CustomReturnEffect.SetReturnCommand(_usernameEntry, new Command(() => _passwordEntry.Focus())); _passwordEntry = new StyledEntry { Placeholder = "Password", IsPassword = true, }; _passwordEntry.SetBinding(Entry.TextProperty, nameof(ViewModel.PasswordEntryText)); _passwordEntry.SetBinding(CustomReturnEffect.ReturnCommandProperty, nameof(ViewModel.LoginButtonTappedCommand)); CustomReturnEffect.SetReturnType(_passwordEntry, ReturnType.Done); _loginButton = new StyledButton(Borders.Thin) { Text = "Login" }; _loginButton.SetBinding(IsEnabledProperty, nameof(ViewModel.IsInternetConnectionInactive)); _loginButton.SetBinding(Button.CommandProperty, nameof(ViewModel.LoginButtonTappedCommand)); _newUserSignUpButton = new StyledButton(Borders.None) { Text = "Sign-up" }; _newUserSignUpButton.SetBinding(IsEnabledProperty, nameof(ViewModel.IsInternetConnectionInactive)); var activityIndicator = new ActivityIndicator { Color = Color.White }; activityIndicator.SetBinding(IsVisibleProperty, nameof(ViewModel.IsInternetConnectionActive)); activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, nameof(ViewModel.IsInternetConnectionActive)); Func <RelativeLayout, double> getNewUserButtonWidth = (p) => _newUserSignUpButton.Measure(p.Width, p.Height).Request.Width; Func <RelativeLayout, double> getLogoSloganWidth = (p) => _logoSlogan.Measure(p.Width, p.Height).Request.Width; Func <RelativeLayout, double> getActivityIndicatorHeight = (p) => activityIndicator.Measure(p.Width, p.Height).Request.Height; Func <RelativeLayout, double> getActivityIndicatorWidth = (p) => activityIndicator.Measure(p.Width, p.Height).Request.Width; _relativeLayout = new RelativeLayout(); _relativeLayout.Children.Add( _logo, xConstraint: Constraint.Constant(100), yConstraint: Constraint.Constant(250), widthConstraint: Constraint.RelativeToParent(p => p.Width - 200) ); _relativeLayout.Children.Add( _logoSlogan, xConstraint: Constraint.RelativeToParent(p => (p.Width / 2) - (getLogoSloganWidth(p) / 2)), yConstraint: Constraint.Constant(125) ); _relativeLayout.Children.Add( _usernameEntry, xConstraint: Constraint.Constant(40), yConstraint: Constraint.RelativeToView(_logoSlogan, (p, v) => v.Y + v.Height + _relativeLayoutPadding), widthConstraint: Constraint.RelativeToParent(p => p.Width - 80) ); _relativeLayout.Children.Add( _passwordEntry, xConstraint: Constraint.Constant(40), yConstraint: Constraint.RelativeToView(_usernameEntry, (p, v) => v.Y + v.Height + _relativeLayoutPadding), widthConstraint: Constraint.RelativeToParent(p => p.Width - 80) ); _relativeLayout.Children.Add( _loginButton, xConstraint: Constraint.Constant(40), yConstraint: Constraint.RelativeToView(_passwordEntry, (p, v) => v.Y + v.Height + _relativeLayoutPadding), widthConstraint: Constraint.RelativeToParent(p => p.Width - 80) ); _relativeLayout.Children.Add( _newUserSignUpButton, xConstraint: Constraint.RelativeToParent(p => (p.Width / 2) - (getNewUserButtonWidth(p) / 2)), yConstraint: Constraint.RelativeToView(_loginButton, (p, v) => v.Y + _loginButton.Height + 15) ); _relativeLayout.Children.Add(activityIndicator, xConstraint: Constraint.RelativeToParent(parent => parent.Width / 2 - getActivityIndicatorWidth(parent) / 2), yConstraint: Constraint.RelativeToParent(parent => parent.Height / 2 - getActivityIndicatorHeight(parent) / 2)); Content = new ScrollView { Content = _relativeLayout }; }
public TodoListPage() { Title = "Todo"; NavigationPage.SetHasNavigationBar(this, true); listView = new ListView(); listView.ItemTemplate = new DataTemplate(typeof(TodoItemCell)); // listView.ItemSource = new string [] { "Buy pears", "Buy oranges", "Buy mangos", "Buy apples", "Buy bananas" }; // listView.ItemSource = new TodoItem [] { // new TodoItem {Name = "Buy pears`"}, // new TodoItem {Name = "Buy oranges`", Done=true}, // new TodoItem {Name = "Buy mangos`"}, // new TodoItem {Name = "Buy apples`", Done=true}, // new TodoItem {Name = "Buy bananas`", Done=true} // }; listView.ItemSelected += (sender, e) => { if (e.SelectedItem == null) { return; // ensures we ignore this handler when the selection is just being cleared } var todoItem = (TodoItem)e.SelectedItem; var todoPage = new TodoItemPage(); todoPage.BindingContext = todoItem; Navigation.PushAsync(todoPage); ((ListView)sender).SelectedItem = null; // clears the 'selected' background }; // make floating (+) image at bottom of screen var tap = new TapGestureRecognizer(async(View obj) => { var todoItem = new TodoItem(); var todoPage = new TodoItemPage(); todoPage.BindingContext = todoItem; var b = newImage.Bounds; b.Y = b.Y - 50; await newImage.LayoutTo(b, 250, Easing.SinIn); b.Y = b.Y + 50; await newImage.LayoutTo(b, 250, Easing.SinOut); Navigation.PushAsync(todoPage); }); newImage = new Image { Source = "newitem.png", WidthRequest = 40, Opacity = 0.8f }; newImage.GestureRecognizers.Add(tap); layout = new RelativeLayout(); layout.Children.Add(listView, xConstraint: Constraint.Constant(0), yConstraint: Constraint.Constant(0), widthConstraint: Constraint.RelativeToParent((parent) => { return(parent.Width); }), heightConstraint: Constraint.RelativeToParent((parent) => { return(parent.Height); })); layout.Children.Add(newImage, xConstraint: Constraint.RelativeToParent((parent) => { return((parent.Width / 2) - 20); // center of image (which is 40 wide) }), yConstraint: Constraint.RelativeToParent((parent) => { return(parent.Height - 60); })); Content = layout; #region toolbar var tbi = new ToolbarItem("+", "plus.png", () => { var todoItem = new TodoItem(); var todoPage = new TodoItemPage(); todoPage.BindingContext = todoItem; Navigation.PushAsync(todoPage); }, 0, 0); ToolbarItems.Add(tbi); if (Device.OS == TargetPlatform.iOS) { var tbi2 = new ToolbarItem("?", "chat.png", () => { var todos = App.Database.GetItemsNotDone(); var tospeak = ""; foreach (var t in todos) { tospeak += t.Name + " "; } if (tospeak == "") { tospeak = "there are no tasks to do"; } //App.Speech.Speak(tospeak); DependencyService.Get <ITextToSpeech>().Speak("Hello from Xamarin Forms"); }, 0, 0); ToolbarItems.Add(tbi2); } #endregion }
public PhotoEditPage(Photo photo) { this.photo = photo; ToolbarItems.Add(new ToolbarItem { Text = AppResources.PhotoEdit_finished, Icon = "ic_done_white_24dp.png", Order = ToolbarItemOrder.Primary, Command = new Command(() => CommitChanges()) }); if (!string.IsNullOrWhiteSpace(photo.Url)) { ToolbarItem deleteItem = new ToolbarItem { Text = AppResources.PhotoEdit_delete, Order = ToolbarItemOrder.Secondary, Command = new Command(() => DeletePhoto()) }; Device.OnPlatform( iOS: () => { deleteItem.Icon = "ic_delete.png"; }); ToolbarItems.Add(deleteItem); } Title = Utils.GetDateString(photo.CreatedAt); StackLayout layout = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; ScrollView scroller = new ScrollView { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, }; RelativeLayout content = new RelativeLayout { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, }; CachedImage theImage = new CachedImage() { Aspect = Aspect.AspectFill, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, HeightRequest = 500, TransparencyEnabled = false, DownsampleToViewSize = true, CacheDuration = TimeSpan.FromDays(30) }; if (photo.InMemory != null) { theImage.Source = ImageSource.FromStream(() => new MemoryStream(photo.InMemory)); } else { theImage.Source = photo.GetReqUrl(false); } content.Children.Add(theImage, Constraint.Constant(0), Constraint.Constant(0), Constraint.RelativeToParent((parent) => { return(parent.Width); })); treatment = new Editor { HorizontalOptions = LayoutOptions.Fill }; if (!string.IsNullOrWhiteSpace(photo.Treatment)) { treatment.Text = photo.Treatment; } notes = new Editor { HorizontalOptions = LayoutOptions.Fill }; if (!string.IsNullOrWhiteSpace(photo.Notes)) { notes.Text = photo.Notes; } description = new Editor { HorizontalOptions = LayoutOptions.Fill }; if (!string.IsNullOrWhiteSpace(photo.PhotoDescription)) { description.Text = photo.PhotoDescription; } StackLayout details = new StackLayout { Padding = 20, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Fill, Spacing = 10, Children = { new Label { Text = Utils.GetDateString(photo.CreatedAt), FontAttributes = FontAttributes.Bold, FontSize = 24 }, new Label { Text = AppResources.PhotoEdit_treatment, FontAttributes = FontAttributes.Bold, FontSize = 20 }, treatment, new Label { Text = AppResources.PhotoEdit_notes, FontAttributes = FontAttributes.Bold, FontSize = 20 }, notes, new Label { Text = AppResources.PhotoEdit_shotConditions, FontAttributes = FontAttributes.Bold, FontSize = 20 }, description } }; content.Children.Add(details, Constraint.Constant(0), Constraint.RelativeToView(theImage, (parent, view) => { return(view.Y + view.Height + 10); })); scroller.Content = content; // Windows phone doesn't have an action bar, so we need to add the page title as a label if (Device.OS == TargetPlatform.WinPhone) { ContentView titleView = new ContentView { Padding = 15 }; titleView.Content = new Label { Text = Title }; layout.Children.Add(titleView); } layout.Children.Add(scroller); Content = layout; }
public TabbedCarouselExperience() { System.Diagnostics.Debug.WriteLine("Doing Carousel"); _indicatorStyle = CarouselLayout.IndicatorStyleEnum.Tabs; List <HomeViewModel> pages = CreatePages().Result; System.Diagnostics.Debug.WriteLine("Did pages"); viewModel = new SwitcherPageViewModel(pages); BindingContext = viewModel; Title = _indicatorStyle.ToString(); relativeLayout = new RelativeLayout { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; System.Diagnostics.Debug.WriteLine("Pre-Carousel"); var pagesCarousel = CreatePagesCarousel(); System.Diagnostics.Debug.WriteLine("Post-Carousel"); _tabs = CreateTabs(); var tabsHeight = 50; var offsetTabsUp = 15; relativeLayout.Children.Add(_tabs, Constraint.Constant(0), Constraint.RelativeToParent((parent) => { return(parent.Height - tabsHeight - offsetTabsUp); }), Constraint.RelativeToParent(parent => parent.Width), Constraint.Constant(tabsHeight) ); relativeLayout.Children.Add(pagesCarousel, Constraint.RelativeToParent((parent) => { return(parent.X); }), Constraint.RelativeToParent((parent) => { return(parent.Y); }), Constraint.RelativeToParent((parent) => { return(parent.Width); }), Constraint.RelativeToView(_tabs, (parent, sibling) => { return(parent.Height - (sibling.Height) - offsetTabsUp); }) ); ShapeView navigationBarBottom = new ShapeView { ShapeType = ShapeType.Box, StrokeColor = Color.LightGray, StrokeWidth = 1 }; relativeLayout.Children.Add(navigationBarBottom, Constraint.Constant(0), Constraint.RelativeToParent((p) => { return(p.Height - offsetTabsUp + 1); }), Constraint.RelativeToParent((p) => { return(p.Width); }), Constraint.Constant(1)); ShapeView navigationBarTop = new ShapeView { ShapeType = ShapeType.Box, StrokeColor = Color.LightGray, StrokeWidth = 1 }; relativeLayout.Children.Add(navigationBarTop, Constraint.Constant(0), Constraint.RelativeToParent((p) => { return(p.Height - offsetTabsUp - _tabs.Height - 1); }), Constraint.RelativeToParent((p) => { return(p.Width); }), Constraint.Constant(1)); System.Diagnostics.Debug.WriteLine("Content loaded"); this.Content = relativeLayout; }
private void BuildLayout() { var header = UIUtils.MakeHeader(this, "Appointment Details"); var customerImage = new Image(); customerImage.Source = _order.Customer.CustomerImage; customerImage.Aspect = Aspect.AspectFill; var name = new CustomLabel(); name.Text = _order.Customer.FullName; name.FontSize = 22; name.TextColor = Color.White; name.FontFamily = UIUtils.FONT_BEBAS_REGULAR; var services = new CustomLabel(); services.Text = _order.Basket.Select(s => s.Service.Name).Aggregate((i, j) => i + " | " + j); services.TextColor = Color.Black; services.FontSize = 16; services.Margin = new Thickness(20, 10, 20, 0); services.FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR; var address = new CustomLabel(); address.Text = _order.MuaAddress; address.TextColor = Color.Gray; address.FontSize = 14; address.HorizontalOptions = LayoutOptions.StartAndExpand; address.VerticalOptions = LayoutOptions.Center; address.FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR; var dateTime = new CustomLabel(); dateTime.Text = _order.DateTime.ToString("dd.MM.yyyy hh:mm tt", Utils.EnCulture); dateTime.TextColor = Props.ButtonColor; dateTime.FontSize = 14; dateTime.HorizontalOptions = LayoutOptions.EndAndExpand; dateTime.VerticalOptions = LayoutOptions.Center; dateTime.FontFamily = UIUtils.FONT_BEBAS_REGULAR; var addressTimeHolder = new StackLayout { Orientation = StackOrientation.Horizontal, Margin = new Thickness(20, 10, 20, 20), Children = { address, dateTime } }; var note = new CustomLabel(); note.Text = _order.Note; //note.Text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed to eiusmod tempor incididunt ut labore " // + "et dolore magna aliqua. Ut enim ad minim veniam quis nostrud."; note.TextColor = Color.Black; note.Margin = new Thickness(20, 20, 20, 0); note.FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR; var info = new StackLayout { Spacing = 0, BackgroundColor = Color.White, Children = { services, addressTimeHolder, note } }; var rl = new RelativeLayout(); rl.Children.Add(customerImage , Constraint.Constant(0) , Constraint.Constant(0) , Constraint.RelativeToParent(p => p.Width) , Constraint.RelativeToParent(p => p.Width * ScaleCustomerImage)); rl.Children.Add(name , Constraint.RelativeToParent(p => (p.Width - Utils.GetControlSize(name).Width) / 2) , Constraint.RelativeToParent(p => p.Width * (ScaleCustomerImage - 0.1))); rl.Children.Add(info , Constraint.Constant(0) , Constraint.RelativeToParent(p => p.Width * ScaleCustomerImage) , Constraint.RelativeToParent(p => p.Width)); var scrollView = new ScrollView { Content = rl }; var main = new StackLayout { Spacing = 0, BackgroundColor = Color.White, Children = { header, scrollView } }; root = new RelativeLayout(); root.Children.Add(main, Constraint.Constant(0), Constraint.Constant(0) , Constraint.RelativeToParent(p => p.Width) , Constraint.RelativeToParent(p => p.Height)); Content = root; }
public static ActivityIndicator ShowSpinner(ContentPage page) { var spinner = new ActivityIndicator(); var rl = new RelativeLayout(); rl.BackgroundColor = Props.BlackoutColor; rl.Children.Add(spinner, Constraint.RelativeToParent(p => ((p.Width - Utils.GetControlSize(spinner).Width) / 2)), Constraint.RelativeToParent(p => ((p.Height - Utils.GetControlSize(spinner).Height) / 2))); if (page.Content is RelativeLayout) { ((RelativeLayout)page.Content).Children.Add(rl, Constraint.Constant(0), Constraint.Constant(0), Constraint.RelativeToParent(p => p.Width), Constraint.RelativeToParent(p => p.Height)); } else if (page.Content is AbsoluteLayout) { ((AbsoluteLayout)page.Content).Children.Add(rl, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.SizeProportional); } else { //?? } spinner.IsRunning = true; return(spinner); }
private DataTemplate GetDataTemplate() { return(new DataTemplate(() => { Label address = new CustomLabel(); address.SetBinding(Label.TextProperty, "Address"); address.TextColor = Color.White; address.LineBreakMode = LineBreakMode.TailTruncation; address.FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR; Label mainText = new CustomLabel(); mainText.SetBinding(Label.TextProperty, "BusinessName"); mainText.FontSize = 21; mainText.TextColor = Color.White; mainText.FontFamily = UIUtils.FONT_BEBAS_BOOK; Label price = new CustomLabel(); price.SetBinding(Label.TextProperty, "Price"); price.TextColor = Color.White; price.FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR; Label nameMua = new CustomLabel(); nameMua.SetBinding(Label.TextProperty, "FullName"); nameMua.TextColor = Color.White; nameMua.FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR; var imageBackground = new Image(); imageBackground.SetBinding(UIUtils.TagProperty, "Pictures"); imageBackground.SetValue(UIUtils.Tag2Property, 0); imageBackground.Aspect = Aspect.AspectFill; imageBackground.SetBinding(Image.SourceProperty, "PictureSourse"); var leftImg = new Image(); leftImg.Source = ImageSource.FromResource("TiroApp.Images.goToMua.png"); leftImg.HeightRequest = 40; leftImg.WidthRequest = leftImg.HeightRequest; leftImg.GestureRecognizers.Add(new TapGestureRecognizer((v) => { ShowNextBgImage(imageBackground, -1); })); var rightImg = new Image(); rightImg.Source = ImageSource.FromResource("TiroApp.Images.goToMua.png"); rightImg.Rotation = 180; rightImg.HeightRequest = 40; rightImg.WidthRequest = rightImg.HeightRequest; rightImg.GestureRecognizers.Add(new TapGestureRecognizer((v) => { ShowNextBgImage(imageBackground, 1); })); var location = new Image(); location.Source = ImageSource.FromResource("TiroApp.Images.location.png"); location.HeightRequest = 20; location.WidthRequest = rightImg.HeightRequest; var ratingLayout = new RatingLayout(); ratingLayout.HeightRequest = 20; ratingLayout.SetBinding(RatingLayout.RatingProperty, "Rating"); var layout = new RelativeLayout(); layout.BackgroundColor = Color.Black;//TEMP layout.Children.Add(imageBackground, Constraint.Constant(0), Constraint.Constant(0) , Constraint.RelativeToParent(p => p.Width) , Constraint.RelativeToParent(p => p.Height)); layout.Children.Add(price , Constraint.Constant(10) , Constraint.Constant(10)); layout.Children.Add(mainText , Constraint.Constant(10) , Constraint.RelativeToParent(p => p.Height - p.Height / 3 - Utils.GetControlSize(mainText).Height + 20)); layout.Children.Add(nameMua , Constraint.Constant(10) , Constraint.RelativeToParent(p => p.Height - p.Height / 3 + 20)); layout.Children.Add(leftImg , Constraint.RelativeToParent(p => p.Width - Utils.GetControlSize(leftImg).Width - 10) , Constraint.RelativeToParent(p => p.Height / 2 - Utils.GetControlSize(leftImg).Height / 2)); layout.Children.Add(rightImg , Constraint.Constant(10) , Constraint.RelativeToParent(p => p.Height / 2 - Utils.GetControlSize(rightImg).Height / 2)); layout.Children.Add(location , Constraint.Constant(0) , Constraint.RelativeToParent(p => p.Height - Utils.GetControlSize(location).Height - 15)); layout.Children.Add(address , Constraint.Constant(40) , Constraint.RelativeToParent(p => p.Height - Utils.GetControlSize(address).Height - 15) , Constraint.RelativeToParent(p => p.Width - Utils.GetControlSize(ratingLayout).Width - 60) , Constraint.RelativeToParent(p => Utils.GetControlSize(address).Height)); layout.Children.Add(ratingLayout , Constraint.RelativeToParent(p => p.Width - Utils.GetControlSize(ratingLayout).Width - 15) , Constraint.RelativeToParent(p => p.Height - Utils.GetControlSize(ratingLayout).Height - 15)); var viewCell = new ViewCell(); viewCell.View = layout; return viewCell; })); }
public LeadListItemCell() { StyleId = "none"; #region companyNameLabel CompanyNameLabel = new Label() { TextColor = Palette._006, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)) * 1.2, VerticalTextAlignment = TextAlignment.End, LineBreakMode = LineBreakMode.TailTruncation }; CompanyNameLabel.SetBinding( Label.TextProperty, new Binding("Company")); #endregion /* #region opportunityStageLabel * OpportunityStageLabel = new Label() * { * TextColor = Palette._007, * FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), * VerticalTextAlignment = TextAlignment.End, * LineBreakMode = LineBreakMode.TailTruncation * }; * * OpportunityStageLabel.SetBinding( * Label.TextProperty, * new Binding( * path: "OpportunityStage")); #endregion*/ #region leadAmountLabel LeadAmountLabel = new Label() { TextColor = Palette._007, HorizontalTextAlignment = TextAlignment.End, FontSize = Device.OnPlatform( iOS: Device.GetNamedSize(NamedSize.Small, typeof(Label)), Android: Device.GetNamedSize(NamedSize.Small, typeof(Label)), WinPhone: Device.GetNamedSize(NamedSize.Medium, typeof(Label))), LineBreakMode = LineBreakMode.TailTruncation }; LeadAmountLabel.SetBinding( targetProperty: Label.TextProperty, binding: new Binding( path: "OpportunitySize", stringFormat: "{0:C}")); #endregion #region progressBar ProgressBar = new ProgressBar(); ProgressBar.SetBinding( targetProperty: ProgressBar.ProgressProperty, binding: new Binding( path: "OpportunityStagePercent", converter: new WholePercentToDecimalPercent() // use the WholePercentToDecimalPercent value converter to change the whole percent value to a decimal percent value )); #endregion // A ContentView, which will serve as the "top-level" of the cell's view hierarchy. // It also allows a Padding to be set; something that can't be done with a plain View. var contentView = new ContentView(); // set the padding of the contentView contentView.Padding = new Thickness(10, 0); // A container for the "top-level" of the cell's view hierarchy. RelativeLayout relativeLayout = new RelativeLayout(); // add the companyNameLabel to the relativeLayout relativeLayout.Children.Add( view: CompanyNameLabel, xConstraint: Constraint.RelativeToParent(parent => 0), yConstraint: Constraint.RelativeToParent(Parent => 0), widthConstraint: Constraint.RelativeToParent(parent => parent.Width), heightConstraint: Constraint.RelativeToParent(parent => parent.Height / 3)); // add the percentCopleteLabel to the relativeLayout /*relativeLayout.Children.Add( * view: OpportunityStageLabel, * xConstraint: Constraint.RelativeToParent(parent => 0), * yConstraint: Constraint.RelativeToParent(parent => parent.Height / 3), * widthConstraint: Constraint.RelativeToParent(parent => parent.Width / 2), * heightConstraint: Constraint.RelativeToParent(parent => parent.Height / 3));*/ // add the leadAmountLabel to the relativeLayout relativeLayout.Children.Add( view: LeadAmountLabel, xConstraint: Constraint.RelativeToParent(parent => parent.Width / 2), yConstraint: Constraint.RelativeToParent(parent => parent.Height / 3), widthConstraint: Constraint.RelativeToParent(parent => parent.Width / 2), heightConstraint: Constraint.RelativeToParent(parent => parent.Height / 3)); Constraint progressBarConstraint = Constraint.Constant(0); Device.OnPlatform( Default: () => progressBarConstraint = Constraint.RelativeToParent(parent => ((parent.Height / 3) * 2)), iOS: () => progressBarConstraint = Constraint.RelativeToParent(parent => ((parent.Height / 3) * 2) * 1.20)); // add the progressBar to the relativeLayout relativeLayout.Children.Add( view: ProgressBar, xConstraint: Constraint.RelativeToParent(parent => 0), yConstraint: progressBarConstraint, widthConstraint: Constraint.RelativeToParent(parent => parent.Width), heightConstraint: Constraint.RelativeToParent(parent => parent.Height / 3)); // Assign the relativeLayout to Content of contentView // This lets us take advantage of ContentView's padding. contentView.Content = relativeLayout; // assign contentView to the View property View = contentView; }
private void Setup() { // image this.ContentViewImage.Content = this.ImageLogo; this.ContentViewInstructionWrapper.Content = new StackLayout { Children = { this.LabelInstruction, this.EntryEmailRecovery } }; FlexLayout flexLayoutMainContent = new FlexLayout { Direction = FlexDirection.Column, JustifyContent = FlexJustify.Center, Children = { this.ContentViewImage, this.InputUsername, this.InputPassword, this.ButtonLogin, }, }; this.ScrollViewContent.Content = new StackLayout { Children = { flexLayoutMainContent, this.LabelForgotPassword, this.ContentViewInstructionWrapper } }; StackLayout stacklayout = new StackLayout { Children = { this.ButtonClose, this.ScrollViewContent } }; RelativeLayout relativelayout = new RelativeLayout(); // stack relativelayout.Children.Add(stacklayout, Constraint.Constant(0), Constraint.Constant(0), Constraint.RelativeToParent((parent) => { return(parent.Width); }), Constraint.RelativeToParent((parent) => { return(parent.Height); })); // loading relativelayout.Children.Add(CustomActivityIndicator, Constraint.Constant(0), Constraint.Constant(0), Constraint.RelativeToParent((parent) => { return(parent.Width); }), Constraint.RelativeToParent((parent) => { return(parent.Height); })); Content = relativelayout; }
private void BuildLayout() { var main = new RelativeLayout(); this.Content = main; var imageTop = new Image(); imageTop.Source = ImageSource.FromResource("TiroApp.Images.launch.jpg"); imageTop.Aspect = Aspect.AspectFill; main.Children.Add(imageTop, Constraint.Constant(0), Constraint.Constant(0), Constraint.RelativeToParent((p) => { return(p.Width); }), Constraint.RelativeToParent((p) => { return(p.Width * 1.2); })); var bgView = new ContentView(); bgView.BackgroundColor = Props.BlackoutColor; main.Children.Add(bgView, Constraint.Constant(0), Constraint.Constant(0), Constraint.RelativeToParent(p => p.Width), Constraint.RelativeToParent(p => p.Height)); var imageArrowBack = new Image(); imageArrowBack.Source = ImageSource.FromResource("TiroApp.Images.ArrowBack.png"); imageArrowBack.GestureRecognizers.Add(new TapGestureRecognizer(OnBack)); main.Children.Add(imageArrowBack , Constraint.Constant(10) , Constraint.Constant(30) , Constraint.Constant(20) , Constraint.Constant(20)); var button = UIUtils.MakeButton("MAKE A NEW APPLICATION", UIUtils.FONT_SFUIDISPLAY_MEDIUM); button.Clicked += OnBottomButtonClick; //main.Children.Add(button, Constraint.Constant(0), Constraint.RelativeToParent(p => p.Height - button.HeightRequest)); var l21 = new CustomLabel() { TextColor = Color.Black, FontSize = 16, FontFamily = UIUtils.FONT_SFUIDISPLAY_MEDIUM, HorizontalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.Center, Margin = new Thickness(20), Text = "Thanks for applying!" }; var l22 = new CustomLabel() { TextColor = Color.Black, FontSize = 16, FontFamily = UIUtils.FONT_SFUIDISPLAY_MEDIUM, HorizontalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.Center, Margin = new Thickness(20), Text = "Our Tiro Execs are reviewing your application and will get back to you shortly." }; var l23 = new CustomLabel() { TextColor = Color.Black, FontSize = 16, FontFamily = UIUtils.FONT_SFUIDISPLAY_MEDIUM, HorizontalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.Center, Margin = new Thickness(20), Text = "We aim to follow-up between 24 - 48 hours after your application is submitted" }; var bLayout = new StackLayout() { Orientation = StackOrientation.Vertical, BackgroundColor = Color.White, //HeightRequest = 400, Children = { l21, l22, l23, button } }; main.Children.Add(bLayout, Constraint.Constant(0), Constraint.RelativeToParent(p => p.Height - bLayout.Height), Constraint.RelativeToParent(p => p.Width)); var label1 = new CustomLabel() { TextColor = Color.White, FontSize = 28, FontFamily = UIUtils.FONT_BEBAS_REGULAR, HorizontalTextAlignment = TextAlignment.Center, Margin = new Thickness(20), Text = "SIT TIGHT, YOUR APPLICATION IS UNDER REVIEW" }; main.Children.Add(label1, Constraint.Constant(0), Constraint.RelativeToView(bLayout, (p, v) => p.Height - v.Height - label1.Height - 40), Constraint.RelativeToParent(p => p.Width)); }
public LoginPage() { ViewModel.LoginFailed += HandleLoginFailed; ViewModel.LoginApproved += HandleLoginApproved; BackgroundColor = Color.FromHex("#3498db"); Padding = GetPagePadding(); _logo = new Image { Source = "xamarin_logo" }; _logoSlogan = new StyledLabel { Opacity = 0, Text = "Delighting Developers.", }; _usernameEntry = new StyledEntry { Placeholder = "Username", ReturnType = ReturnType.Next, ReturnCommand = new Command(() => _passwordEntry.Focus()) }; _usernameEntry.SetBinding(Xamarin.Forms.Entry.TextProperty, nameof(LoginViewModel.UsernameEntryText)); _passwordEntry = new StyledEntry { Placeholder = "Password", IsPassword = true, ReturnType = ReturnType.Done }; _passwordEntry.SetBinding(Xamarin.Forms.Entry.TextProperty, nameof(LoginViewModel.PasswordEntryText)); _passwordEntry.SetBinding(Xamarin.Forms.Entry.ReturnCommandProperty, nameof(LoginViewModel.LoginButtonTappedCommand)); _loginButton = new StyledButton(Borders.Thin) { Text = "Login" }; _loginButton.SetBinding(IsEnabledProperty, nameof(LoginViewModel.IsInternetConnectionInactive)); _loginButton.SetBinding(Button.CommandProperty, nameof(LoginViewModel.LoginButtonTappedCommand)); _newUserSignUpButton = new StyledButton(Borders.None) { Text = "Sign-up" }; _newUserSignUpButton.Clicked += HandleNewUserSignUpButtonClicked; _newUserSignUpButton.SetBinding(IsEnabledProperty, nameof(LoginViewModel.IsInternetConnectionInactive)); var activityIndicator = new ActivityIndicator { Color = Color.White }; activityIndicator.SetBinding(IsVisibleProperty, nameof(LoginViewModel.IsInternetConnectionActive)); activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, nameof(LoginViewModel.IsInternetConnectionActive)); On <Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true); _relativeLayout = new RelativeLayout(); _relativeLayout.Children.Add(_logo, Constraint.Constant(100), Constraint.Constant(250), Constraint.RelativeToParent(p => p.Width - 200)); _relativeLayout.Children.Add(_logoSlogan, Constraint.RelativeToParent(p => (p.Width / 2) - (getLogoSloganWidth(p) / 2)), Constraint.Constant(125)); _relativeLayout.Children.Add(_usernameEntry, Constraint.Constant(40), Constraint.RelativeToView(_logoSlogan, (p, v) => v.Y + v.Height + _relativeLayoutPadding), Constraint.RelativeToParent(p => p.Width - 80)); _relativeLayout.Children.Add(_passwordEntry, Constraint.Constant(40), Constraint.RelativeToView(_usernameEntry, (p, v) => v.Y + v.Height + _relativeLayoutPadding), Constraint.RelativeToParent(p => p.Width - 80)); _relativeLayout.Children.Add(_loginButton, Constraint.Constant(40), Constraint.RelativeToView(_passwordEntry, (p, v) => v.Y + v.Height + _relativeLayoutPadding), Constraint.RelativeToParent(p => p.Width - 80)); _relativeLayout.Children.Add(_newUserSignUpButton, Constraint.RelativeToParent(p => (p.Width / 2) - (getNewUserButtonWidth(p) / 2)), Constraint.RelativeToView(_loginButton, (parent, view) => view.Y + _loginButton.Height + 15)); _relativeLayout.Children.Add(activityIndicator, Constraint.RelativeToParent(parent => parent.Width / 2 - getActivityIndicatorWidth(parent) / 2), Constraint.RelativeToParent(parent => parent.Height / 2 - getActivityIndicatorHeight(parent) / 2)); Content = new Xamarin.Forms.ScrollView { Content = _relativeLayout }; double getNewUserButtonWidth(RelativeLayout parent) => _newUserSignUpButton.Measure(parent.Width, parent.Height).Request.Width; double getLogoSloganWidth(RelativeLayout parent) => _logoSlogan.Measure(parent.Width, parent.Height).Request.Width; double getActivityIndicatorHeight(RelativeLayout parent) => activityIndicator.Measure(parent.Width, parent.Height).Request.Height; double getActivityIndicatorWidth(RelativeLayout parent) => activityIndicator.Measure(parent.Width, parent.Height).Request.Width; }
public RelativeLayoutDemoPage() { Label header = new Label { Text = "RelativeLayout", Font = Font.BoldSystemFontOfSize(40), XAlign = TextAlignment.Center }; // Create the RelativeLayout RelativeLayout relativeLayout = new RelativeLayout(); // A Label whose upper-left is centered vertically. Label referenceLabel = new Label { Text = "Not visible", Opacity = 0, Font = Font.SystemFontOfSize(NamedSize.Large) }; relativeLayout.Children.Add(referenceLabel, Constraint.Constant(0), Constraint.RelativeToParent((parent) => { return(parent.Height / 2); })); // A Label centered vertically. Label centerLabel = new Label { Text = "Center", Font = Font.SystemFontOfSize(NamedSize.Large) }; relativeLayout.Children.Add(centerLabel, Constraint.Constant(0), Constraint.RelativeToView(referenceLabel, (parent, sibling) => { return(sibling.Y - sibling.Height / 2); })); // A Label above the centered Label. Label aboveLabel = new Label { Text = "Above", Font = Font.SystemFontOfSize(NamedSize.Large) }; relativeLayout.Children.Add(aboveLabel, Constraint.RelativeToView(centerLabel, (parent, sibling) => { return(sibling.X + sibling.Width); }), Constraint.RelativeToView(centerLabel, (parent, sibling) => { return(sibling.Y - sibling.Height); })); // A Label below the centered Label. Label belowLabel = new Label { Text = "Below", Font = Font.SystemFontOfSize(NamedSize.Large) }; relativeLayout.Children.Add(belowLabel, Constraint.RelativeToView(centerLabel, (parent, sibling) => { return(sibling.X + sibling.Width); }), Constraint.RelativeToView(centerLabel, (parent, sibling) => { return(sibling.Y + sibling.Height); })); // Finish with another on top... Label furtherAboveLabel = new Label { Text = "Further Above", Font = Font.SystemFontOfSize(NamedSize.Large) }; relativeLayout.Children.Add(furtherAboveLabel, Constraint.RelativeToView(aboveLabel, (parent, sibling) => { return(sibling.X + sibling.Width); }), Constraint.RelativeToView(aboveLabel, (parent, sibling) => { return(sibling.Y - sibling.Height); })); // ...and another on the bottom. Label furtherBelowLabel = new Label { Text = "Further Below", Font = Font.SystemFontOfSize(NamedSize.Large) }; relativeLayout.Children.Add(furtherBelowLabel, Constraint.RelativeToView(belowLabel, (parent, sibling) => { return(sibling.X + sibling.Width); }), Constraint.RelativeToView(belowLabel, (parent, sibling) => { return(sibling.Y + sibling.Height); })); // Four BoxView's relativeLayout.Children.Add( new BoxView { Color = Color.Red }, Constraint.Constant(0), Constraint.Constant(0)); relativeLayout.Children.Add( new BoxView { Color = Color.Green }, Constraint.RelativeToParent((parent) => { return(parent.Width - 40); }), Constraint.Constant(0)); relativeLayout.Children.Add( new BoxView { Color = Color.Blue }, Constraint.Constant(0), Constraint.RelativeToParent((parent) => { return(parent.Height - 40); })); relativeLayout.Children.Add( new BoxView { Color = Color.Yellow }, Constraint.RelativeToParent((parent) => { return(parent.Width - 40); }), Constraint.RelativeToParent((parent) => { return(parent.Height - 40); })); // Accomodate iPhone status bar. this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5); // Build the page. Grid grid = new Grid { RowDefinitions = { new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) } } }; grid.Children.Add(header, 0, 0); grid.Children.Add(relativeLayout, 0, 1); Content = grid; }
public KalmanRelationshipChartPage() { InitializeComponent(); SfBusyIndicator busyIndicator = new SfBusyIndicator(); BackgroundColor = MyColors.MidnightBlue; Chart.Opacity = .25; relativeLayout.Children.Add(busyIndicator, Constraint.Constant(App.ScreenWidth / 2), Constraint.Constant(App.ScreenHeight / 3), Constraint.Constant(10), Constraint.Constant(10)); //Busy Indicator busyIndicator.ViewBoxWidth = 150; busyIndicator.ViewBoxHeight = 150; busyIndicator.HeightRequest = 50; busyIndicator.WidthRequest = 50; busyIndicator.BackgroundColor = MyColors.MidnightBlue; busyIndicator.AnimationType = AnimationTypes.DoubleCircle; busyIndicator.TextColor = MyColors.Turqoise; busyIndicator.IsVisible = true; busyIndicator.IsBusy = true; busyIndicator.HorizontalOptions = LayoutOptions.Center; busyIndicator.VerticalOptions = LayoutOptions.Center; //get data Task.Run(() => { AnalyzingStockMarkets.GetStockMarketIndicators indicators = new AnalyzingStockMarkets.GetStockMarketIndicators(); var indexPoints = indicators.IndexPoints; var lines = indicators.Lines; var vm = new KalmanRelationshipViewModel(indexPoints, lines); Device.BeginInvokeOnMainThread( () => { BindingContext = vm; Market0.Label = vm.Points [0] [0].Name; Market1.Label = vm.Points [1] [0].Name; Market2.Label = vm.Points [2] [0].Name; Market3.Label = vm.Points [3] [0].Name; Market4.Label = vm.Points [4] [0].Name; Market5.Label = vm.Points [5] [0].Name; //turn off busy indicator busyIndicator.IsVisible = false; busyIndicator.IsBusy = false; Chart.FadeTo(1, 500, Easing.CubicIn); }); }); }
public RegisterForm() { NavigationPage.SetHasNavigationBar(this, false); BackgroundColor = Color.FromHex("#45aeda"); this.actLoading = new ActivityIndicator(); this.imgLogo = new Image(); this.txtUsername = new LineEntry(); this.txtPassword = new LineEntry(); this.txtConfirmPassword = new LineEntry(); this.txtRealName = new LineEntry(); this.txtEmail = new LineEntry(); this.btnCancel = new Button(); this.btnRegister = new Button(); this.relViews = new RelativeLayout(); //actLoading this.actLoading.HorizontalOptions = LayoutOptions.CenterAndExpand; this.actLoading.Color = Color.Green; this.actLoading.SetBinding(VisualElement.IsVisibleProperty, new Binding("IsBusy", BindingMode.OneWay, source: this)); this.actLoading.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy", BindingMode.OneWay, source: this)); //imgLogo this.imgLogo.Source = "xamagon.png"; this.imgLogo.Aspect = Aspect.AspectFit; //txtUsername this.txtUsername.Placeholder = "Tên đăng nhập"; this.txtUsername.TextColor = Color.White; this.txtUsername.BorderColor = Color.FromHex("#45aeda"); this.txtUsername.PlaceholderColor = Color.White; this.txtUsername.Completed += TxtUsername_Completed; //txtPassword this.txtPassword.Placeholder = "Mật khẩu"; this.txtPassword.TextColor = Color.White; this.txtPassword.BorderColor = Color.FromHex("#45aeda"); this.txtPassword.PlaceholderColor = Color.White; this.txtPassword.IsPassword = true; this.txtPassword.Completed += TxtPassword_Completed; //txtConfirmPassword this.txtConfirmPassword.Placeholder = "Nhập lại mật khẩu"; this.txtConfirmPassword.TextColor = Color.White; this.txtConfirmPassword.BorderColor = Color.FromHex("#45aeda"); this.txtConfirmPassword.PlaceholderColor = Color.White; this.txtConfirmPassword.IsPassword = true; this.txtConfirmPassword.Completed += TxtConfirmPassword_Completed; //txtRealName this.txtRealName.Placeholder = "Họ & Tên"; this.txtRealName.TextColor = Color.White; this.txtRealName.BorderColor = Color.FromHex("#45aeda"); this.txtRealName.PlaceholderColor = Color.White; this.txtRealName.Completed += TxtRealName_Completed; //txtEmail this.txtEmail.Placeholder = "Email"; this.txtEmail.TextColor = Color.White; this.txtEmail.BorderColor = Color.FromHex("#45aeda"); this.txtEmail.PlaceholderColor = Color.White; this.txtEmail.Completed += TxtEmail_Completed; //btnRegister this.btnRegister.BackgroundColor = Color.FromHex("#196fb4"); this.btnRegister.TextColor = Color.White; this.btnRegister.Text = "Đăng ký"; this.btnRegister.Clicked += BtnRegister_Clicked; //btnCancel this.btnCancel.BackgroundColor = Color.FromHex("#196fb4"); this.btnCancel.TextColor = Color.White; this.btnCancel.Text = "Hủy"; this.btnCancel.Clicked += BtnCancel_Clicked; this.relViews.Padding = new Thickness(0, Xamarin.Forms.Device.OnPlatform(20, 0, 0), 0, 0); this.relViews.Children.Add(imgLogo, Constraint.RelativeToParent((parent) => { return(parent.Width * 0.5 * 0.25); }), Constraint.Constant(0), Constraint.RelativeToParent((parent) => { return(parent.Width * 0.75); }), Constraint.RelativeToParent((parent) => { return(parent.Width * 0.75); }) ); this.relViews.Children.Add(txtUsername, Constraint.RelativeToParent((parent) => { return(parent.Width * 0.5 * 0.2); }), Constraint.RelativeToView(imgLogo, (parent, sibling) => { return(sibling.Y + sibling.Height); }), Constraint.RelativeToParent((parent) => { return(parent.Width * 0.8); }) ); this.relViews.Children.Add(txtPassword, Constraint.RelativeToParent((parent) => { return(parent.Width * 0.5 * 0.2); }), Constraint.RelativeToView(txtUsername, (parent, sibling) => { return(sibling.Y + sibling.Height * 2); }), Constraint.RelativeToParent((parent) => { return(parent.Width * 0.8); }) ); this.relViews.Children.Add(txtConfirmPassword, Constraint.RelativeToParent((parent) => { return(parent.Width * 0.5 * 0.2); }), Constraint.RelativeToView(txtPassword, (parent, sibling) => { return(sibling.Y + sibling.Height * 2); }), Constraint.RelativeToParent((parent) => { return(parent.Width * 0.8); }) ); this.relViews.Children.Add(txtRealName, Constraint.RelativeToParent((parent) => { return(parent.Width * 0.5 * 0.2); }), Constraint.RelativeToView(txtConfirmPassword, (parent, sibling) => { return(sibling.Y + sibling.Height * 2); }), Constraint.RelativeToParent((parent) => { return(parent.Width * 0.8); }) ); this.relViews.Children.Add(txtEmail, Constraint.RelativeToParent((parent) => { return(parent.Width * 0.5 * 0.2); }), Constraint.RelativeToView(txtRealName, (parent, sibling) => { return(sibling.Y + sibling.Height * 2); }), Constraint.RelativeToParent((parent) => { return(parent.Width * 0.8); }) ); this.relViews.Children.Add(btnRegister, Constraint.RelativeToView(txtEmail, (parent, sibling) => { return(sibling.X); }), Constraint.RelativeToView(txtEmail, (parent, sibling) => { return(sibling.Y + sibling.Height * 2); }), Constraint.RelativeToView(txtEmail, (parent, sibling) => { return(sibling.Width * 0.5 - 10); }), Constraint.RelativeToView(txtEmail, (parent, sibling) => { return(sibling.Height * 2); }) ); this.relViews.Children.Add(btnCancel, Constraint.RelativeToView(btnRegister, (parent, sibling) => { return(sibling.X + sibling.Width + 20); }), Constraint.RelativeToView(btnRegister, (parent, sibling) => { return(sibling.Y); }), Constraint.RelativeToView(btnRegister, (parent, sibling) => { return(sibling.Width); }), Constraint.RelativeToView(btnRegister, (parent, sibling) => { return(sibling.Height); }) ); this.relViews.Children.Add(actLoading, Constraint.RelativeToParent((parent) => { return(parent.Width * 0.5 - 10); }), Constraint.RelativeToParent((parent) => { return(parent.Height * 0.5); }) ); this.Content = this.relViews; }
void Init() { OsmNominatim.Instance.CountryCodes.Add("de"); _autoCompleteListView = new ListView { IsVisible = false, RowHeight = 40, HeightRequest = 0, BackgroundColor = Color.White }; _autoCompleteListView.ItemTemplate = new DataTemplate(() => { var cell = new TextCell(); cell.SetBinding(ImageCell.TextProperty, "Description"); return(cell); }); View searchView; if (_useSearchBar) { _searchBar = new SearchBar { Placeholder = "Search for address..." }; _searchBar.TextChanged += SearchTextChanged; _searchBar.SearchButtonPressed += SearchButtonPressed; searchView = _searchBar; } else { _entry = new Entry { Placeholder = "Sarch for address" }; _entry.TextChanged += SearchTextChanged; searchView = _entry; } //_map = new TKCustomMap // { // }; Children.Add(searchView, Constraint.Constant(0), Constraint.Constant(0), widthConstraint: Constraint.RelativeToParent(l => l.Width)); Children.Add( _autoCompleteListView, Constraint.Constant(0), Constraint.RelativeToView(searchView, (r, v) => v.Y + v.Height)); //Children.Add( // _map, // Constraint.Constant(0), // Constraint.RelativeToView(_autoCompleteListView, (r, v) => v.Y + v.Height)); _autoCompleteListView.ItemSelected += ItemSelected; _textChangeItemSelected = false; }
public AddOpportunityPage() { #region Create Topic Controls var topicLabel = new Label { Text = "Topic" }; _topicEntry = new CustomReturnEntry { ReturnType = ReturnType.Next, AutomationId = AutomationIdConstants.TopicEntry, ReturnCommand = new Command(() => _companyEntry.Focus()) }; _topicEntry.SetBinding(Entry.TextProperty, nameof(ViewModel.Topic)); #endregion #region Create Company Controls var companyLabel = new Label { Text = "Company" }; _companyEntry = new CustomReturnEntry { ReturnType = ReturnType.Next, AutomationId = AutomationIdConstants.CompanyEntry, ReturnCommand = new Command(() => _leaseAmountEntry.Focus()) }; _companyEntry.SetBinding(Entry.TextProperty, nameof(ViewModel.Company)); #endregion #region Create DBA Controls var dbaLabel = new Label { Text = "DBA" }; _dbaEntry = new CustomReturnEntry { AutomationId = AutomationIdConstants.DBAEntry, ReturnType = ReturnType.Go }; _dbaEntry.SetBinding(Entry.TextProperty, nameof(ViewModel.DBA)); _dbaEntry.SetBinding(CustomReturnEntry.ReturnCommandProperty, nameof(ViewModel.SaveButtonTapped)); #endregion #region Create LeaseAmount Controls var leaseAmountLabel = new Label { Text = "Lease Amount" }; _leaseAmountEntry = new CustomReturnEntry { ReturnType = ReturnType.Next, AutomationId = AutomationIdConstants.LeaseAmountEntry, Keyboard = Keyboard.Numeric, Placeholder = "0", ReturnCommand = new Command(() => _ownerEntry.Focus()) }; _leaseAmountEntry.SetBinding(Entry.TextProperty, nameof(ViewModel.LeaseAmount)); #endregion #region Create Owner Controls var ownerLabel = new Label { Text = "Owner" }; _ownerEntry = new CustomReturnEntry { ReturnType = ReturnType.Next, AutomationId = AutomationIdConstants.OwnerEntry, ReturnCommand = new Command(() => _dbaEntry.Focus()) }; _ownerEntry.SetBinding(Entry.TextProperty, nameof(ViewModel.Owner)); #endregion #region create the Relative Layout var mainLayout = new RelativeLayout(); mainLayout.Children.Add(topicLabel, Constraint.Constant(0), Constraint.Constant(0) ); mainLayout.Children.Add(_topicEntry, Constraint.Constant(0), Constraint.RelativeToView(topicLabel, (parent, view) => view.Y + view.Height), Constraint.RelativeToParent((parent) => parent.Width) ); mainLayout.Children.Add(companyLabel, Constraint.Constant(0), Constraint.RelativeToView(_topicEntry, (parent, view) => view.Y + view.Height + _relativeLayoutSpacing) ); mainLayout.Children.Add(_companyEntry, Constraint.Constant(0), Constraint.RelativeToView(companyLabel, (parent, view) => view.Y + view.Height), Constraint.RelativeToParent((parent) => parent.Width) ); mainLayout.Children.Add(leaseAmountLabel, Constraint.Constant(0), Constraint.RelativeToView(_companyEntry, (parent, view) => view.Y + view.Height + _relativeLayoutSpacing) ); mainLayout.Children.Add(_leaseAmountEntry, Constraint.Constant(0), Constraint.RelativeToView(leaseAmountLabel, (parent, view) => view.Y + view.Height), Constraint.RelativeToParent((parent) => parent.Width) ); mainLayout.Children.Add(ownerLabel, Constraint.Constant(0), Constraint.RelativeToView(_leaseAmountEntry, (parent, view) => view.Y + view.Height + _relativeLayoutSpacing) ); mainLayout.Children.Add(_ownerEntry, Constraint.Constant(0), Constraint.RelativeToView(ownerLabel, (parent, view) => view.Y + view.Height), Constraint.RelativeToParent((parent) => parent.Width) ); mainLayout.Children.Add(dbaLabel, Constraint.Constant(0), Constraint.RelativeToView(_ownerEntry, (parent, view) => view.Y + view.Height + _relativeLayoutSpacing) ); mainLayout.Children.Add(_dbaEntry, Constraint.Constant(0), Constraint.RelativeToView(dbaLabel, (parent, view) => view.Y + view.Height), Constraint.RelativeToParent((parent) => parent.Width) ); #endregion #region Create Save Button var saveButtonToolBar = new ToolbarItem { Text = _saveToolBarItemText, Priority = 0, AutomationId = AutomationIdConstants.SaveButton }; saveButtonToolBar.SetBinding(ToolbarItem.CommandProperty, nameof(ViewModel.SaveButtonTapped)); ToolbarItems.Add(saveButtonToolBar); #endregion #region Create Cancel Button _cancelButtonToolBarItem = new ToolbarItem { Text = _cancelToolBarItemText, Priority = 1, AutomationId = AutomationIdConstants.CancelButton }; ToolbarItems.Add(_cancelButtonToolBarItem); #endregion Title = PageTitleConstants.AddOpportunityPageTitle; Padding = new Thickness(20, 10, 20, 0); Content = mainLayout; }
public DialogCell() { double timeWidth = Utils.CalcString(DateTime.Now.ToString()); var view = new RelativeLayout(); var charLen = "a".GetWidth(); PhoneLabel = new Label { FontSize = 18, FontAttributes = FontAttributes.Bold }; TimeLabel = new Label { FontSize = TimeSize }; //, TextColor = Color.Gray ValueLabel = new Label { FontSize = 14, Margin = new Thickness(0, 10) }; CapacityLabel = new Label { FontSize = 12, TextColor = Color.LightSlateGray, Margin = new Thickness(0, 10) }; SimLabel = new Label { FontSize = 12, TextColor = Color.Gray, Margin = new Thickness(2) }; SimView = new BoxView { HeightRequest = 20, WidthRequest = 10 }; Frame simFrame = new Frame { CornerRadius = 3, IsClippedToBounds = true, Content = SimLabel, HeightRequest = 20, WidthRequest = 10, Padding = new Thickness(0), // BackgroundColor = Color.Gray, // BorderColor = Color.Green // OutlineColor = Color.Red }; StateImage = new Image { Source = ImageSource.FromFile("ok.png") as FileImageSource, HeightRequest = charLen * 2, WidthRequest = charLen * 2, Margin = new Thickness(0, 10), }; StateFrame = new Frame { HeightRequest = 10, WidthRequest = 10, CornerRadius = 5, HasShadow = false, Padding = new Thickness(0) // BackgroundColor = Color.Transparent }; Func <RelativeLayout, double> StateFramePosition = delegate(RelativeLayout p) { var off = CapacityLabel.Text.Length * charLen; return(p.Width - (off < 35 ? 50 : CapacityLabel.Text.Length *charLen + 15)); }; view.Children.Add(PhoneLabel, Constraint.Constant(20), Constraint.Constant(0)); view.Children.Add(TimeLabel, Constraint.RelativeToParent((par) => par.Width - timeWidth - 10)); view.Children.Add(ValueLabel, Constraint.Constant(25), Constraint.Constant(25), Constraint.RelativeToParent((par) => par.Width) ); view.Children.AddAsRelative(CapacityLabel, p => p.Width - CapacityLabel.Text.Length * charLen, p => 25); view.Children.AddAsRelative(simFrame, p => 5, p => 5); // view.Children.AddAsRelative(SimLabel, p => p.Width - 60, p => 35);//*/ // view.Children.AddAsRelative(StateImage, p => 5, p => 30); view.Children.AddAsRelative(StateFrame, StateFramePosition, p => 39); View = view; SetBindings(); }
public GitHubSettingsView() { const int _imageHeight = 200; const int _demoButtonFontSize = 8; var gitHubAvatarImage = new CircleImage { AutomationId = SettingsPageAutomationIds.GitHubAvatarImage, HeightRequest = _imageHeight, WidthRequest = _imageHeight, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Aspect = Aspect.AspectFit }; gitHubAvatarImage.SetBinding(CircleImage.SourceProperty, nameof(SettingsViewModel.GitHubAvatarImageSource)); var gitHubAliasLabel = new Label { HorizontalTextAlignment = TextAlignment.Center, AutomationId = SettingsPageAutomationIds.GitHubAliasLabel, }; gitHubAliasLabel.SetBinding(Label.TextProperty, nameof(SettingsViewModel.GitHubAliasLabelText)); var gitHubLoginButton = new FontAwesomeButton { AutomationId = SettingsPageAutomationIds.GitHubLoginButton, TextColor = Color.White, FontSize = 24, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Padding = new Thickness(10), Margin = new Thickness(0, 25, 0, 5) }; gitHubLoginButton.SetDynamicResource(BackgroundColorProperty, nameof(BaseTheme.ButtonBackgroundColor)); gitHubLoginButton.SetDynamicResource(Button.TextColorProperty, nameof(BaseTheme.ButtonTextColor)); gitHubLoginButton.SetBinding(Button.TextProperty, nameof(SettingsViewModel.LoginButtonText)); gitHubLoginButton.SetBinding(Button.CommandProperty, nameof(SettingsViewModel.LoginButtonCommand)); var demoButton = new Button { AutomationId = SettingsPageAutomationIds.DemoModeButton, Padding = new Thickness(2), BackgroundColor = Color.Transparent, FontSize = _demoButtonFontSize, Text = "Enter Demo Mode", HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, }; demoButton.SetDynamicResource(Button.TextColorProperty, nameof(BaseTheme.TextColor)); demoButton.SetBinding(IsVisibleProperty, nameof(SettingsViewModel.IsDemoButtonVisible)); demoButton.SetBinding(Button.CommandProperty, nameof(SettingsViewModel.DemoButtonCommand)); var activityIndicator = new ActivityIndicator { AutomationId = SettingsPageAutomationIds.GitHubSettingsViewActivityIndicator, VerticalOptions = LayoutOptions.Start }; activityIndicator.SetDynamicResource(ActivityIndicator.ColorProperty, nameof(BaseTheme.RefreshControlColor)); activityIndicator.SetBinding(IsVisibleProperty, nameof(SettingsViewModel.IsAuthenticating)); activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, nameof(SettingsViewModel.IsAuthenticating)); var relativeLayout = new RelativeLayout(); relativeLayout.Children.Add(gitHubAvatarImage, //Center the image horizontally within the RelativeLayout xConstraint: Constraint.RelativeToParent(parent => parent.Width / 2 - getImageSizeConstraint(parent) / 2), //Pin the image to the top of the screen yConstraint: Constraint.Constant(0), //Width and Height should be the same widthConstraint: Constraint.RelativeToParent(parent => getImageSizeConstraint(parent)), //Width and Height should be the same heightConstraint: Constraint.RelativeToParent(parent => getImageSizeConstraint(parent))); relativeLayout.Children.Add(gitHubLoginButton, //Center the button horizontally within the RelativeLayout xConstraint: Constraint.RelativeToParent(parent => parent.Width / 2 - getWidth(parent, gitHubLoginButton) / 2), //Place the button below gitHubAvatarImage yConstraint: Constraint.RelativeToView(gitHubAvatarImage, (parent, view) => view.Y + view.Height + 5), //Ensure the button scales to the height of the RelativeLayout heightConstraint: Constraint.RelativeToParent(parent => getLoginButtonSizeConstraint(parent))); relativeLayout.Children.Add(demoButton, //Center the button horizontally within the RelativeLayout xConstraint: Constraint.RelativeToParent(parent => parent.Width / 2 - getWidth(parent, demoButton) / 2), //Place the button below gitHubLoginButton yConstraint: Constraint.RelativeToView(gitHubLoginButton, (parent, view) => view.Y + view.Height + 2), heightConstraint: Constraint.Constant(getDemoButtonSizeConstraint())); relativeLayout.Children.Add(activityIndicator, //Center the activityIndicator horizontally within the RelativeLayout xConstraint: Constraint.RelativeToParent(parent => parent.Width / 2 - getWidth(parent, activityIndicator) / 2), //Place the activityIndicator below gitHubLoginButton yConstraint: Constraint.RelativeToView(gitHubLoginButton, (parent, view) => view.Y + view.Height + 5)); Content = relativeLayout;
public ArrowPage(Arrow correctArrow, UserResult userResult, TestType testType) { InitializeComponent(); var countOfCorrect = 0; var countOfMistakes = 0; var layout = new RelativeLayout(); var grid = new Grid(); var gridWidth = 8; var gridHeight = 8; var countOfArrows = gridWidth * gridHeight; for (int i = 0; i < gridWidth; i++) { grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); } for (int i = 0; i < gridHeight; i++) { grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); } var random = new Random(); var views = Enumerable.Range(0, 4) .SelectMany(a => Enumerable.Range(0, countOfArrows / 4).Select(r => a)) .OrderBy(a => random.Next()) .Select(a => new Button { Text = Arrows[a], FontSize = 30.0 } ) .Select((b, ind) => (view: b, left: ind % gridWidth, top: ind / gridHeight)); foreach (var view in views) { view.view.Clicked += (a, b) => { if (view.view.Text == Arrows[(int)correctArrow]) { countOfCorrect++; } else { if (view.view.Text != Arrows[(int)Arrow.None]) { countOfMistakes++; } //else } view.view.Text = Arrows[(int)Arrow.None]; }; grid.Children.Add(view.view, view.left, view.top); } layout.Children.Add( grid, Constraint.Constant(0), Constraint.Constant(0), Constraint.RelativeToParent((parent) => parent.Width), Constraint.RelativeToParent((parent) => parent.Height * 0.75) ); var startTime = DateTime.Now; layout.Children.Add( new Button { Text = "Закончить", Command = new Command(() => Navigation.PushAsync( new ResultPage(countOfCorrect, countOfMistakes, countOfArrows, DateTime.Now - startTime, userResult, testType) ) ) }, Constraint.Constant(0), Constraint.RelativeToParent((parent) => parent.Height * 0.75), Constraint.RelativeToParent((parent) => parent.Width), Constraint.RelativeToParent((parent) => parent.Height * 0.25) ); Content = layout; }
public CarouselView(CarouselLayout.IndicatorStyleEnum indicatorStyle, BaseViewModel viewModel, DataTemplate dataTemplate) { _indicatorStyle = indicatorStyle; _dataTemplate = dataTemplate; BindingContext = viewModel; relativeLayout = new RelativeLayout { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; CarouselLayout pagesCarousel = CreatePagesCarousel(); StackLayout dots = CreatePagerIndicatorContainer(); _tabs = CreateTabs(); switch (pagesCarousel.IndicatorStyle) { case CarouselLayout.IndicatorStyleEnum.Dots: relativeLayout.Children.Add(pagesCarousel, Constraint.RelativeToParent((parent) => { return(parent.X); }), Constraint.RelativeToParent((parent) => { return(parent.Y); }), Constraint.RelativeToParent((parent) => { return(parent.Width); }), Constraint.RelativeToParent((parent) => { return(parent.Height); }) ); relativeLayout.Children.Add(dots, Constraint.Constant(0), Constraint.RelativeToView(pagesCarousel, (parent, sibling) => { return(sibling.Height - Constants.HeightCaruselIndicator); }), Constraint.RelativeToParent(parent => parent.Width), Constraint.Constant(Constants.HeightCaruselIndicator) ); break; case CarouselLayout.IndicatorStyleEnum.Tabs: var tabsHeight = 50; relativeLayout.Children.Add(_tabs, Constraint.Constant(0), Constraint.RelativeToParent((parent) => { return(parent.Height - tabsHeight); }), Constraint.RelativeToParent(parent => parent.Width), Constraint.Constant(tabsHeight) ); relativeLayout.Children.Add(pagesCarousel, Constraint.RelativeToParent((parent) => { return(parent.X); }), Constraint.RelativeToParent((parent) => { return(parent.Y); }), Constraint.RelativeToParent((parent) => { return(parent.Width); }), Constraint.RelativeToView(_tabs, (parent, sibling) => { return(parent.Height - (sibling.Height)); }) ); break; default: relativeLayout.Children.Add(pagesCarousel, Constraint.RelativeToParent((parent) => { return(parent.X); }), Constraint.RelativeToParent((parent) => { return(parent.Y); }), Constraint.RelativeToParent((parent) => { return(parent.Width); }), Constraint.RelativeToParent((parent) => { return(parent.Height); }) ); break; } Content = relativeLayout; }
public WelcomeView() { const string titleText = "Welcome"; const string bodyText = "Enjoy InvestmentDataSampleApp"; const string okButtonText = "Ok, thanks!"; _backgroundOverlayBoxView = new BoxView { BackgroundColor = ColorConstants.WhiteWith75Opacity }; _backgroundOverlayBoxView.Opacity = 0; _overlayFrame = new Frame { HasShadow = true, BackgroundColor = Color.White }; _overlayFrame.Scale = 0; var titleLabel = new Label { FontAttributes = FontAttributes.Bold, Text = titleText, HorizontalTextAlignment = TextAlignment.Center, AutomationId = AutomationIdConstants.WelcomeViewTitleLabel }; var bodyLabel = new Label { Text = bodyText, HorizontalTextAlignment = TextAlignment.Center, AutomationId = AutomationIdConstants.WelcomeViewBodyLabel }; var okButton = new Button { Style = StyleConstants.WelcomeViewButtonStyle, TextColor = Color.White, FontAttributes = FontAttributes.Bold, Margin = new Thickness(5), Text = okButtonText, AutomationId = AutomationIdConstants.WelcomeViewOkButton }; okButton.SetBinding <OpportunitiesViewModel>(Button.CommandProperty, vm => vm.OkButtonTapped); _textAndButtonStack = new StackLayout { HorizontalOptions = LayoutOptions.CenterAndExpand, Spacing = 20, Children = { titleLabel, bodyLabel, okButton } }; _textAndButtonStack.Scale = 0; _relativeLayout = new RelativeLayout(); Func <RelativeLayout, double> gettextAndButtonStackHeight = (p) => _textAndButtonStack.Measure(_relativeLayout.Width, _relativeLayout.Height).Request.Height; Func <RelativeLayout, double> gettextAndButtonStackWidth = (p) => _textAndButtonStack.Measure(_relativeLayout.Width, _relativeLayout.Height).Request.Width; _relativeLayout.Children.Add(_backgroundOverlayBoxView, Constraint.Constant(-10), Constraint.Constant(0), Constraint.RelativeToParent(parent => parent.Width + 20), Constraint.RelativeToParent(parent => parent.Height) ); _relativeLayout.Children.Add(_overlayFrame, Constraint.RelativeToParent(parent => parent.Width / 2 - gettextAndButtonStackWidth(parent) / 2 - 20), Constraint.RelativeToParent(parent => parent.Height / 2 - gettextAndButtonStackHeight(parent) / 2 - 10), Constraint.RelativeToParent(parent => gettextAndButtonStackWidth(parent) + 30), Constraint.RelativeToParent(parent => gettextAndButtonStackHeight(parent) + 30) ); _relativeLayout.Children.Add(_textAndButtonStack, Constraint.RelativeToView(_overlayFrame, (parent, view) => view.X + 15), Constraint.RelativeToView(_overlayFrame, (parent, view) => view.Y + 15) ); if (Device.OS == TargetPlatform.Android) { _overlayFrame.IsVisible = false; _textAndButtonStack.BackgroundColor = ColorConstants.WhiteWith90Opacity; } Content = _relativeLayout; }
public void BuildLayout() { main = new RelativeLayout(); this.Content = main; var imageTop = new Image(); imageTop.Source = ImageSource.FromResource("TiroApp.Images.w1.png"); imageTop.Aspect = Aspect.AspectFill; main.Children.Add(imageTop, Constraint.Constant(0), Constraint.Constant(0), Constraint.RelativeToParent((p) => { return(p.Width); }), Constraint.RelativeToParent((p) => { return(p.Width * 1.2); })); var bgView = new ContentView(); bgView.BackgroundColor = Props.BlackoutColor; main.Children.Add(bgView, Constraint.Constant(0), Constraint.Constant(0), Constraint.RelativeToParent(p => p.Width), Constraint.RelativeToParent(p => p.Height)); var label1 = new CustomLabel() { TextColor = Color.White, FontSize = 28, FontFamily = UIUtils.FONT_BEBAS_REGULAR, Text = "WELCOME TO TIRO!" }; var label21 = new CustomLabel() { TextColor = Color.White, FontSize = 16, FontFamily = UIUtils.FONT_SFUIDISPLAY_MEDIUM, HorizontalTextAlignment = TextAlignment.Center, Text = "You’re on your way to growing your business." }; var label22 = new CustomLabel() { TextColor = Color.White, FontSize = 16, FontFamily = UIUtils.FONT_SFUIDISPLAY_MEDIUM, HorizontalTextAlignment = TextAlignment.Center, Text = "Discover over 1 million clients who use" }; var label23 = new CustomLabel() { TextColor = Color.White, FontSize = 16, FontFamily = UIUtils.FONT_SFUIDISPLAY_MEDIUM, HorizontalTextAlignment = TextAlignment.Center, Text = "Tiro every day." }; var label3 = new CustomLabel() { TextColor = Props.ButtonColor, FontSize = 16, FontFamily = UIUtils.FONT_SFUIDISPLAY_MEDIUM, Text = "Questions About Tiro?" }; var signupAsClient = new CustomLabel() { Text = "Sign Up as a Client", TextColor = Props.ButtonColor, FontFamily = UIUtils.FONT_SFUIDISPLAY_MEDIUM, FontSize = 16 }; signupAsClient.GestureRecognizers.Add(new TapGestureRecognizer(v => { Utils.ShowPageFirstInStack(this, new LoginPage()); })); main.Children.Add(label1, Constraint.RelativeToParent(p => { return((p.Width - label1.Width) / 2); }), Constraint.Constant(112)); main.Children.Add(label21, Constraint.RelativeToParent(p => { return((p.Width - label21.Width) / 2); }), Constraint.Constant(170)); main.Children.Add(label22, Constraint.RelativeToParent(p => { return((p.Width - label22.Width) / 2); }), Constraint.Constant(195)); main.Children.Add(label23, Constraint.RelativeToParent(p => { return((p.Width - label23.Width) / 2); }), Constraint.Constant(220)); main.Children.Add(label3, Constraint.RelativeToParent(p => { return((p.Width - label3.Width) / 2); }), Constraint.Constant(262)); main.Children.Add(signupAsClient, Constraint.RelativeToParent(p => { return(p.Width - signupAsClient.Width - 20); }), Constraint.Constant(20)); bottomView = new ContentView(); main.Children.Add(bottomView, Constraint.Constant(0), Constraint.RelativeToParent((p) => { return(p.Height - bottomView.HeightRequest); }), Constraint.RelativeToParent((p) => { return(p.Width); })); tabView = new TabView(new List <string> { "SING UP", "LOG IN" }, Color.FromHex("CF7090")); tabView.OnIndexChange += OnTabChange; main.Children.Add(tabView, Constraint.Constant(0), Constraint.RelativeToParent((p) => { return(p.Height - bottomView.HeightRequest - tabView.HeightRequest); }), Constraint.RelativeToParent((p) => { return(p.Width); }), Constraint.Constant(tabView.HeightRequest)); BuildSignUp(); main.ForceLayout(); }
public CategoriasVista() { Label Bienvenida = new Label { BackgroundColor = Color.Transparent, Margin = new Thickness((App.DisplayScreenWidth / 12.533333333333333), 0, 0, 0), HorizontalTextAlignment = TextAlignment.Start, HorizontalOptions = LayoutOptions.FillAndExpand, Text = "PAMPSIP", FontFamily = Device.OnPlatform("Montserrat-Bold", "Montserrat-Bold", null), TextColor = Color.White, FontSize = (App.DisplayScreenWidth / 15.04) }; RelativeLayout CC = new RelativeLayout() { Padding = 0, WidthRequest = App.DisplayScreenWidth, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Start, BackgroundColor = Color.Transparent, }; CC.Children.Add(new Image { Aspect = Aspect.Fill, Source = "header", HeightRequest = App.DisplayScreenHeight / 2.889679715302491 }, Constraint.Constant(0), Constraint.Constant(-20), Constraint.Constant(App.DisplayScreenWidth), Constraint.Constant(App.DisplayScreenHeight / 2.889679715302491) ); CC.Children.Add(Bienvenida, Constraint.Constant(0), Constraint.Constant(App.DisplayScreenHeight / 8.12), Constraint.Constant(App.DisplayScreenWidth) ); Grid Contenido = new Grid { Padding = 0, BackgroundColor = Color.White, RowSpacing = 0, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, 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(CC, 0, 0); //Contenido.Children.Add(ServiciosAsociados, 0, 1); Padding = 0; Content = Contenido; }
/// <summary> /// Creates this view according to the orientation. /// </summary> /// <param name="newOrientation">The desired orientation.</param> /// <returns>The created view.</returns> private View CreateView(StackOrientation newOrientation) { RelativeLayout layout = new RelativeLayout(); // create the carousel Xamarin.Forms.CarouselView carousel = new Xamarin.Forms.CarouselView(); carousel.SetBinding(Xamarin.Forms.CarouselView.PositionProperty, "SelectedPage"); carousel.SetBinding(ItemsView.ItemsSourceProperty, "Pages"); if (newOrientation == StackOrientation.Vertical) { carousel.ItemTemplate = new DataTemplate(LoadPortraitTemplate); } else { carousel.ItemTemplate = new DataTemplate(LoadLandscapeTemplate); } // bottom buttons var skipLabel = new Label() { Text = Strings.UserOnboarding_Skip, TextColor = Color.White }; skipLabel.SetBinding(IsVisibleProperty, "IsForwardVisible"); var finishTapGestureRecognizer = new TapGestureRecognizer(); finishTapGestureRecognizer.SetBinding(TapGestureRecognizer.CommandProperty, "FinishCommand"); skipLabel.GestureRecognizers.Add(finishTapGestureRecognizer); var forwardLabel = new Label() { Text = Strings.UserOnboarding_Forward, TextColor = Color.White }; forwardLabel.SetBinding(IsVisibleProperty, "IsForwardVisible"); var forwardGestureRecognizer = new TapGestureRecognizer(); forwardGestureRecognizer.SetBinding(TapGestureRecognizer.CommandProperty, "ForwardCommand"); forwardLabel.GestureRecognizers.Add(forwardGestureRecognizer); var okLabel = new Label() { Text = Strings.UserOnboarding_Ok, TextColor = Color.White }; okLabel.SetBinding(IsVisibleProperty, "IsFinishVisible"); okLabel.GestureRecognizers.Add(finishTapGestureRecognizer); var indicators = new CarouselIndicators() { IndicatorWidth = 10, IndicatorHeight = 10, UnselectedIndicator = "unselected_circle.png", SelectedIndicator = "selected_circle.png" }; indicators.SetBinding(CarouselIndicators.PositionProperty, "SelectedPage"); indicators.SetBinding(CarouselIndicators.ItemsSourceProperty, "Pages"); var separator = new BoxView() { Color = Color.White, HeightRequest = 1 }; // add pieces together layout.Children.Add(carousel, widthConstraint: Constraint.RelativeToParent(parent => parent.Width), heightConstraint: Constraint.RelativeToParent(parent => parent.Height)); layout.Children.Add(skipLabel, Constraint.Constant(10), Constraint.RelativeToParent(parent => parent.Height - 30)); layout.Children.Add(forwardLabel, Constraint.RelativeToParent(parent => parent.Width - 50), Constraint.RelativeToParent(parent => parent.Height - 30)); layout.Children.Add(okLabel, Constraint.RelativeToParent(parent => parent.Width - 80), Constraint.RelativeToParent(parent => parent.Height - 30)); layout.Children.Add(indicators, Constraint.RelativeToParent(parent => parent.Width * 0.5 - 15), Constraint.RelativeToParent(parent => parent.Height - 30)); layout.Children.Add(separator, yConstraint: Constraint.RelativeToView(skipLabel, (parent, view) => view.Y - 10), widthConstraint: Constraint.RelativeToParent(parent => parent.Width)); return(layout); }
void AddConstraintsToChildren() { Func <RelativeLayout, double> getNewUserButtonWidth = (p) => newUserSignUpButton.Measure(layout.Width, layout.Height).Request.Width; Func <RelativeLayout, double> getForgotButtonWidth = (p) => forgotPasswordButton.Measure(layout.Width, layout.Height).Request.Width; Func <RelativeLayout, double> getLogoSloganWidth = (p) => logoSlogan.Measure(layout.Width, layout.Height).Request.Width; Func <RelativeLayout, double> getRememberMeWidth = (p) => rememberMe.Measure(layout.Width, layout.Height).Request.Width; Func <RelativeLayout, double> getRememberMeHeight = (p) => rememberMe.Measure(layout.Width, layout.Height).Request.Height; Func <RelativeLayout, double> getSwitchWidth = (p) => saveUsername.Measure(layout.Width, layout.Height).Request.Width; layout.Children.Add( logo, xConstraint: Constraint.Constant(100), yConstraint: Constraint.Constant(250), widthConstraint: Constraint.RelativeToParent(p => p.Width - 200) ); layout.Children.Add( logoSlogan, xConstraint: Constraint.RelativeToParent(p => (p.Width / 2) - (getLogoSloganWidth(p) / 2)), yConstraint: Constraint.RelativeToView(logo, (p, v) => 250 - (p.Height * 0.3) + v.Height) ); layout.Children.Add( loginEntry, xConstraint: Constraint.Constant(40), yConstraint: Constraint.RelativeToParent(p => p.Height * 0.4), widthConstraint: Constraint.RelativeToParent(p => p.Width - 80) ); layout.Children.Add( passwordEntry, xConstraint: Constraint.Constant(40), yConstraint: Constraint.RelativeToView(loginEntry, (p, v) => v.Y + v.Height + 10), widthConstraint: Constraint.RelativeToParent(p => p.Width - 80) ); layout.Children.Add( rememberMe, xConstraint: Constraint.RelativeToParent(p => p.Width - 40 - getSwitchWidth(p) - getRememberMeWidth(p) - 20), yConstraint: Constraint.RelativeToView(passwordEntry, (p, v) => v.Y + v.Height + 25 + getRememberMeHeight(p) / 2) ); layout.Children.Add( saveUsername, xConstraint: Constraint.RelativeToParent(p => p.Width - 40 - getSwitchWidth(p)), yConstraint: Constraint.RelativeToView(passwordEntry, (p, v) => v.Y + v.Height + 25) ); layout.Children.Add( loginButton, xConstraint: Constraint.Constant(40), yConstraint: Constraint.RelativeToView(saveUsername, (p, v) => v.Y + v.Height + 25), widthConstraint: Constraint.RelativeToParent(p => p.Width - 80) ); layout.Children.Add( forgotPasswordButton, xConstraint: Constraint.RelativeToParent(p => (p.Width / 2) - (getForgotButtonWidth(p) / 2)), yConstraint: Constraint.RelativeToParent(p => p.Height - 50) ); layout.Children.Add( newUserSignUpButton, xConstraint: Constraint.RelativeToParent(p => (p.Width / 2) - (getNewUserButtonWidth(p) / 2)), yConstraint: Constraint.RelativeToView(forgotPasswordButton, (p, v) => v.Y - v.Height) ); }