Ejemplo n.º 1
0
        private void atualizarSeguimento(SeguimentoInfo seguimento, int left, int top)
        {
            var seguimentoView = new SeguimentoView {
                Seguimento = seguimento
            };

            seguimentoView.AoClicar += (sender, e) =>
            {
                EnderecoUtils.selecionarEndereco((endereco) => {
                    AoClicar?.Invoke(sender, e);
                });
            };
            _seguimentoGrid.Children.Add(seguimentoView, left, top);
        }
Ejemplo n.º 2
0
        private void inicializarComponente()
        {
            var clique = new TapGestureRecognizer();

            clique.Tapped += (sender, e) => {
                AoClicar?.Invoke(this, _categoria);
            };
            _iconeIcon = new Image
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                //Icon = "fa-plus",
                //IconColor = Estilo.Current.BotaoInfo.TextColor,
                //IconSize = 30
            };
            _botaoFrame = new Frame
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                BackgroundColor   = Estilo.Current.BotaoInfo.BackgroundColor,
                CornerRadius      = 45,
                WidthRequest      = 50,
                //HeightRequest = 35,
                HeightRequest = 50,
                //Padding = new Thickness(10, 10, 10, 25),
                Content = _iconeIcon
            };
            _botaoFrame.GestureRecognizers.Add(clique);
            _nomeLabel = new Label
            {
                VerticalOptions         = LayoutOptions.Start,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                HorizontalTextAlignment = TextAlignment.Center,
                FontSize = 12,
                //Text = seguimento.Nome
            };
            _nomeLabel.GestureRecognizers.Add(clique);
        }
Ejemplo n.º 3
0
        private void inicializarComponente()
        {
            var clique = new TapGestureRecognizer();

            clique.Tapped += (sender, e) => {
                AoClicar?.Invoke(this, Produto);
            };

            _fotoImage = new Image
            {
                VerticalOptions   = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Style             = Estilo.Current[EstiloProduto.PRODUTO_FOTO]
            };
            _fotoImage.SetBinding(Image.SourceProperty, new Binding("FotoUrl"));
            _fotoImage.GestureRecognizers.Add(clique);

            _nomeLabel = new Label
            {
                VerticalOptions   = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                HeightRequest     = 70,
                //TextColor = Color.Black,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Start,
                Style = Estilo.Current[EstiloProduto.PRODUTO_TITULO]
            };
            _nomeLabel.SetBinding(Label.TextProperty, new Binding("Nome"));
            _nomeLabel.GestureRecognizers.Add(clique);

            _moedaValorLabel = new Label
            {
                Text              = "R$",
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Start,
                Style             = Estilo.Current[EstiloProduto.PRODUTO_PRECO_MOEDA]
            };
            _moedaValorLabel.SetBinding(Label.TextColorProperty, new Binding("PromocaoCor"));
            _moedaValorLabel.GestureRecognizers.Add(clique);

            _valorLabel = new Label
            {
                VerticalOptions   = LayoutOptions.StartAndExpand,
                HorizontalOptions = LayoutOptions.Start,
                Style             = Estilo.Current[EstiloProduto.PRODUTO_PRECO_VALOR]
            };
            //_valorLabel.SetBinding(Label.TextProperty, new Binding("ValorPromocao", stringFormat: "{0:N2}"));
            _valorLabel.SetBinding(Label.TextProperty, new Binding("ValorFinal", stringFormat: "{0:N2} "));
            _valorLabel.SetBinding(Label.TextColorProperty, new Binding("PromocaoCor"));
            _valorLabel.GestureRecognizers.Add(clique);

            _volumeLabel = new Label
            {
                VerticalOptions   = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.Start,
                Style             = Estilo.Current[EstiloProduto.PRODUTO_VOLUME]
            };
            _volumeLabel.SetBinding(Label.TextProperty, new Binding("VolumeStr"));
            _volumeLabel.GestureRecognizers.Add(clique);


            _moedaPromocaoLabel = new Label
            {
                Text              = "R$",
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Start,
                Style             = Estilo.Current[EstiloProduto.PRODUTO_PROMOCAO_MOEDA]
            };
            _moedaPromocaoLabel.GestureRecognizers.Add(clique);

            _valorPromocaoLabel = new Label
            {
                VerticalOptions   = LayoutOptions.StartAndExpand,
                HorizontalOptions = LayoutOptions.Start,
                Style             = Estilo.Current[EstiloProduto.PRODUTO_PROMOCAO_VALOR]
            };
            //_valorPromocaoLabel.SetBinding(Label.TextProperty, new Binding("Valor", stringFormat: "{0:N2}"));
            _valorPromocaoLabel.SetBinding(Label.TextProperty, new Binding("Valor", stringFormat: "{0:N2} "));
            _valorPromocaoLabel.GestureRecognizers.Add(clique);

            _estoqueLabel = new Label
            {
                VerticalOptions   = LayoutOptions.StartAndExpand,
                HorizontalOptions = LayoutOptions.Start,
                Style             = Estilo.Current[EstiloProduto.PRODUTO_QUANTIDADE]
            };
            _estoqueLabel.SetBinding(Label.TextProperty, new Binding("Quantidade"));
            _estoqueLabel.GestureRecognizers.Add(clique);

            var valorLayout = new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                VerticalOptions   = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Margin            = new Thickness(0, 0, 0, 3),
                Spacing           = 1,
                Children          =
                {
                    _moedaPromocaoLabel,
                    _valorPromocaoLabel
                }
            };

            AbsoluteLayout.SetLayoutBounds(valorLayout, new Rectangle(0, 0, 1, 1));
            AbsoluteLayout.SetLayoutFlags(valorLayout, AbsoluteLayoutFlags.All);
            valorLayout.GestureRecognizers.Add(clique);

            var linha = new BoxView
            {
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor   = Estilo.Current.DangerColor,
                HeightRequest     = 1,
            };

            AbsoluteLayout.SetLayoutBounds(linha, new Rectangle(0, 0, 1, 1));
            AbsoluteLayout.SetLayoutFlags(linha, AbsoluteLayoutFlags.All);
            linha.GestureRecognizers.Add(clique);

            _promocaoStack = new AbsoluteLayout
            {
                VerticalOptions   = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.Start,
                Children          =
                {
                    valorLayout,
                    linha
                }
            };
            _promocaoStack.SetBinding(AbsoluteLayout.IsVisibleProperty, new Binding("EmPromocao"));
            _promocaoStack.GestureRecognizers.Add(clique);

            _quantidadeButton = new QuantidadeHControl
            {
                Margin = new Thickness(0, 5, 5, 0),
                //VerticalOptions = LayoutOptions.CenterAndExpand,
                //HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                FontFamily        = Estilo.Current.FontDefaultBold,
                //WidthRequest = 40,
                //HeightRequest = 120
                HeightRequest = 40
            };
            _quantidadeButton.SetBinding(QuantidadeHControl.QuantidadeProperty, new Binding("QuantidadeCarrinho"));
            _quantidadeButton.SetBinding(QuantidadeHControl.ProdutoProperty, new Binding("."));
        }