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 Registro (ILoginManager ilm) { this.Title = "Registro"; 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; })); BoxView bv = new BoxView () { BackgroundColor = Color.FromRgb(232,78,27) }; layout.Children.Add (bv, Constraint.Constant (0), Constraint.Constant (0), Constraint.RelativeToParent ((Parent) => { return Parent.Width; }), Constraint.RelativeToParent ((Parent) => { return 60; })); Label titulo = new Label () { Text="Registro", FontSize = 24, FontFamily = "TwCenMT-Condensed", TextColor = Color.White, HorizontalOptions=LayoutOptions.Center, XAlign= TextAlignment.Center }; layout.Children.Add (titulo, Constraint.Constant (0), Constraint.Constant (25), Constraint.RelativeToParent ((Parent) => { return Parent.Width; }), Constraint.RelativeToParent ((Parent) => { return 60; })); var logo = new Image () { Source = ImageSource.FromResource ("PaZos.Resources.pazosicon.png"), Aspect = Aspect.AspectFill }; layout.Children.Add (logo, Constraint.Constant (15), Constraint.Constant (15), Constraint.RelativeToParent ((Parent) => { return 40; }), Constraint.RelativeToParent ((Parent) => { return 40; })); int alto = 35; int ytemp = 70; var txtNombre = new ExtendedEntry () { Placeholder="Nombre", BackgroundColor = Color.White, Font = Font.OfSize("TwCenMT-Condensed",18), HasBorder=true }; txtNombre.Behaviors.Add (new MaxLengthValidator { MaxLength = 40 }); layout.Children.Add (txtNombre, Constraint.Constant (50), Constraint.Constant (ytemp), Constraint.RelativeToParent ((Parent) => { return Parent.Width-100; }), Constraint.RelativeToParent ((Parent) => { return alto; })); ytemp = ytemp + alto; var txtApellido = new ExtendedEntry () { Placeholder="Apellido", BackgroundColor = Color.White, Font = Font.OfSize("TwCenMT-Condensed",18), HasBorder=true }; layout.Children.Add (txtApellido, Constraint.Constant (50), Constraint.Constant (ytemp), Constraint.RelativeToParent ((Parent) => { return Parent.Width-100; }), Constraint.RelativeToParent ((Parent) => { return alto; })); txtApellido.Behaviors.Add (new MaxLengthValidator { MaxLength = 40 }); ytemp = ytemp + alto+10; var txtCorreo = new ExtendedEntry () { Placeholder="Correo electrónico", BackgroundColor = Color.White, Font = Font.OfSize("TwCenMT-Condensed",18), HasBorder=true }; layout.Children.Add (txtCorreo, Constraint.Constant (50), Constraint.Constant (ytemp), Constraint.RelativeToParent ((Parent) => { return Parent.Width-100; }), Constraint.RelativeToParent ((Parent) => { return alto; })); txtCorreo.Behaviors.Add (new EmailValidatorBehavior()); ytemp = ytemp + alto; var txtUsuario = new ExtendedEntry () { Placeholder="Usuario (Nombre para mostrar)", BackgroundColor = Color.White, Font = Font.OfSize("TwCenMT-Condensed",18), HasBorder=true }; layout.Children.Add (txtUsuario, Constraint.Constant (50), Constraint.Constant (ytemp), Constraint.RelativeToParent ((Parent) => { return Parent.Width-100; }), Constraint.RelativeToParent ((Parent) => { return alto; })); txtUsuario.Behaviors.Add (new MaxLengthValidator { MaxLength = 12 }); ytemp = ytemp + alto+10; var txtclave = new ExtendedEntry () { Placeholder="Contraseña", BackgroundColor = Color.White, Font = Font.OfSize("TwCenMT-Condensed",18), HasBorder=true, IsPassword=true }; layout.Children.Add (txtclave, Constraint.Constant (50), Constraint.Constant (ytemp), Constraint.RelativeToParent ((Parent) => { return Parent.Width-100; }), Constraint.RelativeToParent ((Parent) => { return alto; })); txtclave.Behaviors.Add (new MaxLengthValidator { MaxLength = 12 }); ytemp = ytemp + alto; var txtclave2 = new ExtendedEntry () { Placeholder="Repetir contraseña", BackgroundColor = Color.White, Font = Font.OfSize("TwCenMT-Condensed",18), HasBorder=true, IsPassword=true }; layout.Children.Add (txtclave2, Constraint.Constant (50), Constraint.Constant (ytemp), Constraint.RelativeToParent ((Parent) => { return Parent.Width-100; }), Constraint.RelativeToParent ((Parent) => { return alto; })); txtclave2.Behaviors.Add (new MaxLengthValidator { MaxLength = 12 }); ytemp = ytemp + alto+10; var txtedad = new AsisprinPicker () { Title="Edad", BackgroundColor = Color.White }; int i = 12; while (i<60) { txtedad.Items.Add(i.ToString()); i++; } layout.Children.Add (txtedad, Constraint.Constant (50), Constraint.Constant (ytemp), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-100)/2-5; }), Constraint.RelativeToParent ((Parent) => { return alto; })); var pksexo = new AsisprinPicker () { Title="Sexo", BackgroundColor = Color.White }; Dictionary<string, int> tiposexo = new Dictionary<string, int> { { "Masculino", 1 }, { "Femenino", 2 }, { "LGBTI", 3 } }; foreach (string tSexo in tiposexo.Keys) { pksexo.Items.Add(tSexo); } layout.Children.Add (pksexo, Constraint.RelativeToParent ((Parent) => { return (Parent.Width/2)+5; }), Constraint.Constant (ytemp), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-100)/2-5; }), Constraint.RelativeToParent ((Parent) => { return alto; })); ytemp = ytemp + alto+10; pkPais = new AsisprinPicker () { Title="Pais", BackgroundColor = Color.White }; pkPais.SelectedIndex = 1; layout.Children.Add (pkPais, Constraint.Constant (50), Constraint.Constant (ytemp), Constraint.RelativeToParent ((Parent) => { return Parent.Width-100; }), Constraint.RelativeToParent ((Parent) => { return alto; })); pkPais.SelectedIndexChanged += (object sender, EventArgs e) => { ListarDepartamentos (); }; ytemp = ytemp + alto; pkDepartamento = new AsisprinPicker () { Title="Departamento", BackgroundColor = Color.White }; layout.Children.Add (pkDepartamento, Constraint.Constant (50), Constraint.Constant (ytemp), Constraint.RelativeToParent ((Parent) => { return Parent.Width-100; }), Constraint.RelativeToParent ((Parent) => { return alto; })); pkDepartamento.SelectedIndexChanged += (object sender, EventArgs e) => { ListarCiudades (); }; ytemp = ytemp + alto; pkCiudad = new AsisprinPicker () { Title="Ciudad o municipio", BackgroundColor = Color.White }; layout.Children.Add (pkCiudad, Constraint.Constant (50), Constraint.Constant (ytemp), Constraint.RelativeToParent ((Parent) => { return Parent.Width-100; }), Constraint.RelativeToParent ((Parent) => { return alto; })); ytemp = ytemp + alto+10; var button = new Button { Text = "Registrar usuario", BackgroundColor = Color.Gray, TextColor = Color.White, Font = Font.OfSize("TwCenMT-Condensed",22) }; button.Clicked += (sender, e) => { /*if (txtNombre.Text=="" || txtNombre.Text == null){ DisplayActionSheet("Resgistro sin completar","Cancelar","ok",null); return; }*/ Usuario Ruser = new Usuario(); Ruser.nombre = txtNombre.Text; Ruser.apellidos = txtApellido.Text; Ruser.correo = txtCorreo.Text; Ruser.ciudad = pkCiudad.SelectedIndex; Ruser.contrasena=txtclave.Text; Ruser.departamento=pkDepartamento.SelectedIndex; Ruser.genero=pksexo.SelectedIndex; Ruser.edad=txtedad.SelectedIndex; Ruser.ocupacion=""; Ruser.pais=pkPais.SelectedIndex; Ruser.usuario=txtUsuario.Text; registrausuario(Ruser); //DisplayAlert("Cuenta creada", "Add processing login here", "OK"); ilm.ShowLogin(txtUsuario.Text); }; layout.Children.Add (button, Constraint.Constant (50), Constraint.Constant (ytemp), Constraint.RelativeToParent ((Parent) => { return Parent.Width-100; }), Constraint.RelativeToParent ((Parent) => { return alto; })); /* ytemp = ytemp + alto+10; var lbmen1 = new Label () { Text = "Si continúas, aceptas las", VerticalOptions = LayoutOptions.Center }; layout.Children.Add (lbmen1, Constraint.Constant (50), Constraint.Constant (ytemp), Constraint.RelativeToParent ((Parent) => { return Parent.Width-100; }), Constraint.RelativeToParent ((Parent) => { return 50; })); ytemp = ytemp + 20; var lbmen2 = new Label () { Text = "condiciones de uso de la aplicación", VerticalOptions = LayoutOptions.Center, Font = Font.OfSize("TwCenMT-Condensed",22) }; layout.Children.Add (lbmen2, Constraint.Constant (50), Constraint.Constant (ytemp), Constraint.RelativeToParent ((Parent) => { return Parent.Width-100; }), Constraint.RelativeToParent ((Parent) => { return 50; })); ytemp = ytemp + 20; var lbmen3 = new Label () { Text = "y la política de privacidad.", VerticalOptions = LayoutOptions.Center, Font = Font.OfSize("TwCenMT-Condensed",22) }; layout.Children.Add (lbmen3, Constraint.Constant (50), Constraint.Constant (ytemp), Constraint.RelativeToParent ((Parent) => { return Parent.Width-100; }), Constraint.RelativeToParent ((Parent) => { return 50; })); var cancel = new Button { Text = "Cancel" }; cancel.Clicked += (sender, e) => { MessagingCenter.Send<ContentPage> (this, "Login"); }; */ ScrollView scrollview = new ScrollView { Content = layout }; Content = scrollview; /*new StackLayout { Padding = new Thickness (10, 40, 10, 10), Children = { imgBackground, new Label { Text = "Create Account", Font = Font.SystemFontOfSize(NamedSize.Large) }, new Label { Text = "Choose a Username" }, new Entry { Text = "" }, new Label { Text = "Password" }, new Entry { Text = "" }, new Label { Text = "Re-enter Password" }, new Entry { Text = "" }, button, cancel } };*/ }
public progreso (MasterDetailPage masterDetail, Usuario tusuario) { ToolbarItems.Add(new ToolbarItem(){Icon="pazosicon.png"}); this.Title = "Progreso"; usuario = tusuario; //this.Icon = "menuicon44.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; })); int y = 20; int y2 = y; y = y - 7; pkTipoMeta = new AsisprinPicker () { Title = "Tipo de meta", IsEnabled = false }; 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), IsEnabled=false }; 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, IsEnabled=false }; //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", IsEnabled=false }; 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", IsEnabled=false }; 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; entacumulado = new ExtendedEntry () { Font = Font.OfSize("TwCenMT-Condensed",24), XAlign = TextAlignment.End, IsEnabled=false }; layout.Children.Add (entacumulado, Constraint.Constant (20), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-50)/2; }), Constraint.RelativeToParent ((Parent) => { return 30; })); porcentaje = new ExtendedEntry () { Font = Font.OfSize("TwCenMT-Condensed",24), XAlign = TextAlignment.Center, IsEnabled=false }; layout.Children.Add (porcentaje, Constraint.RelativeToParent ((Parent) => { return (Parent.Width)/2+5; }), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-50)/2; }), 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", IsEnabled=false }; 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), IsEnabled=false }; 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, IsEnabled=false }; //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; })); 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", IsEnabled=false }; 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", IsEnabled=false }; 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; entacumulado2 = new ExtendedEntry () { Font = Font.OfSize("TwCenMT-Condensed",24), IsEnabled=false, XAlign=TextAlignment.End }; layout.Children.Add (entacumulado2, Constraint.Constant (20), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-50)/2; }), Constraint.RelativeToParent ((Parent) => { return 30; })); porcentaje2 = new ExtendedEntry () { Font = Font.OfSize("TwCenMT-Condensed",24), IsEnabled=false, XAlign=TextAlignment.Center }; layout.Children.Add (porcentaje2, Constraint.RelativeToParent ((Parent) => { return (Parent.Width)/2+5; }), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-50)/2; }), 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), IsEnabled=false }; 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, IsEnabled=false }; //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; })); 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", IsEnabled=false }; 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", IsEnabled=false }; 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; entacumulado3 = new ExtendedEntry () { Font = Font.OfSize("TwCenMT-Condensed",24), IsEnabled=false, XAlign=TextAlignment.End }; layout.Children.Add (entacumulado3, Constraint.Constant (20), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-50)/2; }), Constraint.RelativeToParent ((Parent) => { return 30; })); porcentaje3 = new ExtendedEntry () { Font = Font.OfSize("TwCenMT-Condensed",24), IsEnabled=false, XAlign = TextAlignment.Center }; layout.Children.Add (porcentaje3, Constraint.RelativeToParent ((Parent) => { return (Parent.Width)/2+5; }), Constraint.Constant (y), Constraint.RelativeToParent ((Parent) => { return (Parent.Width-50)/2; }), 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); } ScrollView scrollview = new ScrollView { Content = layout }; Content = scrollview; cargarMetas (); }