public TextSpan(Span span) { BackgroundColor = span.BackgroundColor; FontAttributes = span.FontAttributes; FontFamily = span.FontFamily; FontSize = span.FontSize; ForegroundColor = span.ForegroundColor; Text = span.Text; }
public Span(Xamarin.Forms.Span span) { _innerSpan = span; // important for triggering property inheritance from parent Label this.BackgroundColor = this._innerSpan.BackgroundColor; this.FontSize = this._innerSpan.FontSize; this.FontAttributes = this._innerSpan.FontAttributes; this.FontFamily = this._innerSpan.FontFamily; this.ForegroundColor = this._innerSpan.ForegroundColor; this.Text = this._innerSpan.Text ?? ""; }
public int GetChildIndex(XF.Element child) { // There are two cases to consider: // 1. A Xamarin.Forms Label can have only 1 child (a FormattedString), so the child's index is always 0. // 2. But to simplify things, in MobileBlazorBindings a Label can contain a Span directly, so if the child // is a Span, we have to compute its sibling index. return(child switch { XF.Span span => LabelControl.FormattedText?.Spans.IndexOf(span) ?? -1, XF.FormattedString formattedString when LabelControl.FormattedText == formattedString => 0, _ => - 1 });
internal static bool HasDefaultFont(this Xamarin.Forms.Span element) { if (element.FontFamily != null || element.FontAttributes != FontAttributes.None) { return(false); } var getNamedSize = typeof(Device).GetRuntimeMethod("GetNamedSize", new Type[] { typeof(NamedSize), typeof(Type), typeof(bool) }); if (getNamedSize != null) { var result = (double)getNamedSize.Invoke(null, new object[] { NamedSize.Default, typeof(Label), true }); return(result == element.FontSize); } return(false); }
public static Run ToRun(this Xamarin.Forms.Span span) { var run = new Run { Text = span.Text }; if (span.ForegroundColor != Color.Default) { run.Foreground = span.ForegroundColor.ToBrush(); } if (!span.HasDefaultFont()) { #pragma warning disable 618 run.ApplyFont(span.Font); #pragma warning restore 618 } return(run); }
public FinalInformate(MasterDetailPage masterDetail) { ToolbarItems.Add(new ToolbarItem(){Icon="pazosicon.png"}); this.Title = "Acciones ahorradoras"; master = masterDetail; RelativeLayout layout = new RelativeLayout (); //Colocar background var imgBackground = new Image () { Source = ImageSource.FromResource ("PaZos.Resources.FondoLogin.png"), Aspect = Aspect.AspectFill }; layout.Children.Add (imgBackground, Constraint.Constant (0), Constraint.Constant (0), Constraint.RelativeToParent ((Parent) => { return Parent.Width; }), Constraint.RelativeToParent ((Parent) => { return Parent.Height; })); //Fin Colocar background var imgmensaje = new Image () { Source = ImageSource.FromResource ("PaZos.Resources.FinalInformate.png"), Aspect = Aspect.AspectFill }; layout.Children.Add (imgmensaje, Constraint.Constant (0), Constraint.Constant (0), Constraint.RelativeToParent ((Parent) => { return Parent.Width; }), Constraint.RelativeToParent ((Parent) => { return Parent.Height; })); int y = 75; int factor = 375; Label lbtextotitulo = new Label (); lbtextotitulo.HorizontalOptions = LayoutOptions.CenterAndExpand; lbtextotitulo.XAlign = TextAlignment.Center; lbtextotitulo.TextColor = Color.Red; var fstitulo = new FormattedString (); Span sptitulo = new Span () { Text = "¡Infórmate!", FontFamily = "Noteworthy-Bold", FontSize=28 }; fstitulo.Spans.Add (sptitulo); lbtextotitulo.FormattedText = fstitulo; layout.Children.Add (lbtextotitulo, Constraint.Constant (50), Constraint.RelativeToParent ((Parent) => { return Parent.Width*75/factor; }), Constraint.RelativeToParent ((Parent) => { return Parent.Width-100; }), Constraint.RelativeToParent ((Parent) => { return 40; })); Label lbtexto = new Label (); lbtexto.HorizontalOptions = LayoutOptions.CenterAndExpand; lbtexto.XAlign = TextAlignment.Center; var fs = new FormattedString (); Span sp2 = new Span () { Text = "Organiza tus finanzas personales y las de tu negocio y protege tus ahorros en un banco.", FontFamily = "MyriadPro-Bold", FontSize=16 }; fs.Spans.Add (sp2); lbtexto.FormattedText = fs; layout.Children.Add (lbtexto, Constraint.Constant (50), Constraint.RelativeToParent ((Parent) => { return Parent.Width*125/factor; }), Constraint.RelativeToParent ((Parent) => { return Parent.Width-100; }), Constraint.RelativeToParent ((Parent) => { return 80; })); Content = layout; }
public Span() { _span = new Xamarin.Forms.Span(); }
public Cumplio(MasterDetailPage masterDetail, Usuario tusuario) { usuario = tusuario; var guardaritem = new ToolbarItem { Text = "Continuar" }; guardaritem.Clicked += (object sender, System.EventArgs e) => { continuar(); }; //ToolbarItems.Add(new ToolbarItem(){Icon="pazosicon.png"}); ToolbarItems.Add(guardaritem); this.Title = "Acciones ahorradoras"; master = masterDetail; RelativeLayout layout = new RelativeLayout (); //Colocar background var imgBackground = new Image () { Source = ImageSource.FromResource ("PaZos.Resources.FondoLogin.png"), Aspect = Aspect.AspectFill }; layout.Children.Add (imgBackground, Constraint.Constant (0), Constraint.Constant (0), Constraint.RelativeToParent ((Parent) => { return Parent.Width; }), Constraint.RelativeToParent ((Parent) => { return Parent.Height; })); //Fin Colocar background var imgmensaje = new Image () { Source = ImageSource.FromResource ("PaZos.Resources.cumplio.png"), Aspect = Aspect.AspectFit }; layout.Children.Add (imgmensaje, Constraint.Constant (0), Constraint.Constant (0), Constraint.RelativeToParent ((Parent) => { return Parent.Width; }), Constraint.RelativeToParent ((Parent) => { return Parent.Height; })); Label lbtexto = new Label (); lbtexto.HorizontalOptions = LayoutOptions.CenterAndExpand; lbtexto.XAlign = TextAlignment.Center; var fs = new FormattedString (); int y = 75; int factor = 375; Span sp2 = new Span () { Text = "¿Cumpliste con tus acciones ahorradoras?", FontFamily = "MyriadPro-Bold", FontSize=16 }; fs.Spans.Add (sp2); lbtexto.FormattedText = fs; layout.Children.Add (lbtexto, Constraint.Constant (45), Constraint.RelativeToParent ((Parent) => { return Parent.Width*75/factor; }), Constraint.RelativeToParent ((Parent) => { return Parent.Width-90; }), Constraint.RelativeToParent ((Parent) => { return 40; })); y = y + 60; slino = new Switch () { }; layout.Children.Add (slino, Constraint.RelativeToParent ((Parent) => { return Parent.Width/2-15; }), Constraint.RelativeToParent ((Parent) => { return Parent.Width*135/factor; }), Constraint.RelativeToParent ((Parent) => { return 60; }), Constraint.RelativeToParent ((Parent) => { return 60; })); Label lblno = new Label () { Text="No", Font = Font.OfSize("TwCenMT-Condensed",18) }; layout.Children.Add (lblno, Constraint.RelativeToParent ((Parent) => { return Parent.Width/2-60; }), Constraint.RelativeToParent ((Parent) => { return Parent.Width*140/factor; }), Constraint.RelativeToParent ((Parent) => { return 60; }), Constraint.RelativeToParent ((Parent) => { return 60; })); Label lblsi = new Label () { Text="Si", Font = Font.OfSize("TwCenMT-Condensed",18) }; layout.Children.Add (lblsi, Constraint.RelativeToParent ((Parent) => { return Parent.Width/2+60; }), Constraint.RelativeToParent ((Parent) => { return Parent.Width*140/factor; }), Constraint.RelativeToParent ((Parent) => { return 60; }), Constraint.RelativeToParent ((Parent) => { return 60; })); y = y + 100; Label lbtexto3 = new Label (); lbtexto3.HorizontalOptions = LayoutOptions.CenterAndExpand; lbtexto3.XAlign = TextAlignment.Center; var fs3 = new FormattedString (); Span sp3 = new Span () { Text = "Guarda y protege tu dinero en un lugar seguro, ¿estás ahorrando en un banco?", FontFamily = "MyriadPro-Regular", FontSize=16 }; fs3.Spans.Add (sp3); lbtexto3.FormattedText = fs3; layout.Children.Add (lbtexto3, Constraint.Constant (40), Constraint.RelativeToParent ((Parent) => { return Parent.Width*250/factor; }), Constraint.RelativeToParent ((Parent) => { return Parent.Width-80; }), Constraint.RelativeToParent ((Parent) => { return 80; })); Content = layout; }
public Animo(MasterDetailPage masterDetail, Usuario tusuario) { usuario = tusuario; var guardaritem = new ToolbarItem { Text = "Continuar" }; guardaritem.Clicked += (object sender, System.EventArgs e) => { continuar(); }; //ToolbarItems.Add(new ToolbarItem(){Icon="pazosicon.png"}); ToolbarItems.Add(guardaritem); this.Title = "Acciones ahorradoras"; master = masterDetail; RelativeLayout layout = new RelativeLayout (); //Colocar background var imgBackground = new Image () { Source = ImageSource.FromResource ("PaZos.Resources.FondoLogin.png"), Aspect = Aspect.AspectFill }; layout.Children.Add (imgBackground, Constraint.Constant (0), Constraint.Constant (0), Constraint.RelativeToParent ((Parent) => { return Parent.Width; }), Constraint.RelativeToParent ((Parent) => { return Parent.Height; })); //Fin Colocar background var imgmensaje = new Image () { Source = ImageSource.FromResource ("PaZos.Resources.Animo.png"), Aspect = Aspect.AspectFit }; layout.Children.Add (imgmensaje, Constraint.Constant (0), Constraint.Constant (0), Constraint.RelativeToParent ((Parent) => { return Parent.Width; }), Constraint.RelativeToParent ((Parent) => { return Parent.Height; })); int y = 75; int factor = 375; Label lbtextotitulo = new Label (); lbtextotitulo.HorizontalOptions = LayoutOptions.CenterAndExpand; lbtextotitulo.XAlign = TextAlignment.Center; lbtextotitulo.TextColor = Color.Red; var fstitulo = new FormattedString (); Span sptitulo = new Span () { Text = "¡Ánimo!", FontFamily = "Noteworthy-Bold", FontSize=28 }; fstitulo.Spans.Add (sptitulo); lbtextotitulo.FormattedText = fstitulo; layout.Children.Add (lbtextotitulo, Constraint.Constant (50), Constraint.RelativeToParent ((Parent) => { return Parent.Width*75/factor; }), Constraint.RelativeToParent ((Parent) => { return Parent.Width-100; }), Constraint.RelativeToParent ((Parent) => { return 40; })); Label lbtexto = new Label (); lbtexto.HorizontalOptions = LayoutOptions.CenterAndExpand; lbtexto.XAlign = TextAlignment.Center; var fs = new FormattedString (); Span sp3 = new Span () { Text = "Revisa tus acciones, mañana tienes otra oportunidad de ahorrar más.", FontFamily = "MyriadPro-Bold", FontSize=16 }; fs.Spans.Add (sp3); lbtexto.FormattedText = fs; layout.Children.Add (lbtexto, Constraint.Constant (50), Constraint.RelativeToParent ((Parent) => { return Parent.Width*125/factor; }), Constraint.RelativeToParent ((Parent) => { return Parent.Width-100; }), Constraint.RelativeToParent ((Parent) => { return 80; })); Content = layout; }
public LayoutQuienyQue() { string foto = new Fotos ().fotoaleatoria(); var imgfoto = new Image () { Source = ImageSource.FromResource (foto), Aspect = Aspect.AspectFill }; this.Children.Add (imgfoto, Constraint.Constant (0), Constraint.Constant (2), Constraint.RelativeToParent ((Parent) => { return 50; }), Constraint.RelativeToParent ((Parent) => { return 50; })); StackLayout labeltit = new StackLayout (); Label label = new Label () { FontSize=12 }; label.HorizontalOptions = LayoutOptions.FillAndExpand; label.XAlign = TextAlignment.Start; var fs = new FormattedString (); Span sp1 = new Span () { Text = "Jonatahan Ivan Vargas Gómez", FontAttributes = FontAttributes.Bold, FontSize=12 }; fs.Spans.Add (sp1); Span sp2 = new Span () { Text = " compartió la ", FontSize=12 }; fs.Spans.Add (sp2); Span sp3 = new Span () { Text = "foto", FontAttributes = FontAttributes.Bold, FontSize=12 }; fs.Spans.Add (sp3); Span sp4 = new Span () { Text = " de ", FontSize=12 }; fs.Spans.Add (sp4); Span sp5 = new Span () { Text = "Gente Inteligente IQ", FontAttributes = FontAttributes.Bold, FontSize=12 }; fs.Spans.Add (sp5); label.FormattedText = fs; labeltit.Children.Add (label); Label tiempo = new Label () { Text = "El 2 de noviembre a las 8:33 p.m.", TextColor = Color.Gray, FontSize=8 }; labeltit.Children.Add (tiempo); this.Children.Add (labeltit, Constraint.Constant (55), Constraint.Constant (2), Constraint.RelativeToParent ((Parent) => { return Parent.Width - 55; }), Constraint.RelativeToParent ((Parent) => { return 50; })); }
public layoutminicomentario() { string foto = new Fotos ().fotoaleatoria(); this.BackgroundColor = Color.FromRgb (190, 190, 190); this.Padding = new Thickness (3, 3, 3, 3); var imgfoto = new Image () { Source = ImageSource.FromResource (foto), Aspect = Aspect.AspectFill }; this.Children.Add (imgfoto, Constraint.Constant (2), Constraint.Constant (2), Constraint.RelativeToParent ((Parent) => { return 50; }), Constraint.RelativeToParent ((Parent) => { return 50; })); StackLayout labeltit = new StackLayout (); Label label = new Label () { FontSize=12 }; label.HorizontalOptions = LayoutOptions.FillAndExpand; label.XAlign = TextAlignment.Start; var fs = new FormattedString (); Span sp1 = new Span () { Text = "#ShielEnsony", FontAttributes = FontAttributes.Bold, FontSize=12 }; fs.Spans.Add (sp1); Span sp2 = new Span () { Text = "\n bit.ly ", FontSize=12 }; fs.Spans.Add (sp2); Span sp3 = new Span () { Text = "\nEl nuevo inhumano se enamor...", FontSize=12 }; fs.Spans.Add (sp3); label.FormattedText = fs; labeltit.Children.Add (label); Label tiempo = new Label () { Text = "El 2 de noviembre a las 8:33 p.m.", TextColor = Color.Gray, FontSize=8 }; labeltit.Children.Add (tiempo); this.Children.Add (labeltit, Constraint.Constant (57), Constraint.Constant (2), Constraint.RelativeToParent ((Parent) => { return Parent.Width - 57; }), Constraint.RelativeToParent ((Parent) => { return 60; })); }
public Metas (MasterDetailPage masterDetail, Usuario tusuario) { usuario = tusuario; var guardaritem = new ToolbarItem { Text = "Guardar" }; guardaritem.Clicked += (object sender, System.EventArgs e) => { guardarMetas(); }; //ToolbarItems.Add(new ToolbarItem(){Icon="pazosicon.png"}); ToolbarItems.Add(guardaritem); this.Title = "Metas"; //this.Icon = "Resources/menuicon.png"; //cargarImagenes (); master = masterDetail; RelativeLayout layout = new RelativeLayout (); //Colocar background var imgBackground = new Image () { Source = ImageSource.FromResource ("PaZos.Resources.FondoAcciones.png"), Aspect = Aspect.AspectFill }; layout.Children.Add (imgBackground, Constraint.Constant (0), Constraint.Constant (0), Constraint.RelativeToParent ((Parent) => { return Parent.Width; }), Constraint.RelativeToParent ((Parent) => { return Parent.Height; })); Label lblTitle = new Label () { Text = "¿Para qué quieres ahorrar?", FontSize = 20, FontFamily = "MyriadPro-Bold", HorizontalOptions=LayoutOptions.Center, XAlign= TextAlignment.Center }; layout.Children.Add (lblTitle, Constraint.Constant (20), Constraint.Constant (5), Constraint.RelativeToParent ((Parent) => { return Parent.Width-40; }), Constraint.RelativeToParent ((Parent) => { return 50; })); Label lbtexto = new Label (); lbtexto.HorizontalOptions = LayoutOptions.CenterAndExpand; lbtexto.XAlign = TextAlignment.Center; var fs = new FormattedString (); Span sp1 = new Span () { Text = "Ingresa aquí, en orden de prioridad, 3 ", FontFamily = "MyriadPro-Regular", FontSize=13 }; fs.Spans.Add (sp1); Span sp2 = new Span () { Text = " metas especificas de ahorro.", FontFamily = "MyriadPro-Regular", FontSize=13 }; fs.Spans.Add (sp2); Span sp3 = new Span () { Text = " Define si tus metas son ", FontFamily = "MyriadPro-Regular", FontSize=13 }; fs.Spans.Add (sp3); Span sp4 = new Span () { Text = "personales, ", FontFamily = "MyriadPro-Bold", FontSize=13 }; fs.Spans.Add (sp4); Span sp5 = new Span () { Text = " o para tu ", FontFamily = "MyriadPro-Regular", FontSize=13 }; fs.Spans.Add (sp5); Span sp6 = new Span () { Text = "emprendimiento", FontFamily = "MyriadPro-Bold", FontSize=13 }; fs.Spans.Add (sp6); lbtexto.FormattedText = fs; layout.Children.Add (lbtexto, Constraint.Constant (20), Constraint.Constant (22), Constraint.RelativeToParent ((Parent) => { return Parent.Width-40; }), Constraint.RelativeToParent ((Parent) => { return 80; })); int y = 80; int y2 = y; y = y - 7; pkTipoMeta = new AsisprinPicker () { Title = "Tipo de meta" }; layout.Children.Add (pkTipoMeta, Constraint.Constant (199), Constraint.Constant (y+22), Constraint.RelativeToParent ((Parent) => { return ParentView.Width-199-20; }), Constraint.RelativeToParent ((Parent) => { return 30; })); y = y + 52 + 3; entmeta = new ExtendedEntry () { Placeholder = "Escribe tu meta", Font = Font.OfSize("TwCenMT-Condensed",26) }; layout.Children.Add (entmeta, Constraint.Constant (20), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return Parent.Width-40; }), Constraint.RelativeToParent ((Parent) => { return 40; })); Image imgMeta1 = new Image () { Aspect = Aspect.AspectFill, Source = ImageSource.FromResource ("PaZos.Resources.Metas.btnmeta1.png") }; layout.Children.Add (imgMeta1, Constraint.Constant (20), Constraint.Constant (y2), Constraint.RelativeToParent ((Parent) => { return 175; }), Constraint.RelativeToParent ((Parent) => { return 52; })); var lbMeta1 = new Label() { Text = "Meta 1", TextColor = Color.White, FontSize=26, FontFamily = "MyriadPro-Bold", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center }; layout.Children.Add (lbMeta1, Constraint.Constant (70), Constraint.Constant (y2+13), Constraint.RelativeToParent ((Parent) => { return 175; }), Constraint.RelativeToParent ((Parent) => { return 52; })); y = y + 40 + 2; entvalor = new ExtendedEntry() { Placeholder = "$", Font = Font.OfSize("TwCenMT-Condensed",26), XAlign= TextAlignment.End }; entvalor.Unfocused += (object sender, FocusEventArgs e) => { double valor; if (!Double.TryParse(entvalor.Text, out valor)) { DisplayAlert("Meta 1", "Valor no es numérico", "Corregir"); }else{ if(Convert.ToDouble(entvalor.Text)>100000){ enviamensaje(); } } }; entvalor.Behaviors.Add (new NumberValidatorBehavior ()); layout.Children.Add (entvalor, Constraint.Constant (20), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/2-30; }), Constraint.RelativeToParent ((Parent) => { return 40; })); Label lbinicia = new Label () { Text = "Inicia", FontSize = 14, FontFamily = "TwCenMT-Condensed", }; layout.Children.Add (lbinicia, Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/2+5+20-30; }), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/4-5+15; }), Constraint.RelativeToParent ((Parent) => { return 10; })); dtinicio = new AsisprinDatePicker () { VerticalOptions = LayoutOptions.Center, Format = "dd/MM/yyyy", }; layout.Children.Add (dtinicio, Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/2+5+20-30; }), Constraint.Constant (y+10), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/4-5+15; }), Constraint.RelativeToParent ((Parent) => { return 30; })); Label lbTermina = new Label () { Text = "Termina", FontSize = 14, FontFamily = "TwCenMT-Condensed", }; layout.Children.Add (lbTermina, Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/4*3+5+20-15; }), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/4-5+15; }), Constraint.RelativeToParent ((Parent) => { return 10; })); dtfinal = new AsisprinDatePicker () { VerticalOptions = LayoutOptions.Center, Format = "dd/MM/yyyy" }; layout.Children.Add (dtfinal, Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/4*3+5+20-15; }), Constraint.Constant (y+10), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/4-5+15; }), Constraint.RelativeToParent ((Parent) => { return 30; })); y = y + 40 + 2; pkTipoAhorro = new AsisprinPicker () { Title = "Tipo de ahorro" }; layout.Children.Add (pkTipoAhorro, Constraint.Constant (20), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return 150; }), Constraint.RelativeToParent ((Parent) => { return 30; })); // Dictionary to get Color from color name. Dictionary<string, int> tiposMetas = new Dictionary<string, int> { { "Emprendimiento", 1 }, { "Personal", 2 } }; //Picker picker = new Picker //{ // Title = "Tipo de meta", // VerticalOptions = LayoutOptions.CenterAndExpand //}; //stk1.Children.Add (picker); y = y + 30 + 10; y2 = y; y = y - 7; pkTipoMeta2 = new AsisprinPicker () { Title = "Tipo de meta" }; layout.Children.Add (pkTipoMeta2, Constraint.Constant (199), Constraint.Constant (y+22), Constraint.RelativeToParent ((Parent) => { return ParentView.Width-199-20; }), Constraint.RelativeToParent ((Parent) => { return 30; })); y = y + 52 + 3; entmeta2 = new ExtendedEntry () { Placeholder = "Escribe tu meta", Font = Font.OfSize("TwCenMT-Condensed",26) }; layout.Children.Add (entmeta2, Constraint.Constant (20), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return Parent.Width-40; }), Constraint.RelativeToParent ((Parent) => { return 40; })); y = y + 40 + 2; entvalor2 = new ExtendedEntry() { Placeholder = "$", Font = Font.OfSize("TwCenMT-Condensed",26), XAlign= TextAlignment.End }; entvalor2.Behaviors.Add (new NumberValidatorBehavior ()); layout.Children.Add (entvalor2, Constraint.Constant (20), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/2-30; }), Constraint.RelativeToParent ((Parent) => { return 40; })); entvalor2.Unfocused += (object sender, FocusEventArgs e) => { double valor; if (!Double.TryParse(entvalor2.Text, out valor)) { DisplayAlert("Meta 2", "Valor no es numérico", "Corregir"); }else{ if(Convert.ToDouble(entvalor2.Text)>100000){ enviamensaje(); } } }; Image imgMeta2 = new Image () { Aspect = Aspect.AspectFill, Source= ImageSource.FromResource ("PaZos.Resources.Metas.btmeta2.png") }; layout.Children.Add (imgMeta2, Constraint.Constant (20), Constraint.Constant (y2), Constraint.RelativeToParent ((Parent) => { return 175; }), Constraint.RelativeToParent ((Parent) => { return 52; })); var lbMeta2 = new Label() { Text = "Meta 2", TextColor = Color.White, FontSize=26, FontFamily = "MyriadPro-Bold", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center }; layout.Children.Add (lbMeta2, Constraint.Constant (70), Constraint.Constant (y2+13), Constraint.RelativeToParent ((Parent) => { return 175; }), Constraint.RelativeToParent ((Parent) => { return 52; })); Label lbinicia2 = new Label () { Text = "Inicia", FontSize = 14, FontFamily = "TwCenMT-Condensed", }; layout.Children.Add (lbinicia2, Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/2+5+20-30; }), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/4-5+15; }), Constraint.RelativeToParent ((Parent) => { return 10; })); dtinicio2 = new AsisprinDatePicker () { VerticalOptions = LayoutOptions.Center, Format = "dd/MM/yyyy" }; layout.Children.Add (dtinicio2, Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/2+5+20-30; }), Constraint.Constant (y+10), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/4-5+15; }), Constraint.RelativeToParent ((Parent) => { return 30; })); Label lbTermina2 = new Label () { Text = "Termina", FontSize = 14, FontFamily = "TwCenMT-Condensed", }; layout.Children.Add (lbTermina2, Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/4*3+5+20-15; }), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/4-5+15; }), Constraint.RelativeToParent ((Parent) => { return 10; })); dtfinal2 = new AsisprinDatePicker () { VerticalOptions = LayoutOptions.Center, Format = "dd/MM/yyyy" }; layout.Children.Add (dtfinal2, Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/4*3+5+20-15; }), Constraint.Constant (y+10), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/4-5+15; }), Constraint.RelativeToParent ((Parent) => { return 30; })); y = y + 40 + 2; pkTipoAhorro2 = new AsisprinPicker () { Title = "Tipo de ahorro" }; layout.Children.Add (pkTipoAhorro2, Constraint.Constant (20), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return 150; }), Constraint.RelativeToParent ((Parent) => { return 30; })); y = y + 30+10; y2 = y; y = y - 7; pkTipoMeta3 = new AsisprinPicker () { Title = "Tipo de meta" }; layout.Children.Add (pkTipoMeta3, Constraint.Constant (199), Constraint.Constant (y+22), Constraint.RelativeToParent ((Parent) => { return ParentView.Width-199-20; }), Constraint.RelativeToParent ((Parent) => { return 30; })); y = y + 52 + 3; entmeta3 = new ExtendedEntry () { Placeholder = "Escribe tu meta", Font = Font.OfSize("TwCenMT-Condensed",26) }; layout.Children.Add (entmeta3, Constraint.Constant (20), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return Parent.Width-40; }), Constraint.RelativeToParent ((Parent) => { return 40; })); Image imgMeta3 = new Image () { Aspect = Aspect.AspectFill, Source= ImageSource.FromResource ("PaZos.Resources.Metas.btnmeta3.png") }; layout.Children.Add (imgMeta3, Constraint.Constant (20), Constraint.Constant (y2), Constraint.RelativeToParent ((Parent) => { return 175; }), Constraint.RelativeToParent ((Parent) => { return 52; })); var lbMeta3 = new Label() { Text = "Meta 3", TextColor = Color.White, FontSize=26, FontFamily = "MyriadPro-Bold", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center }; layout.Children.Add (lbMeta3, Constraint.Constant (70), Constraint.Constant (y2+13), Constraint.RelativeToParent ((Parent) => { return 175; }), Constraint.RelativeToParent ((Parent) => { return 52; })); y = y + 40 + 2; entvalor3 = new ExtendedEntry() { Placeholder = "$", Font = Font.OfSize("TwCenMT-Condensed",26), XAlign= TextAlignment.End }; entvalor3.Behaviors.Add (new NumberValidatorBehavior ()); layout.Children.Add (entvalor3, Constraint.Constant (20), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/2-30; }), Constraint.RelativeToParent ((Parent) => { return 40; })); entvalor3.Unfocused += (object sender, FocusEventArgs e) => { double valor; if (!Double.TryParse(entvalor3.Text, out valor)) { DisplayAlert("Meta 3", "Valor no es numérico", "Corregir"); }else{ if(Convert.ToDouble(entvalor3.Text)>100000){ enviamensaje(); } } }; Label lbinicia3 = new Label () { Text = "Inicia", FontSize = 14, FontFamily = "TwCenMT-Condensed", }; layout.Children.Add (lbinicia3, Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/2+5+20-30; }), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/4-5+15; }), Constraint.RelativeToParent ((Parent) => { return 10; })); dtinicio3 = new AsisprinDatePicker () { VerticalOptions = LayoutOptions.Center, Format = "dd/MM/yyyy" }; layout.Children.Add (dtinicio3, Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/2+5+20-30; }), Constraint.Constant (y+10), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/4-5+15; }), Constraint.RelativeToParent ((Parent) => { return 30; })); Label lbTermina3 = new Label () { Text = "Termina", FontSize = 14, FontFamily = "TwCenMT-Condensed", }; layout.Children.Add (lbTermina3, Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/4*3+5+20-15; }), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/4-5+15; }), Constraint.RelativeToParent ((Parent) => { return 10; })); dtfinal3 = new AsisprinDatePicker () { VerticalOptions = LayoutOptions.Center, Format = "dd/MM/yyyy" }; layout.Children.Add (dtfinal3, Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/4*3+5+20-15; }), Constraint.Constant (y+10), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-40)/4-5+15; }), Constraint.RelativeToParent ((Parent) => { return 30; })); y = y + 40 + 2; pkTipoAhorro3 = new AsisprinPicker () { Title = "Tipo de ahorro" }; layout.Children.Add (pkTipoAhorro3, Constraint.Constant (20), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return 150; }), Constraint.RelativeToParent ((Parent) => { return 30; })); Label lbespacio = new Label () { Text = " " }; layout.Children.Add (lbespacio, Constraint.Constant (20), Constraint.Constant (y+30), Constraint.RelativeToParent ((Parent) => { return 150; }), Constraint.RelativeToParent ((Parent) => { return 10; })); foreach (string tipoMeta in tiposMetas.Keys) { pkTipoMeta.Items.Add (tipoMeta); pkTipoMeta2.Items.Add (tipoMeta); pkTipoMeta3.Items.Add (tipoMeta); } // Dictionary to get Color from color name. Dictionary<string, int> tiposAhorro = new Dictionary<string, int> { { "Ahorro diario", 1 }, { "Ahorro semanal", 2 }, { "Ahorro mensual", 3 } }; foreach (string tipoAhorro in tiposAhorro.Keys) { pkTipoAhorro.Items.Add (tipoAhorro); pkTipoAhorro2.Items.Add (tipoAhorro); pkTipoAhorro3.Items.Add (tipoAhorro); } ScrollView scrollview = new ScrollView { Content = layout }; Content = scrollview; cargarMetas (); }
public AccionesMensaje2 (MasterDetailPage masterDetail, Usuario tusuario) { usuario = tusuario; ToolbarItems.Add(new ToolbarItem(){Icon="pazosicon.png"}); this.Title = "Acciones ahorradoras"; master = masterDetail; RelativeLayout layout = new RelativeLayout (); //Colocar background var imgBackground = new Image () { Source = ImageSource.FromResource ("PaZos.Resources.FondoAcciones.png"), Aspect = Aspect.AspectFill }; layout.Children.Add (imgBackground, Constraint.Constant (0), Constraint.Constant (0), Constraint.RelativeToParent ((Parent) => { return Parent.Width; }), Constraint.RelativeToParent ((Parent) => { return Parent.Height; })); //Fin Colocar background var imgmensaje = new Image () { Source = ImageSource.FromResource ("PaZos.Resources.Accionesmensaje2.png"), Aspect = Aspect.AspectFit }; layout.Children.Add (imgmensaje, Constraint.Constant (0), Constraint.Constant (0), Constraint.RelativeToParent ((Parent) => { return Parent.Width; }), Constraint.RelativeToParent ((Parent) => { return Parent.Height; })); Label lbtexto = new Label (); lbtexto.HorizontalOptions = LayoutOptions.CenterAndExpand; lbtexto.XAlign = TextAlignment.Center; var fs = new FormattedString (); int y = 45; Span sp2 = new Span () { Text = "Si haces todas tus acciones, esta semana ahorrarías", FontFamily = "MyriadPro-Bold", FontSize=16 }; fs.Spans.Add (sp2); lbtexto.FormattedText = fs; layout.Children.Add (lbtexto, Constraint.Constant (45), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return Parent.Width-90; }), Constraint.RelativeToParent ((Parent) => { return 40; })); y = y + 38 + 5; valor = new ExtendedEntry () { Font = Font.OfSize("TwCenMT-Condensed",26), XAlign= TextAlignment.Center, IsEnabled=false }; layout.Children.Add (valor, Constraint.Constant (75), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return Parent.Width-150; }), Constraint.RelativeToParent ((Parent) => { return 30; })); y = y + 35; Label lbtextoB = new Label (); lbtextoB.HorizontalOptions = LayoutOptions.CenterAndExpand; lbtextoB.XAlign = TextAlignment.Center; var fsB = new FormattedString (); Span spB = new Span () { Text = "Si mantines estos hábitos de", FontFamily = "MyriadPro-Bold", FontSize=16 }; fsB.Spans.Add (spB); lbtextoB.FormattedText = fsB; layout.Children.Add (lbtextoB, Constraint.Constant (45), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return Parent.Width-90; }), Constraint.RelativeToParent ((Parent) => { return 30; })); y = y + 35; Label lbtextoC = new Label (); lbtextoC.HorizontalOptions = LayoutOptions.CenterAndExpand; var fsC = new FormattedString (); Span spC = new Span () { Text = "ahorro, en ", FontFamily = "MyriadPro-Bold", FontSize=16 }; fsC.Spans.Add (spC); lbtextoC.FormattedText = fsC; layout.Children.Add (lbtextoC, Constraint.Constant (45), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return Parent.Width-90; }), Constraint.RelativeToParent ((Parent) => { return 30; })); numero = new ExtendedEntry () { Font = Font.OfSize("TwCenMT-Condensed",26), XAlign= TextAlignment.Center, IsEnabled=false }; layout.Children.Add (numero, Constraint.Constant (125), Constraint.Constant (y-5), Constraint.RelativeToParent ((Parent) => { return 40; }), Constraint.RelativeToParent ((Parent) => { return 30; })); meses = new ExtendedEntry () { Font = Font.OfSize("TwCenMT-Condensed",26), XAlign= TextAlignment.Center, IsEnabled=false }; layout.Children.Add (meses, Constraint.Constant (170), Constraint.Constant (y-5), Constraint.RelativeToParent ((Parent) => { return 90; }), Constraint.RelativeToParent ((Parent) => { return 30; })); y = y + 35; Label lbtextoD = new Label (); lbtextoD.HorizontalOptions = LayoutOptions.CenterAndExpand; lbtextoD.XAlign = TextAlignment.Center; var fsD = new FormattedString (); Span spD = new Span () { Text = "alcanzarías tus metas.", FontFamily = "MyriadPro-Bold", FontSize=16 }; fsD.Spans.Add (spD); lbtextoD.FormattedText = fsD; layout.Children.Add (lbtextoD, Constraint.Constant (45), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return Parent.Width-90; }), Constraint.RelativeToParent ((Parent) => { return 30; })); Content = layout; cargarMensaje (); }
public SpanHandler(NativeComponentRenderer renderer, XF.Span spanControl) : base(renderer, spanControl) { SpanControl = spanControl ?? throw new ArgumentNullException(nameof(spanControl)); }
public layoutnotificacion() { this.BackgroundColor = Color.FromRgb(219,219,219); this.Padding = new Thickness (3, 3, 3, 3); string foto = new Fotos ().fotoaleatoria(); var imgfoto = new Image () { Source = ImageSource.FromResource (foto), Aspect = Aspect.AspectFill }; this.Children.Add (imgfoto, Constraint.Constant (0), Constraint.Constant (2), Constraint.RelativeToParent ((Parent) => { return 50; }), Constraint.RelativeToParent ((Parent) => { return 50; })); StackLayout labeltit = new StackLayout (); Label label = new Label () { FontSize=12 }; label.HorizontalOptions = LayoutOptions.FillAndExpand; label.XAlign = TextAlignment.Start; var fs = new FormattedString (); Span sp1 = new Span () { Text = "Jonatahan Ivan Vargas Gómez", FontAttributes = FontAttributes.Bold, FontSize=12 }; fs.Spans.Add (sp1); Span sp2 = new Span () { Text = " publicó en ", FontSize=12 }; fs.Spans.Add (sp2); Span sp3 = new Span () { Text = "La comunidad", FontAttributes = FontAttributes.Bold, FontSize=12 }; fs.Spans.Add (sp3); Span sp4 = new Span () { Text = " de ", FontSize=12 }; fs.Spans.Add (sp4); Span sp5 = new Span () { Text = "viajes interesantes", FontAttributes = FontAttributes.Bold, FontSize=12 }; fs.Spans.Add (sp5); label.FormattedText = fs; labeltit.Children.Add (label); Label tiempo = new Label () { Text = "El 2 de noviembre a las 8:33 p.m.", TextColor = Color.Gray, FontSize=8 }; labeltit.Children.Add (tiempo); this.Children.Add (labeltit, Constraint.Constant (55), Constraint.Constant (2), Constraint.RelativeToParent ((Parent) => { return Parent.Width - 55; }), Constraint.RelativeToParent ((Parent) => { return 50; })); }
public Preguntas(MasterDetailPage masterDetail, Usuario tusuario) { master = masterDetail; var guardaritem = new ToolbarItem { Text = "Continuar" }; guardaritem.Clicked += (object sender, System.EventArgs e) => { continuar(); }; //ToolbarItems.Add(new ToolbarItem(){Icon="pazosicon.png"}); ToolbarItems.Add(guardaritem); this.Title = "¿Qué vas a hacer con tus ahorros?"; tusuario = usuario; var imgBackground = new Image () { Source = ImageSource.FromResource ("PaZos.Resources.FondoLogin.png"), Aspect = Aspect.AspectFill }; RelativeLayout layoutcontent = new RelativeLayout (); layoutcontent.Children.Add (imgBackground, Constraint.Constant (0), Constraint.Constant (0), Constraint.RelativeToParent ((Parent) => { return Parent.Width; }), Constraint.RelativeToParent ((Parent) => { return Parent.Height; })); int y=30; int altura = 60; BoxView boxViewnegro = new BoxView { Color = Color.Black }; layoutcontent.Children.Add (boxViewnegro, Constraint.Constant (19), Constraint.Constant (y-11), Constraint.RelativeToParent ((Parent) => { return Parent.Width-38; }), Constraint.RelativeToParent ((Parent) => { return altura*5+22; })); BoxView boxView = new BoxView { Color = Color.White }; layoutcontent.Children.Add (boxView, Constraint.Constant (20), Constraint.Constant (y-10), Constraint.RelativeToParent ((Parent) => { return Parent.Width-40; }), Constraint.RelativeToParent ((Parent) => { return altura*5+20; })); Label A1 = new Label () { Text = "1.", TextColor = Color.Red, FontFamily = "MyriadPro-Bold", FontSize=26 }; layoutcontent.Children.Add (A1, Constraint.Constant (30), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return 30; }), Constraint.RelativeToParent ((Parent) => { return 30; })); Label B1 = new Label () { HorizontalOptions = LayoutOptions.StartAndExpand }; var B1fs = new FormattedString (); Span B1sp = new Span () { Text = "¿Tienes una cuenta de ahorros?", FontFamily = "MyriadPro-Regular", FontSize=18 }; B1fs.Spans.Add (B1sp); B1.FormattedText = B1fs; layoutcontent.Children.Add (B1, Constraint.Constant (60), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return Parent.Width-60-30-60; }), Constraint.RelativeToParent ((Parent) => { return altura; })); C1 = new Switch () { }; layoutcontent.Children.Add (C1, Constraint.RelativeToParent ((Parent) => { return Parent.Width-60-30; }), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return 30; }), Constraint.RelativeToParent ((Parent) => { return 30; })); y = y + 60; Label A2 = new Label () { Text = "2.", TextColor = Color.Red, FontFamily = "MyriadPro-Bold", FontSize=26 }; layoutcontent.Children.Add (A2, Constraint.Constant (30), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return 30; }), Constraint.RelativeToParent ((Parent) => { return 30; })); Label B2 = new Label () { HorizontalOptions = LayoutOptions.StartAndExpand }; var B2fs = new FormattedString (); Span B2sp = new Span () { Text = "¿Sabés que es un CDT?", FontFamily = "MyriadPro-Regular", FontSize=18 }; B2fs.Spans.Add (B2sp); B2.FormattedText = B2fs; layoutcontent.Children.Add (B2, Constraint.Constant (60), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return Parent.Width-60-30-60; }), Constraint.RelativeToParent ((Parent) => { return altura; })); C2 = new Switch () { }; layoutcontent.Children.Add (C2, Constraint.RelativeToParent ((Parent) => { return Parent.Width-60-30; }), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return 30; }), Constraint.RelativeToParent ((Parent) => { return 30; })); y = y + 60; Label A3 = new Label () { Text = "3.", TextColor = Color.Red, FontFamily = "MyriadPro-Bold", FontSize=26 }; layoutcontent.Children.Add (A3, Constraint.Constant (30), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return 30; }), Constraint.RelativeToParent ((Parent) => { return 30; })); Label B3 = new Label () { HorizontalOptions = LayoutOptions.StartAndExpand }; var B3fs = new FormattedString (); Span B3sp = new Span () { Text = "¿Estás ahorrando las utilidades de tu negocio en un banco?", FontFamily = "MyriadPro-Regular", FontSize=18 }; B3fs.Spans.Add (B3sp); B3.FormattedText = B3fs; layoutcontent.Children.Add (B3, Constraint.Constant (60), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return Parent.Width-60-30-60; }), Constraint.RelativeToParent ((Parent) => { return altura; })); C3 = new Switch () { }; layoutcontent.Children.Add (C3, Constraint.RelativeToParent ((Parent) => { return Parent.Width-60-30; }), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return 30; }), Constraint.RelativeToParent ((Parent) => { return 30; })); y = y + 60; Label A4 = new Label () { Text = "4.", TextColor = Color.Red, FontFamily = "MyriadPro-Bold", FontSize=26 }; layoutcontent.Children.Add (A4, Constraint.Constant (30), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return 30; }), Constraint.RelativeToParent ((Parent) => { return 30; })); Label B4 = new Label () { HorizontalOptions = LayoutOptions.StartAndExpand }; var B4fs = new FormattedString (); Span B4sp = new Span () { Text = "¿Irías a un banco para pedir información sobre cómo ahorrar?", FontFamily = "MyriadPro-Regular", FontSize=18 }; B4fs.Spans.Add (B4sp); B4.FormattedText = B4fs; layoutcontent.Children.Add (B4, Constraint.Constant (60), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return Parent.Width-60-30-60; }), Constraint.RelativeToParent ((Parent) => { return altura; })); C4 = new Switch () { }; layoutcontent.Children.Add (C4, Constraint.RelativeToParent ((Parent) => { return Parent.Width-60-30; }), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return 30; }), Constraint.RelativeToParent ((Parent) => { return 30; })); y = y + 60; Label A5 = new Label () { Text = "5.", TextColor = Color.Red, FontFamily = "MyriadPro-Bold", FontSize=26 }; layoutcontent.Children.Add (A5, Constraint.Constant (30), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return 30; }), Constraint.RelativeToParent ((Parent) => { return 30; })); Label B5 = new Label () { HorizontalOptions = LayoutOptions.StartAndExpand }; var B5fs = new FormattedString (); Span B5sp = new Span () { Text = "¿Conoces los servicios virtuales de tu banco?", FontFamily = "MyriadPro-Regular", FontSize=18 }; B5fs.Spans.Add (B5sp); B5.FormattedText = B5fs; layoutcontent.Children.Add (B5, Constraint.Constant (60), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return Parent.Width-60-30-60; }), Constraint.RelativeToParent ((Parent) => { return altura; })); C5 = new Switch () { }; layoutcontent.Children.Add (C5, Constraint.RelativeToParent ((Parent) => { return Parent.Width-60-30; }), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return 30; }), Constraint.RelativeToParent ((Parent) => { return 30; })); // Build the page. Content = layoutcontent; }
public acciones(MasterDetailPage masterDetail,Usuario tusuario) { usuario = tusuario; ToolbarItems.Add(new ToolbarItem(){Icon="pazosicon.png"}); this.Title = "Acciones ahorradoras"; master = masterDetail; RelativeLayout layout = new RelativeLayout (); //Colocar background var imgBackground = new Image () { Source = ImageSource.FromResource ("PaZos.Resources.FondoAcciones.png"), Aspect = Aspect.AspectFill }; layout.Children.Add (imgBackground, Constraint.Constant (0), Constraint.Constant (0), Constraint.RelativeToParent ((Parent) => { return Parent.Width; }), Constraint.RelativeToParent ((Parent) => { return Parent.Height; })); //Fin Colocar background //Dias var imgDias = new Image () { Source = ImageSource.FromResource ("PaZos.Resources.mujer.png"), Aspect = Aspect.AspectFit }; layout.Children.Add (imgDias, Constraint.Constant (0), Constraint.RelativeToParent ((Parent) => { return Parent.Width/375*80; }), Constraint.RelativeToParent ((Parent) => { return Parent.Width/375*150; }), Constraint.RelativeToParent ((Parent) => { return Parent.Height-(Parent.Width/375*80); })); //End Dias Label lblTitle = new Label () { Text = "¿Cuánto debes ahorrar para cumplir tus metas?", FontSize = 20, FontFamily = "MyriadPro-Bold", HorizontalOptions=LayoutOptions.Center, XAlign= TextAlignment.Center }; layout.Children.Add (lblTitle, Constraint.Constant (20), Constraint.Constant (5), Constraint.RelativeToParent ((Parent) => { return Parent.Width-40; }), Constraint.RelativeToParent ((Parent) => { return 50; })); Label lbtexto = new Label (); lbtexto.HorizontalOptions = LayoutOptions.CenterAndExpand; lbtexto.XAlign = TextAlignment.Center; var fs = new FormattedString (); Span sp1 = new Span () { Text = "Ingresa en este calendario las ", FontFamily = "MyriadPro-Regular", FontSize=13 }; fs.Spans.Add (sp1); Span sp2 = new Span () { Text = "acciones ahorradoras", FontFamily = "MyriadPro-Bold", FontSize=13 }; fs.Spans.Add (sp2); Span sp3 = new Span () { Text = " que puedes hacer cada día de la semana.", FontFamily = "MyriadPro-Regular", FontSize=13 }; fs.Spans.Add (sp3); lbtexto.FormattedText = fs; layout.Children.Add (lbtexto, Constraint.Constant (20), Constraint.Constant (52), Constraint.RelativeToParent ((Parent) => { return Parent.Width-40; }), Constraint.RelativeToParent ((Parent) => { return 80; })); double y = 120, yinicial; yinicial = y; int gap; int hoy = 0; int alto = 40; gap = alto + 10; int espacio = alto*2+20+15; int x = 79; var imglunes = new Image () { Source = ImageSource.FromResource ("PaZos.Resources.Dias.lunes.png"), }; layout.Children.Add (imglunes, Constraint.RelativeToParent ((Parent) => { if(hoy==1){ return 10; }else{ return Parent.Width/2 - Parent.Width/375*x; } }), Constraint.RelativeToParent ((Parent) => { return Parent.Width/375*y; }), Constraint.RelativeToParent ((Parent) => { return 250; }), Constraint.RelativeToParent ((Parent) => { return alto; })); var lblunes = new Button () { Text = "", TextColor = Color.White, //BackgroundColor = Color.Blue }; lblunes.Clicked += (sender, args) => { Selected(1); }; layout.Children.Add (lblunes, Constraint.RelativeToParent ((Parent) => { if(hoy==1){ return 10; }else{ return Parent.Width/2 - Parent.Width/375*x; } }), Constraint.RelativeToParent ((Parent) => { return Parent.Width/375*y; }), Constraint.RelativeToParent ((Parent) => { return 250; }), Constraint.RelativeToParent ((Parent) => { return alto; })); //martes var imgmartes = new Image () { Source = ImageSource.FromResource ("PaZos.Resources.Dias.martes.png"), }; layout.Children.Add (imgmartes, Constraint.RelativeToParent ((Parent) => { if(hoy==2){ return 10; }else{ return Parent.Width/2 - Parent.Width/375*x; } }), Constraint.RelativeToParent ((Parent) => { return Parent.Width/375*(y+gap); }), Constraint.RelativeToParent ((Parent) => { return 250; }), Constraint.RelativeToParent ((Parent) => { return alto; })); var lbmartes = new Button () { Text = "", TextColor = Color.White, //BackgroundColor = Color.Blue }; lbmartes.Clicked += (sender, args) => { Selected(2); }; layout.Children.Add (lbmartes, Constraint.RelativeToParent ((Parent) => { if(hoy==2){ return 10; }else{ return Parent.Width/2 - Parent.Width/375*x; } }), Constraint.RelativeToParent ((Parent) => { return Parent.Width/375*(y+gap); }), Constraint.RelativeToParent ((Parent) => { return 250; }), Constraint.RelativeToParent ((Parent) => { return alto; })); //miercoles var imgmiercoles = new Image () { Source = ImageSource.FromResource ("PaZos.Resources.Dias.miercoles.png"), }; layout.Children.Add (imgmiercoles, Constraint.RelativeToParent ((Parent) => { if(hoy==3){ return 10; }else{ return Parent.Width/2 - Parent.Width/375*x; } }), Constraint.RelativeToParent ((Parent) => { return Parent.Width/375*(y+gap*2); }), Constraint.RelativeToParent ((Parent) => { return 250; }), Constraint.RelativeToParent ((Parent) => { return alto; })); var lbmiercoles = new Button () { Text = "", TextColor = Color.White, //BackgroundColor = Color.Blue }; lbmiercoles.Clicked += (sender, args) => { Selected(3); }; layout.Children.Add (lbmiercoles, Constraint.RelativeToParent ((Parent) => { if(hoy==3){ return 10; }else{ return Parent.Width/2 - Parent.Width/375*x; } }), Constraint.RelativeToParent ((Parent) => { return Parent.Width/375*(y+gap*2); }), Constraint.RelativeToParent ((Parent) => { return 250; }), Constraint.RelativeToParent ((Parent) => { return alto; })); //jueves var imgjueves = new Image () { Source = ImageSource.FromResource ("PaZos.Resources.Dias.Jueves.png"), }; layout.Children.Add (imgjueves, Constraint.RelativeToParent ((Parent) => { if(hoy==4){ return 10; }else{ return Parent.Width/2 - Parent.Width/375*x; } }), Constraint.RelativeToParent ((Parent) => { return Parent.Width/375*(y+gap*3); }), Constraint.RelativeToParent ((Parent) => { return 250; }), Constraint.RelativeToParent ((Parent) => { return alto; })); var lbjueves = new Button () { Text = "", TextColor = Color.White, //BackgroundColor = Color.Blue }; lbjueves.Clicked += (sender, args) => { Selected(4); }; layout.Children.Add (lbjueves, Constraint.RelativeToParent ((Parent) => { if(hoy==4){ return 10; }else{ return Parent.Width/2 - Parent.Width/375*x; } }), Constraint.RelativeToParent ((Parent) => { return Parent.Width/375*(y+gap*3); }), Constraint.RelativeToParent ((Parent) => { return 250; }), Constraint.RelativeToParent ((Parent) => { return alto; })); //viernes var imgviernes = new Image () { Source = ImageSource.FromResource ("PaZos.Resources.Dias.Viernes.png") }; layout.Children.Add (imgviernes, Constraint.RelativeToParent ((Parent) => { if(hoy==5){ return 10; }else{ return Parent.Width/2 - Parent.Width/375*x; } }), Constraint.RelativeToParent ((Parent) => { return Parent.Width/375*(y+gap*4); }), Constraint.RelativeToParent ((Parent) => { return 250; }), Constraint.RelativeToParent ((Parent) => { return alto; })); var lbviernes = new Button () { Text = "", TextColor = Color.White, //BackgroundColor = Color.Blue }; lbviernes.Clicked += (sender, args) => { Selected(5); }; layout.Children.Add (lbviernes, Constraint.RelativeToParent ((Parent) => { if(hoy==5){ return 10; }else{ return Parent.Width/2 - Parent.Width/375*x; } }), Constraint.RelativeToParent ((Parent) => { return Parent.Width/375*(y+gap*4); }), Constraint.RelativeToParent ((Parent) => { return 250; }), Constraint.RelativeToParent ((Parent) => { return alto; })); //sabado var imgsabado = new Image () { Source = ImageSource.FromResource ("PaZos.Resources.Dias.Sabado.png") }; layout.Children.Add (imgsabado, Constraint.RelativeToParent ((Parent) => { if(hoy==6){ return 10; }else{ return Parent.Width/2 - Parent.Width/375*x; } }), Constraint.RelativeToParent ((Parent) => { return Parent.Width/375*(y+gap*5); }), Constraint.RelativeToParent ((Parent) => { return 250; }), Constraint.RelativeToParent ((Parent) => { return alto; })); var lbsabado = new Button () { Text = "", TextColor = Color.White, //BackgroundColor = Color.Blue }; lbsabado.Clicked += (sender, args) => { Selected(6); }; layout.Children.Add (lbsabado, Constraint.RelativeToParent ((Parent) => { if(hoy==6){ return 10; }else{ return Parent.Width/2 - Parent.Width/375*x; } }), Constraint.RelativeToParent ((Parent) => { return Parent.Width/375*(y+gap*5); }), Constraint.RelativeToParent ((Parent) => { return 250; }), Constraint.RelativeToParent ((Parent) => { return alto; })); //domingo var imgdomingo = new Image () { Source = ImageSource.FromResource ("PaZos.Resources.Dias.Domingo.png") }; layout.Children.Add (imgdomingo, Constraint.RelativeToParent ((Parent) => { if(hoy==7){ return 10; }else{ return Parent.Width/2 - Parent.Width/375*x; } }), Constraint.RelativeToParent ((Parent) => { return Parent.Width/375*(y+gap*6); }), Constraint.RelativeToParent ((Parent) => { return 250; }), Constraint.RelativeToParent ((Parent) => { return alto; })); var lbdomingo = new Button () { Text = "", TextColor = Color.White, //BackgroundColor = Color.Blue }; lbdomingo.Clicked += (sender, args) => { Selected(7); }; layout.Children.Add (lbdomingo, Constraint.RelativeToParent ((Parent) => { if(hoy==7){ return 10; }else{ return Parent.Width/2 - Parent.Width/375*x; } }), Constraint.RelativeToParent ((Parent) => { return Parent.Width/375*(y+gap*6); }), Constraint.RelativeToParent ((Parent) => { return 250; }), Constraint.RelativeToParent ((Parent) => { return alto; })); /* int x = 118; int y = 152; int gap = 62; int factor = 375; var lblunes = new Button () { Text = "", TextColor = Color.White, //BackgroundColor = Color.Blue }; lblunes.Clicked += (sender, args) => { Selected(1); }; layout.Children.Add (lblunes, Constraint.Constant (x), Constraint.RelativeToParent ((Parent) => { return Parent.Width*y/factor; }), Constraint.RelativeToParent ((Parent) => { return 250; }), Constraint.RelativeToParent ((Parent) => { return 40; })); //martes var lbmartes = new Button () { Text = "", TextColor = Color.White, //BackgroundColor = Color.Blue }; lbmartes.Clicked += (sender, args) => { Selected(2); }; layout.Children.Add (lbmartes, Constraint.Constant (x), Constraint.RelativeToParent ((Parent) => { return Parent.Width*(y+gap)/factor; }), Constraint.RelativeToParent ((Parent) => { return 250; }), Constraint.RelativeToParent ((Parent) => { return 40; })); //miercoles var lbmiercoles = new Button () { Text = "", TextColor = Color.White, //BackgroundColor = Color.Blue }; lbmiercoles.Clicked += (sender, args) => { Selected(3); }; layout.Children.Add (lbmiercoles, Constraint.Constant (x), Constraint.RelativeToParent ((Parent) => { return Parent.Width*(y+gap*2)/factor; }), Constraint.RelativeToParent ((Parent) => { return 250; }), Constraint.RelativeToParent ((Parent) => { return 40; })); //jueves var lbjueves = new Button () { Text = "", TextColor = Color.White, //BackgroundColor = Color.Blue }; lbjueves.Clicked += (sender, args) => { Selected(4); }; layout.Children.Add (lbjueves, Constraint.Constant (x), Constraint.RelativeToParent ((Parent) => { return Parent.Width*(y+gap*3)/factor; }), Constraint.RelativeToParent ((Parent) => { return 250; }), Constraint.RelativeToParent ((Parent) => { return 40; })); //viernes var lbviernes = new Button () { Text = "", TextColor = Color.White, //BackgroundColor = Color.Blue }; lbviernes.Clicked += (sender, args) => { Selected(5); }; layout.Children.Add (lbviernes, Constraint.Constant (x), Constraint.RelativeToParent ((Parent) => { return Parent.Width*(y+gap*4)/factor; }), Constraint.RelativeToParent ((Parent) => { return 250; }), Constraint.RelativeToParent ((Parent) => { return 40; })); //sabado var lbsabado = new Button () { Text = "", TextColor = Color.White, //BackgroundColor = Color.Blue }; lbsabado.Clicked += (sender, args) => { Selected(6); }; layout.Children.Add (lbsabado, Constraint.Constant (x), Constraint.RelativeToParent ((Parent) => { return Parent.Width*(y+gap*5)/factor; }), Constraint.RelativeToParent ((Parent) => { return 250; }), Constraint.RelativeToParent ((Parent) => { return 40; })); //domingo var lbdomingo = new Button () { Text = "", TextColor = Color.White, //BackgroundColor = Color.Blue }; lbdomingo.Clicked += (sender, args) => { Selected(7); }; layout.Children.Add (lbdomingo, Constraint.Constant (x), Constraint.RelativeToParent ((Parent) => { return Parent.Width*(y+gap*6)/factor; }), Constraint.RelativeToParent ((Parent) => { return 250; }), Constraint.RelativeToParent ((Parent) => { return 40; })); */ Content = layout; }
public LayoutAmigos() { this.BackgroundColor = Color.White; this.Padding = new Thickness (3, 3, 3, 3); string foto = new Fotos ().fotoaleatoria(); var imgfoto = new Image () { Source = ImageSource.FromResource (foto), Aspect = Aspect.AspectFill }; this.Children.Add (imgfoto, Constraint.Constant (0), Constraint.Constant (2), Constraint.RelativeToParent ((Parent) => { return 50; }), Constraint.RelativeToParent ((Parent) => { return 50; })); StackLayout labeltit = new StackLayout (); Label label = new Label () { FontSize=12 }; label.HorizontalOptions = LayoutOptions.FillAndExpand; label.XAlign = TextAlignment.Start; var fs = new FormattedString (); Span sp1 = new Span () { Text = "Jonatahan Ivan Vargas Gómez", FontAttributes = FontAttributes.Bold, FontSize=12 }; fs.Spans.Add (sp1); label.FormattedText = fs; labeltit.Children.Add (label); this.Children.Add (labeltit, Constraint.Constant (55), Constraint.Constant (2), Constraint.RelativeToParent ((Parent) => { return Parent.Width - 55; }), Constraint.RelativeToParent ((Parent) => { return 50; })); ExtendedButton btnconfirmar = new ExtendedButton () { Text = "Confirmar", TextColor = Color.White, BackgroundColor = Color.FromRgb(96, 178, 54) }; this.Children.Add (btnconfirmar, Constraint.Constant (55), Constraint.Constant (20), Constraint.RelativeToParent ((Parent) => { return (Parent.Width - 55)/2-10; }), Constraint.RelativeToParent ((Parent) => { return 30; })); ExtendedButton btneliminar = new ExtendedButton () { Text = "Eliminar", TextColor = Color.White, BackgroundColor = Color.FromRgb(96, 178, 54) }; this.Children.Add (btneliminar, Constraint.RelativeToParent ((Parent) => { return (Parent.Width - 55)/2+55; }), Constraint.Constant (20), Constraint.RelativeToParent ((Parent) => { return (Parent.Width - 55)/2-10; }), Constraint.RelativeToParent ((Parent) => { return 30; })); }
public AccionesMensaje1(MasterDetailPage masterDetail) { ToolbarItems.Add(new ToolbarItem(){Icon="pazosicon.png"}); this.Title = "Acciones ahorradoras"; master = masterDetail; RelativeLayout layout = new RelativeLayout (); //Colocar background var imgBackground = new Image () { Source = ImageSource.FromResource ("PaZos.Resources.FondoAcciones.png"), Aspect = Aspect.AspectFill }; layout.Children.Add (imgBackground, Constraint.Constant (0), Constraint.Constant (0), Constraint.RelativeToParent ((Parent) => { return Parent.Width; }), Constraint.RelativeToParent ((Parent) => { return Parent.Height; })); //Fin Colocar background //Colocar background var imgBackground2 = new Image () { Source = ImageSource.FromResource ("PaZos.Resources.accionesmensaje1.png"), Aspect = Aspect.AspectFit }; layout.Children.Add (imgBackground2, Constraint.Constant (0), Constraint.Constant (0), Constraint.RelativeToParent ((Parent) => { return Parent.Width; }), Constraint.RelativeToParent ((Parent) => { return Parent.Height; })); //Fin Colocar background Label lbtexto = new Label (); lbtexto.HorizontalOptions = LayoutOptions.CenterAndExpand; lbtexto.XAlign = TextAlignment.Center; var fs = new FormattedString (); Span sp1 = new Span () { Text = "¡Tu meta de ahorro es muy importante! es buena idea que guardes el dinero en un lugar seguro y que haga crecer tus ahorros. Acércate a un ", FontFamily = "MyriadPro-Regular", FontSize=16 }; fs.Spans.Add (sp1); Span sp2 = new Span () { Text = "banco", FontFamily = "MyriadPro-Bold", FontSize=16 }; fs.Spans.Add (sp2); Span sp3 = new Span () { Text = ", o visita su ", FontFamily = "MyriadPro-Regular", FontSize=16 }; fs.Spans.Add (sp3); Span sp4 = new Span () { Text = "página web", FontFamily = "MyriadPro-Bold", FontSize=16 }; fs.Spans.Add (sp4); Span sp5 = new Span () { Text = " para conocer sus servicios de ahorro.", FontFamily = "MyriadPro-Regular", FontSize=16 }; fs.Spans.Add (sp5); lbtexto.FormattedText = fs; layout.Children.Add (lbtexto, Constraint.RelativeToParent ((Parent) => { return Parent.Width*50/375; }), Constraint.RelativeToParent ((Parent) => { return Parent.Width*40/375; }), Constraint.RelativeToParent ((Parent) => { return Parent.Width-(Parent.Width*100/375); }), Constraint.RelativeToParent ((Parent) => { return 160; })); Content = layout; }