Ejemplo n.º 1
0
        public Eventos_Page(Evento evento)
        {
            _evento = evento;

            this.Title = $"Evento {_evento.Descricao}";
            #region Layout
            l_totalVendas_h = new Label {
                Text = "Total Vendas", HorizontalOptions = LayoutOptions.Center
            };
            l_totalVendas = new Label {
                Text = "0", FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.Center, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center
            };
            l_totalVendas.FontSize   = Device.GetNamedSize(NamedSize.Large, l_totalVendas);
            l_totalVendas_h.FontSize = Device.GetNamedSize(NamedSize.Medium, l_totalVendas);

            #endregion

            loading = new Loading_Layout();

            Eventos = new ObservableCollection <Evento>();


            sl_principal = new StackLayout()
            {
                Padding = Constantes.PADDINGDEFAULT, Children = { l_totalVendas_h, l_totalVendas }
            };

            this.Content = sl_principal;

            GetTotalVendas();
        }
        public Nova_Venda_Page(Venda venda, Evento evento)
        {
            this._venda  = venda;
            this._evento = evento;

            this.Title = "Nova Venda";

            VCell_Venda_Produto.AdicionaQuantidadeHandler += VCell_Venda_Produto_AdicionaQuantidadeHandler;
            VCell_Venda_Produto.DiminuiQuantidadeHandler  += VCell_Venda_Produto_DiminuiQuantidadeHandler;

            loading = new Loading_Layout();
            ProdutosVendaViewModel = new ObservableCollection <ProdutoVendaViewModel>();
            l_total = new Label()
            {
                Text = "Total R$ 0 ", HorizontalOptions = LayoutOptions.CenterAndExpand, TextColor = Color.White, FontAttributes = FontAttributes.Bold
            };

            listV_produtos = new ListView()
            {
                Margin = 5
            };
            listV_produtos.ItemsSource  = ProdutosVendaViewModel;
            listV_produtos.ItemTapped  += ListV_produtos_ItemTapped;
            listV_produtos.ItemTemplate = new DataTemplate(typeof(VCell_Venda_Produto));


            sl_hori_total = new StackLayout()
            {
                Padding = 5, BackgroundColor = Color.ForestGreen, Orientation = StackOrientation.Horizontal, Children = { l_total }
            };

            toolbar_finalizar = new ToolbarItem("Finalizar", "", Finalizar, ToolbarItemOrder.Default);
            toolbar_cancelar  = new ToolbarItem("Cancelar", "", Cancelar, ToolbarItemOrder.Default);
            sl_principal      = new StackLayout()
            {
                Children =
                {
                    sl_hori_total,
                    listV_produtos
                }
            };
            this.ToolbarItems.Add(toolbar_cancelar);
            this.ToolbarItems.Add(toolbar_finalizar);
            this.Content = sl_principal;

            PopulaProdutos();
        }