/// <summary> /// Get the list of categories from the database /// </summary> /// <returns></returns> public async Task RefreshCategoriesAsync() { // Set busy IsBusy = true; try { // Get the items if not already got var resp = await KryptPadApi.GetCategoriesWithItemsAsync(); // Set the list to our list of categories Categories = resp.Categories.ToList(); // Add view to the ItemsView object ItemsView.Source = Categories; // Refresh OnPropertyChanged(nameof(ItemsView)); // Show empty message if there are no categories EmptyMessageVisibility = Categories.Count == 0 ? Visibility.Visible : Visibility.Collapsed; } catch (WebException ex) { // Something went wrong in the api await DialogHelper.ShowMessageDialogAsync(ex.Message); } catch (Exception ex) { // Failed await DialogHelper.ShowGenericErrorDialogAsync(ex); } // Not busy any more IsBusy = false; }