コード例 #1
0
        private void inicializarComponente()
        {
            _filtro = new FreteFiltroPage();

            _freteListView = new ListView()
            {
                Style = Estilo.Current[Estilo.LISTA_PADRAO]
            };
            _freteListView.HasUnevenRows       = true;
            _freteListView.RowHeight           = -1;
            _freteListView.SeparatorVisibility = SeparatorVisibility.Default;
            _freteListView.SetBinding(ListView.ItemsSourceProperty, new Binding("."));
            _freteListView.ItemTemplate = new DataTemplate(typeof(FreteMotoristaCell));
            _freteListView.ItemTapped  += async(sender, e) =>
            {
                if (e == null)
                {
                    return;
                }

                FreteInfo entrInfo = (FreteInfo)((ListView)sender).SelectedItem;

                Navigation.PushAsync(new FreteAvisoPage(entrInfo));
            };
        }
コード例 #2
0
        public FreteClienteListaPage()
        {
            Title = "Meus Fretes";
            Style = Estilo.Current[Estilo.TELA_PADRAO];
            inicializarComponente();

            this.ToolbarItems.Add(new IconToolbarItem()
            {
                Icon      = "fa-filter",
                IconColor = Estilo.Current.BarTitleColor,
                Command   = new Command((object obj) => {
                    var filtroPage       = new FreteFiltroPage();
                    filtroPage.Filtered += (sender, e) => {
                        var aux = _fretes;
                        if (e.Tipo != null)
                        {
                            aux = aux.Where(x => x.Veiculos.Contains(e.Tipo)).ToList();
                        }
                        if (e.Destino != null)
                        {
                            aux = aux.Where(x => x.Locais.Where(y => y.Tipo == FreteLocalTipoEnum.Destino && y.Uf == e.Destino).Count() > 0).ToList();
                        }
                        if (e.Origem != null)
                        {
                            aux = aux.Where(x => x.Locais.Where(y => y.Tipo == FreteLocalTipoEnum.Saida && y.Uf == e.Origem).Count() > 0).ToList();
                        }
                        _freteListView.ItemsSource = aux;
                    };
                    Navigation.PushAsync(filtroPage);
                })
            });

            _mainLayout = new StackLayout {
                Orientation       = StackOrientation.Vertical,
                VerticalOptions   = LayoutOptions.Fill,
                HorizontalOptions = LayoutOptions.Fill,
                Children          =
                {
                    _freteListView,
                    _NovoButton
                }
            };
            Content = _mainLayout;
        }
コード例 #3
0
        private void inicializarComponente()
        {
            _filtroToolbar = new IconToolbarItem()
            {
                Icon      = "fa-filter",
                IconColor = Estilo.Current.BarTitleColor,
                Command   = new Command((object obj) =>
                {
                    var filtroPage       = new FreteFiltroPage();
                    filtroPage.Filtered += (sender, e) =>
                    {
                        var aux = _fretes;
                        if (e.Tipo != null)
                        {
                            aux = aux.Where(x => x.Veiculos.Contains(e.Tipo)).ToList();
                        }
                        if (e.Destino != null)
                        {
                            aux = aux.Where(x => x.Locais.Where(y => y.Tipo == FreteLocalTipoEnum.Destino && y.Uf == e.Destino).Count() > 0).ToList();
                        }
                        if (e.Origem != null)
                        {
                            aux = aux.Where(x => x.Locais.Where(y => y.Tipo == FreteLocalTipoEnum.Saida && y.Uf == e.Origem).Count() > 0).ToList();
                        }
                        _freteListView.ItemsSource = aux;
                    };
                    Navigation.PushAsync(filtroPage);
                })
            };

            _freteListView = new ListView()
            {
                Style         = Estilo.Current[Estilo.LISTA_PADRAO],
                HasUnevenRows = true,
                RowHeight     = -1,
                //ItemTemplate = new DataTemplate(typeof(FreteEmpresaCell))
                ItemTemplate = new DataTemplate(typeof(FreteCell))
            };
            _freteListView.SetBinding(ListView.ItemsSourceProperty, new Binding("."));
            _freteListView.ItemTapped += async(sender, e) =>
            {
                if (e == null)
                {
                    return;
                }

                FreteInfo frete = (FreteInfo)((ListView)sender).SelectedItem;
                _freteListView.SelectedItem = null;
                await Navigation.PushAsync(new FretePage {
                    Title = frete.SituacaoStr,
                    Frete = frete
                });
            };

            _NovoButton = new Button()
            {
                Text = "Novo frete",
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.End,
                Style             = Estilo.Current[Estilo.BTN_SUCESSO]
            };
            _NovoButton.Clicked += (sender, e) =>
            {
                Navigation.PushAsync(new FreteFormPage());
            };
        }