protected override void OnAppearing() { base.OnAppearing(); this.DropHabitation.OnSelected += DropHabitationSelected; this.DropTypeContrat.OnSelected += DropTypeContratSelected; this.DropSecteurActivite.OnSelected += DropSecteurActiviteSelected; this.DropSituationFamille.OnSelected += DropSituationFamilleSelected; if (Device.OS == TargetPlatform.iOS) { DropDownPicker.AddTapEvents(); DropDownPicker.OnTapFrom += OnTapFrom; } }
protected override void OnDisappearing() { if (Device.OS == TargetPlatform.iOS) { DropDownPicker.OnTapFrom -= OnTapFrom; DropDownPicker.RemoveEvents(); } this.DropHabitation.OnSelected -= DropHabitationSelected; this.DropTypeContrat.OnSelected -= DropTypeContratSelected; this.DropSecteurActivite.OnSelected -= DropSecteurActiviteSelected; this.DropSituationFamille.OnSelected -= DropSituationFamilleSelected; base.OnDisappearing(); }
public NovoCadastroPage() { Title = "Novo Cadastro"; if (TelaUtils.Orientacao == "Landscape") { _width = (int)TelaUtils.LarguraSemPixel * 0.5; } else { _width = (int)TelaUtils.LarguraSemPixel * 0.8; } ScrollView scrollMain = new ScrollView(); scrollMain.Orientation = ScrollOrientation.Vertical; scrollMain.VerticalOptions = LayoutOptions.FillAndExpand; StackLayout main = new StackLayout(); main.BackgroundColor = Color.Transparent; main.Orientation = StackOrientation.Vertical; main.VerticalOptions = LayoutOptions.StartAndExpand; main.HorizontalOptions = LayoutOptions.CenterAndExpand; StackLayout emailStack = new StackLayout() { Orientation = StackOrientation.Horizontal }; Image emailIcone = new Image() { Source = "ic_mail_black_24dp.png", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, }; var email = new Entry { Placeholder = "Email:", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.CenterAndExpand, WidthRequest = _width }; EmailValidatorBehavior SecSenhaValidator = new EmailValidatorBehavior(); email.Behaviors.Add(SecSenhaValidator); emailStack.Children.Add(emailIcone); emailStack.Children.Add(email); StackLayout nomeStack = new StackLayout() { Orientation = StackOrientation.Horizontal }; Image nomeIcone = new Image() { Source = "ic_edit_black_24dp.png", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, }; var nome = new Entry { Placeholder = "Nome:", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, WidthRequest = _width }; nomeStack.Children.Add(nomeIcone); nomeStack.Children.Add(nome); StackLayout sobrenomeStack = new StackLayout() { Orientation = StackOrientation.Horizontal }; Image sobrenomeIcone = new Image() { Source = "ic_edit_black_24dp.png", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, }; var sobreNome = new Entry { Placeholder = "Sobrenome:", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, WidthRequest = _width }; sobrenomeStack.Children.Add(sobrenomeIcone); sobrenomeStack.Children.Add(sobreNome); StackLayout tipoSexoStack = new StackLayout() { Orientation = StackOrientation.Horizontal }; Image tipoSexoIcone = new Image() { Source = "ic_wc_black_24dp.png", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, }; _Drop1 = new DropDownPicker { //WidthRequest = Device.OnPlatform(100, 120, 100), WidthRequest = _width, //HeightRequest = 25, DropDownHeight = 150, Title = "Sexo", SelectedText = "", //FontSize = Device.OnPlatform(10, 14, 10), CellHeight = 20, SelectedBackgroundColor = Color.FromRgb(0, 70, 172), SelectedTextColor = Color.White, BorderColor = Color.Purple, ArrowColor = Color.Blue }; Items(); tipoSexoStack.Children.Add(tipoSexoIcone); tipoSexoStack.Children.Add(_Drop1); StackLayout dataStack = new StackLayout() { Orientation = StackOrientation.Horizontal, Spacing = 2 }; Label dataNascimentoLabel = new Label(); dataNascimentoLabel.Text = "Data Nascimento:"; Image dataIcone = new Image() { Source = "ic_event_black_24dp.png", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, }; var dataNascimento = new DatePicker { IsVisible = true, IsEnabled = true, }; dataStack.Children.Add(dataIcone); dataStack.Children.Add(dataNascimentoLabel); dataStack.Children.Add(dataNascimento); StackLayout senhaStack = new StackLayout() { Orientation = StackOrientation.Horizontal }; Image senhaIcone = new Image() { Source = "ic_vpn_key_black_24dp.png", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, }; var senha = new Entry { Placeholder = "Senha:", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, WidthRequest = _width, }; senhaStack.Children.Add(senhaIcone); senhaStack.Children.Add(senha); StackLayout confirmarsenhaStack = new StackLayout() { Orientation = StackOrientation.Horizontal }; Image confirmarsenhaIcone = new Image() { Source = "ic_vpn_key_black_24dp.png", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, }; var confirmarsenha = new Entry { Placeholder = "Confirmar Senha:", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, WidthRequest = _width, }; confirmarsenhaStack.Children.Add(confirmarsenhaIcone); confirmarsenhaStack.Children.Add(confirmarsenha); StackLayout fotoStack = new StackLayout() { Orientation = StackOrientation.Horizontal }; _fotoPessoal = new Image() { Source = "ic_add_a_photo_48pt.png", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.CenterAndExpand, WidthRequest = TelaUtils.LarguraSemPixel * 0.4, HeightRequest = TelaUtils.LarguraSemPixel * 0.4 }; _fotoPessoal.GestureRecognizers.Add( new TapGestureRecognizer() { Command = new Command(() => { tirarFoto(); } ) }); fotoStack.Children.Add(_fotoPessoal); main.Children.Add(emailStack); main.Children.Add(nomeStack); main.Children.Add(sobrenomeStack); main.Children.Add(tipoSexoStack); main.Children.Add(dataStack); main.Children.Add(senhaStack); main.Children.Add(confirmarsenhaStack); main.Children.Add(fotoStack); scrollMain.Content = main; Content = scrollMain; }
public FormulairePage() { InitializeComponent(); restService = new RestService(); Title = "Nouveau profil"; double iosWidthRequest = 200; double androidWidthRequest = 220; double winPhoneWidthRequest = 200; float iosFontSize = 10; float androidFontSize = 14; float winPhoneFontSize = 10; this.DropSituationFamille = new DropDownPicker { //WidthRequest = Device.OnPlatform(iosWidthRequest, androidWidthRequest, winPhoneWidthRequest), HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = 40, DropDownHeight = 150, Title = "Situation familiale", SelectedText = "", FontSize = Device.OnPlatform(iosFontSize, androidFontSize, winPhoneFontSize), CellHeight = 40, SelectedBackgroundColor = Color.FromRgb(0, 70, 172), SelectedTextColor = Color.White, BorderColor = Color.Purple, ArrowColor = Color.Blue }; this.DropHabitation = new DropDownPicker { //WidthRequest = Device.OnPlatform(iosWidthRequest, androidWidthRequest, winPhoneWidthRequest), HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = 40, DropDownHeight = 150, Title = "Habitation principale", FontSize = Device.OnPlatform(iosFontSize, androidFontSize, winPhoneFontSize), CellHeight = 40, SelectedBackgroundColor = Color.FromRgb(0, 70, 172), SelectedTextColor = Color.White }; this.DropTypeContrat = new DropDownPicker { //WidthRequest = Device.OnPlatform(iosWidthRequest, androidWidthRequest, winPhoneWidthRequest), HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = 40, DropDownHeight = 150, Title = "Type de contrat", FontSize = Device.OnPlatform(iosFontSize, androidFontSize, winPhoneFontSize), CellHeight = 40, SelectedBackgroundColor = Color.FromRgb(0, 70, 172), SelectedTextColor = Color.White }; this.DropSecteurActivite = new DropDownPicker { //WidthRequest = Device.OnPlatform(iosWidthRequest, androidWidthRequest, winPhoneWidthRequest), HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = 40, DropDownHeight = 150, Title = "Secteur d'activité", FontSize = Device.OnPlatform(iosFontSize, androidFontSize, winPhoneFontSize), CellHeight = 40, SelectedBackgroundColor = Color.FromRgb(0, 70, 172), SelectedTextColor = Color.White }; var dataSituationFam = new List <string>(); dataSituationFam.Add("Aucune"); dataSituationFam.Add("Célibataire"); dataSituationFam.Add("Marié(e)"); dataSituationFam.Add("Concubin(e)"); dataSituationFam.Add("Séparé(e)"); dataSituationFam.Add("Veuf(ve)"); dataSituationFam.Add("Divorcé(e)"); var dataHabitation = new List <string>(); dataHabitation.Add("Aucune"); dataHabitation.Add("Propriétaire"); dataHabitation.Add("Locataire payant"); dataHabitation.Add("Locataire gratuit"); dataHabitation.Add("Locataire HLM"); dataHabitation.Add("Locataire meublé"); dataHabitation.Add("Logé par la famille"); dataHabitation.Add("Nomade"); var dataTypeContrat = new List <string>(); dataTypeContrat.Add("Aucun"); dataTypeContrat.Add("CDI"); dataTypeContrat.Add("CDD"); dataTypeContrat.Add("Intérim"); dataTypeContrat.Add("Autre"); var dataSecteurActiv = new List <string>(); dataSecteurActiv.Add("Pêche, Construction, Agriculture"); dataSecteurActiv.Add("Transports et communications"); dataSecteurActiv.Add("Immobilier, location et services aux entreprises"); dataSecteurActiv.Add("Commerce, réparations automobile et d'articles domestiques"); dataSecteurActiv.Add("Industrie, EDF"); dataSecteurActiv.Add("Education"); dataSecteurActiv.Add("Services collectifs, sociaux et personnels"); dataSecteurActiv.Add("Service (Santé, Administration, Ambassade)"); dataSecteurActiv.Add("Activités financières"); dataSecteurActiv.Add("Autre"); this.DropHabitation.Source = dataHabitation; this.DropTypeContrat.Source = dataTypeContrat; this.DropSecteurActivite.Source = dataSecteurActiv; this.DropSituationFamille.Source = dataSituationFam; this.Content = new ScrollView { Content = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Orientation = StackOrientation.Vertical, Padding = 20, BackgroundColor = Color.White, Children = { new Label { Text = "Situation familiale" }, this.DropSituationFamille, new Label { Text = "Habitation principale", Margin = new Thickness(0, 10, 0, 0) }, this.DropHabitation, new Label { Text = "Type de contrat", Margin = new Thickness(0, 10, 0, 0) }, this.DropTypeContrat, new Label { Text = "Secteur d'activité", Margin = new Thickness(0, 10, 0, 0) }, this.DropSecteurActivite, new Label { Text = "Profession", Margin = new Thickness(0, 10, 0, 0) }, new Entry { Keyboard = Keyboard.Default, WidthRequest = Device.OnPlatform(iosWidthRequest, androidWidthRequest, winPhoneWidthRequest) }, //this.DropProfession, new Label { Text = "Age", Margin = new Thickness(0, 10, 0, 0) }, new Entry { Keyboard = Keyboard.Numeric }, new Label { Text = "Salaire mensuel net", Margin = new Thickness(0, 10, 0, 0) }, new Entry { Keyboard = Keyboard.Numeric }, new Label { Text = "Autres revenus mensuels", Margin = new Thickness(0, 10, 0, 0) }, new Entry { Keyboard = Keyboard.Numeric }, new Label { Text = "Année d'embauche", Margin = new Thickness(0, 10, 0, 0) }, new Entry { Keyboard = Keyboard.Numeric }, new Label { Text = "Loyer/Crédit immobilier de résidence principale", Margin = new Thickness(0, 10, 0, 0) }, new Entry { Keyboard = Keyboard.Numeric }, new Label { Text = "Loyer/Crédit immobilier de résidence secondaire", Margin = new Thickness(0, 10, 0, 0) }, new Entry { Keyboard = Keyboard.Numeric }, new Label { Text = "Montant charges", Margin = new Thickness(0, 10, 0, 0) }, new Entry { Keyboard = Keyboard.Numeric }, new Label { Text = "Autres crédits", Margin = new Thickness(0, 10, 0, 0) }, montantEmpruntEntry, new Label { Text = "Nombre d'enfants", Margin = new Thickness(0, 10, 0, 0) }, nbEnfantsEntry, new Label { Text = "Nombre de personnes rattachées au dossier", Margin = new Thickness(0, 10, 0, 0) }, new Entry { Keyboard = Keyboard.Numeric }, new StackLayout { Orientation = StackOrientation.Horizontal, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.EndAndExpand, Margin = new Thickness(0, 10, 0, 0), Children = { new Button { Text = "Créer", BackgroundColor = Color.RoyalBlue, TextColor = Color.White, WidthRequest = 90, Command = new Command(async() => { newProfile = new Profile(); newProfile.situationFamiliale = DropSituationFamille.SelectedItem.ToString(); newProfile.typeContratp = DropTypeContrat.SelectedItem.ToString(); newProfile.typeHabitation = DropHabitation.SelectedItem.ToString(); newProfile.nbEnfn = nbEnfantsEntry.Text; newProfile.montantEmprunt = montantEmpruntEntry.Text; if (await restService.SaveProfileAsync(newProfile, true)) { var res = await DisplayAlert("Profil ajouté !", "Le nouveau profil a bien été sauvegardé.", null, "OK"); if (!res) { await Navigation.PopAsync(); } } else { await DisplayAlert("Erreur", "Une erreur est survenue. Veuillez vérifier tous les champs.", "OK"); } }) }, new Button { Text = "Annuler", BackgroundColor = Color.Gray, TextColor = Color.White, WidthRequest = 90, Command = new Command(async() => { await Navigation.PopAsync(); }) } } } } } }; }
private void inicializarComponente() { _ValorEntry = new Entry { Placeholder = "Digite o valor", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, WidthRequest = _width, Keyboard = Keyboard.Numeric }; _ValorEntry.SetBinding(Entry.TextProperty, new Binding("Valor")); //_ValorEntry.Behaviors.Add(new NumberValidatorBehavior()); _TipoGastoPicker = new DropDownPicker { //WidthRequest = Device.OnPlatform(100, 120, 100), WidthRequest = _width, //HeightRequest = 25, DropDownHeight = 150, Title = "Tipo", SelectedText = "Indefinido", SelectedIndex = 0, //FontSize = Device.OnPlatform(10, 14, 10), CellHeight = 20, SelectedBackgroundColor = Color.FromRgb(0, 70, 172), SelectedTextColor = Color.White, BorderColor = Color.Purple, ArrowColor = Color.Blue }; var lista = new List <string>(); foreach (var tipo in Enum.GetValues(typeof(GastoTipoEnum))) { switch ((GastoTipoEnum)tipo) { case GastoTipoEnum.Abastecimento: lista.Add("Abastecimento"); break; case GastoTipoEnum.Despesas: lista.Add("Despesas"); break; case GastoTipoEnum.Multas: lista.Add("Multas"); break; default: lista.Add("Indefinido"); break; } } _TipoGastoPicker.Source = lista; _TipoGastoPicker.SetBinding(DropDownPicker.SelectedIndexProperty, new Binding("Tipo")); _LocalEntry = new Entry { //Placeholder = "Digite o titulo", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, WidthRequest = _width, }; _LocalEntry.SetBinding(Entry.TextProperty, new Binding("Endereco")); _ObservacaoEntry = new Entry { Placeholder = "Observação", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, WidthRequest = _width, }; _ObservacaoEntry.SetBinding(Entry.TextProperty, new Binding("Observacao")); _LatitudeLabel = new Label { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start }; _LatitudeLabel.SetBinding(Label.TextProperty, new Binding("Latitude", stringFormat: "Latitude: {0}")); _LongitudeLabel = new Label { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start }; _LongitudeLabel.SetBinding(Label.TextProperty, new Binding("Longitude", stringFormat: "Latitude: {0}")); _FotoImage = new Image() { //Source = "ic_add_a_photo_48pt.png", Source = "ic_add_a_photo_black_48dp.png", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.CenterAndExpand, WidthRequest = TelaUtils.LarguraSemPixel * 0.4, HeightRequest = TelaUtils.LarguraSemPixel * 0.4 }; _FotoImage.GestureRecognizers.Add( new TapGestureRecognizer() { Command = new Command(() => { tirarFoto(); } ) }); }
public NovoCustoPage() { Title = "Novo Custo"; if (TelaUtils.Orientacao == "Landscape") { _width = (int)TelaUtils.LarguraSemPixel * 0.5; } else { _width = (int)TelaUtils.LarguraSemPixel * 0.8; } ScrollView scrollMain = new ScrollView(); scrollMain.Orientation = ScrollOrientation.Vertical; scrollMain.VerticalOptions = LayoutOptions.FillAndExpand; StackLayout main = new StackLayout(); main.BackgroundColor = Color.Transparent; main.Orientation = StackOrientation.Vertical; main.VerticalOptions = LayoutOptions.StartAndExpand; main.HorizontalOptions = LayoutOptions.CenterAndExpand; StackLayout valorStack = new StackLayout() { Orientation = StackOrientation.Horizontal }; Image dinheiroIcone = new Image() { Source = "ic_monetization_on_black_24dp.png", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, }; var valor = new Entry { Placeholder = "Digite o valor", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, WidthRequest = _width, }; NumberValidatorBehavior SecSenhaValidator = new NumberValidatorBehavior(); valor.Behaviors.Add(SecSenhaValidator); valorStack.Children.Add(dinheiroIcone); valorStack.Children.Add(valor); StackLayout dataStack = new StackLayout() { Orientation = StackOrientation.Horizontal }; Image dataIcone = new Image() { Source = "ic_event_black_24dp.png", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, }; var data = new DatePicker { IsVisible = true, IsEnabled = true, WidthRequest = _width, }; dataStack.Children.Add(dataIcone); dataStack.Children.Add(data); StackLayout tipoCustoStack = new StackLayout() { Orientation = StackOrientation.Horizontal }; Image tipoCustoIcone = new Image() { Source = "ic_shopping_cart_black_24dp.png", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, }; _Drop1 = new DropDownPicker { //WidthRequest = Device.OnPlatform(100, 120, 100), WidthRequest = _width, //HeightRequest = 25, DropDownHeight = 150, Title = "Tipo", SelectedText = "", //FontSize = Device.OnPlatform(10, 14, 10), CellHeight = 20, SelectedBackgroundColor = Color.FromRgb(0, 70, 172), SelectedTextColor = Color.White, BorderColor = Color.Purple, ArrowColor = Color.Blue }; Items(); tipoCustoStack.Children.Add(tipoCustoIcone); tipoCustoStack.Children.Add(_Drop1); StackLayout tagsStack = new StackLayout() { Orientation = StackOrientation.Horizontal }; Image tagsIcone = new Image() { Source = "ic_local_offer_black_24dp.png", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, }; var tags = new Entry { Placeholder = "Tags", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, WidthRequest = _width, }; tagsStack.Children.Add(tagsIcone); tagsStack.Children.Add(tags); StackLayout observacaoStack = new StackLayout() { Orientation = StackOrientation.Horizontal }; Image observacaoIcone = new Image() { Source = "ic_edit_black_24dp.png", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, }; var observacao = new Entry { Placeholder = "Observação", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, WidthRequest = _width, }; observacaoStack.Children.Add(observacaoIcone); observacaoStack.Children.Add(observacao); StackLayout localStack = new StackLayout() { Orientation = StackOrientation.Horizontal }; Image localIcone = new Image() { Source = "ic_map_black_24dp.png", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, }; _local = new Entry { //Placeholder = "Digite o titulo", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, WidthRequest = _width, }; localStack.Children.Add(localIcone); localStack.Children.Add(_local); StackLayout fotoStack = new StackLayout() { Orientation = StackOrientation.Horizontal }; _cupomFiscal = new Image() { Source = "ic_add_a_photo_48pt.png", VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.CenterAndExpand, WidthRequest = TelaUtils.LarguraSemPixel * 0.4, HeightRequest = TelaUtils.LarguraSemPixel * 0.4 }; _cupomFiscal.GestureRecognizers.Add( new TapGestureRecognizer() { Command = new Command(() => { tirarFoto(); } ) }); fotoStack.Children.Add(_cupomFiscal); main.Children.Add(valorStack); main.Children.Add(dataStack); main.Children.Add(localStack); main.Children.Add(tipoCustoStack); main.Children.Add(tagsStack); main.Children.Add(observacaoStack); main.Children.Add(fotoStack); scrollMain.Content = main; Content = scrollMain; }