public ProdutosPage()
 {
     InitializeComponent();
     using (var dados = new AcessoDB())
     {
         this.ListaProd.ItemsSource = dados.GetProd();
     }
 }
Exemple #2
0
        public UsuariosPage()
        {
            InitializeComponent();
            AcessoDB userData   = new AcessoDB();
            var      sourceData = userData.GetUsers();

            listUser.ItemsSource = sourceData;
        }
        public ClientesPage()
        {
            InitializeComponent();

            using (var dados = new AcessoDB())
            {
                this.ListaCliente.ItemsSource = dados.GetClientes();
            }
        }
 public LoginPage()
 {
     InitializeComponent();
     userData = new AcessoDB();
     // Define o binding context
     this.BindingContext = this;
     // Define a propriedade
     this.IsBusy = false;
     //Define o evento Click do botão de login
     BtnLogin.Clicked     += BtnLogin_Clicked;
     BtnRegistrar.Clicked += BtnRegistrar_Clicked;
 }
        protected void SalvarClicked(object sender, EventArgs e)
        {
            var produto = new Produto
            {
                Nome  = this.NomeProd.Text,
                Tipo  = this.TipoProd.Text,
                CDB   = this.CodBProd.Text,
                Preco = this.PrecoProd.Text
            };

            using (var dados = new AcessoDB())
            {
                dados.InserirProduto(produto);
                this.ListaProd.ItemsSource = dados.GetProd();
            }
        }
        protected void SalvarClicked(object sender, EventArgs e)
        {
            var cliente = new Cliente
            {
                Nome    = this.NomeCliente.Text,
                Email   = this.EmailCliente.Text,
                Usuario = this.UsuarioCliente.Text,
                Senha   = this.SenhaCliente.Text
            };

            using (var dados = new AcessoDB())
            {
                dados.InserirCliente(cliente);
                this.ListaCliente.ItemsSource = dados.GetClientes();
            }
        }
        //define a propriedade IsBusy como true
        private async void BtnRegistrar_Clicked(object sender, EventArgs e)
        {
            //ativa o ActivityIndicator
            this.IsBusy = true;
            var registro = new Usuario
            {
                Nome  = this.Nome.Text,
                Email = this.Email.Text,
                Usu   = this.NomeUsuario.Text,
                Senha = this.Senha.Text
            };

            using (var dados = new AcessoDB())
            {
                dados.AddUser(registro);
            }
            await Momento(1000);

            Application.Current.MainPage = new LoginPage();
        }