Beispiel #1
0
        private async void ListBoxProductTypes_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listBoxProductTypes.SelectedItem == null)
            {
                return;
            }

            try
            {
                var type = (ProductType)listBoxProductTypes.SelectedItem;
                gridViewProducts.DataSource = (await _repo.GetProductsAsync(type));
            }
            catch (Exception msg)
            {
                MessageBox.Show("Ett fel inträffade:", msg.ToString());
                Application.Exit();
            }
        }
 // Products
 private async void GetAllProductsBtn_Click(object sender, EventArgs e)
 {
     dataGridViewProducts.DataSource = await _repo.GetProductsAsync();
 }