private void LoadButtons() { base.Clear(); currentButtons = new List <HighlightedItemImageButton>(); items = container.GetItems(); foreach (Item item in items) { HighlightedItemImageButton buttonToAdd; if (ImageTools.HasImage(item)) { ImageSource source; if (ImageBaseHandler.current.isItemCached(item.GetId())) { source = ImageBaseHandler.current.GetItemImageSource(item.GetId()); } else { source = ImageTools.LoadImage(item); } buttonToAdd = new HighlightedItemImageButton(item, source); } else { buttonToAdd = new HighlightedItemImageButton(item); } buttonToAdd.BackgroundColor = Color.Transparent; buttonToAdd.Margin = 5; buttonToAdd.Tapped += (sen, e) => { Navigation.PushAsync(new ItemDetailsPage(item)); }; buttonToAdd.LongPressed += (sen, e) => { MasterNavigationPage.current.RefreshButtons(); //force a button refresh }; currentButtons.Add(buttonToAdd); base.AddImageButtonEquivalent(buttonToAdd); } }
private void loadPanels() { mainLayout.Children.Clear(); items = container.GetItems(); foreach (Item item in items) { Action onTap = () => { Navigation.PushAsync(new ItemDetailsPage(item)); }; HighlightedItemPanelView newPanel = new HighlightedItemPanelView(item, LocationsView.LocationImageWidth, LocationsView.LocationImageWidth, onTap); currentButtons.Add(newPanel); mainLayout.Children.Add(newPanel); } }
//returns the item list from the parent storage type private List <Item> GetItems() { return(container.GetItems()); }