Ejemplo n.º 1
0
        public NovaPessoaPage()
        {
            txtNome = new Entry
            {
                Placeholder   = "Nome",
                HeightRequest = 60,
                WidthRequest  = 80
            };

            txtEmail = new Entry
            {
                Placeholder   = "Email",
                HeightRequest = 60,
                WidthRequest  = 80
            };

            txtTelefone = new Entry
            {
                Placeholder   = "Telefone",
                HeightRequest = 60,
                WidthRequest  = 80
            };

            txtBio = new BioEntry
            {
                HeightRequest = 150,
                WidthRequest  = 150,
            };

            unknownImage = new CircleImage
            {
                Source = ImageSource.FromResource(Constants.RetornarCaminhoParaImagens("Unknown.gif"))
            };
            var unknownImage_Click = new TapGestureRecognizer();

            unknownImage_Click.Tapped += async(sender, e) => await TrataCliqueNaFoto();

            this.unknownImage.GestureRecognizers.Add(unknownImage_Click);

            btnAdicionarPessoa = new Button
            {
                BorderColor       = AppColors.BrandColor(),
                BorderRadius      = 6,
                BorderWidth       = 0.5,
                Text              = "Adicionar",
                TextColor         = Color.White,
                BackgroundColor   = AppColors.BrandColor(),
                HorizontalOptions = LayoutOptions.StartAndExpand,
                WidthRequest      = 110,
                HeightRequest     = 40
            };
            this.btnAdicionarPessoa.Clicked += (sender, e) => TrataClique();

            this.btnVoltar = new Button
            {
                BorderColor       = AppColors.BrandColor(),
                BorderRadius      = 6,
                BorderWidth       = 0.5,
                Text              = "Voltar",
                TextColor         = Color.White,
                BackgroundColor   = AppColors.BrandColor(),
                HorizontalOptions = LayoutOptions.EndAndExpand,
                WidthRequest      = 110,
                HeightRequest     = 40
            };

            var buttonsLayout = new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    btnAdicionarPessoa,
                    btnVoltar
                }
            };

            mainlayout = new StackLayout
            {
                Padding  = new Thickness(0, Device.OnPlatform(10, 5, 0), 5, 0),
                Children =
                {
                    unknownImage,
                    txtNome,
                    txtEmail,
                    txtTelefone,
                    txtBio,
                    buttonsLayout
                }
            };

            MessagingCenter.Subscribe <SelecionaFotoPage, Image>(this, "SalvouFoto", (sender, arg) =>
            {
                if (arg != null && arg.Source != null)
                {
                    this.imgFoto = new Image();
                    this.imgFoto = arg;
                    Acr.UserDialogs.UserDialogs.Instance.Alert("Imagem salva com sucesso");
                }
            });

            this.Content = mainlayout;
        }
Ejemplo n.º 2
0
        public NovaPessoaPage()
        {
            txtNome = new Entry
            {
                Placeholder = "Nome",
                HeightRequest = 60,
                WidthRequest = 80
            };

            txtEmail = new Entry
            {
                Placeholder = "Email",
                HeightRequest = 60,
                WidthRequest = 80
            };

            txtTelefone = new Entry
            {
                Placeholder = "Telefone",
                HeightRequest = 60,
                WidthRequest = 80
            };

            txtBio = new BioEntry
            {
                HeightRequest = 150,
                WidthRequest = 150,
            };

            unknownImage = new CircleImage
            {
                Source = ImageSource.FromResource(Constants.RetornarCaminhoParaImagens("Unknown.gif"))
            };
            var unknownImage_Click = new TapGestureRecognizer();
            unknownImage_Click.Tapped += async (sender, e) => await TrataCliqueNaFoto();
            this.unknownImage.GestureRecognizers.Add(unknownImage_Click);

            btnAdicionarPessoa = new Button
            {
                BorderColor = AppColors.BrandColor(),
                BorderRadius = 6,
                BorderWidth = 0.5,
                Text = "Adicionar",
                TextColor = Color.White,
                BackgroundColor = AppColors.BrandColor(),
                HorizontalOptions = LayoutOptions.StartAndExpand,
                WidthRequest = 110,
                HeightRequest = 40
            };
            this.btnAdicionarPessoa.Clicked += (sender, e) => TrataClique();

            this.btnVoltar = new Button
            {
                BorderColor = AppColors.BrandColor(),
                BorderRadius = 6,
                BorderWidth = 0.5,
                Text = "Voltar",
                TextColor = Color.White,
                BackgroundColor = AppColors.BrandColor(),
                HorizontalOptions = LayoutOptions.EndAndExpand,
                WidthRequest = 110,
                HeightRequest = 40
            };

            var buttonsLayout = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children =
                {
                    btnAdicionarPessoa,
                    btnVoltar
                }
            };

            mainlayout = new StackLayout
            {
                Padding = new Thickness(0, Device.OnPlatform(10, 5, 0), 5, 0),
                Children =
                {
                    unknownImage,
                    txtNome,
                    txtEmail,
                    txtTelefone,
                    txtBio,
                    buttonsLayout
                }
            };

            MessagingCenter.Subscribe<SelecionaFotoPage,Image>(this, "SalvouFoto", (sender, arg) =>
                {
                    if (arg != null && arg.Source != null)
                    {
                        this.imgFoto = new Image();
                        this.imgFoto = arg;
                        Acr.UserDialogs.UserDialogs.Instance.Alert("Imagem salva com sucesso");
                    }
                });

            this.Content = mainlayout;
        }