Beispiel #1
0
        private async Task PopulateMenu()
        {
            _menuItems = await _apiHandler.GetMenuItemsAsync();

            listViewMenu.Items.Clear();
            foreach (var item in _menuItems)
            {
                var row          = new[] { item.Name, item.Price.ToString() };
                var listViewItem = new ListViewItem(row)
                {
                    Tag = item
                };

                foreach (var additive in item.Additives)
                {
                    listViewItem.SubItems.Add(additive.Name);
                    listViewItem.SubItems.Add(additive.Price.ToString());
                }

                listViewMenu.Items.Add(listViewItem);
            }

            listViewMenu.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            listViewMenu.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
        }