예제 #1
0
        public Administrador()
        {
            InitializeComponent();
            NavigationPage.SetHasNavigationBar(this, false);

            ContasViewModel contasViewModel = new ContasViewModel();

            this.BindingContext = contasViewModel;



            contasViewModel.IniciaDados();

            LvCardapio.ItemsSource = new List <Model.ModCardapio>(contasViewModel.Cardapio);

            this.LvCardapio.ItemTapped += async(sender, e) =>
            {
                var message = await DisplayAlert("Message", "Qual operação Deseja realizar", "Excluir", "Editar");

                if (message)
                {
                    contasViewModel.Excluir(e.Item as Model.ModCardapio);
                    contasViewModel.IniciaDados();
                    contasViewModel.Cardapio = new List <Model.ModCardapio>(contasViewModel.Cardapio);
                }
                else
                {
                    contasViewModel.ModCardapio = e.Item as Model.ModCardapio;
                }
            };

            contasViewModel.IniciaDados();
        }
예제 #2
0
        public Cardapio()
        {
            InitializeComponent();
            ContasViewModel contasViewModel = new ContasViewModel();

            this.BindingContext = contasViewModel;



            contasViewModel.IniciaDados();

            LvCardapio.ItemsSource = new List <Model.ModCardapio>(contasViewModel.Cardapio);


            //LvCardapio.ItemsSource = _service.GetCardapios();

            //contasViewModel.Cardapio = new List<Model.ModCardapio>(contasViewModel.Cardapio);

            //((NavigationPage)Application.Current.MainPage).BarBackgroundColor = Color.Blue;
            //((NavigationPage)Application.Current.MainPage).BarTextColor = Color.Black;
        }