Beispiel #1
0
        private async void BTN_LoadData_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var users = await _msGraphService.GetUserInfoAsync(App.AuthenticationResult?.AccessToken);

                var products = await _eCommerceService.GetAllProductsAsync(App.AuthenticationResult?.AccessToken);

                DG_Propducts.ItemsSource = products;
                DG_Propducts.Visibility  = Visibility.Visible;
            }
            catch (ApiCallException ex)
            {
                LBL_MessageInfo.Content = $"{ex.StatusCode}: {ex.Message}";
                DG_Propducts.Visibility = Visibility.Hidden;
            }
        }
        private async Task <IEnumerable <Product> > GetProductsAsync(string accessToken)
        {
            var products = await _eCommerceService.GetAllProductsAsync(accessToken);

            return(products);
        }