/* * Author: BH * Creates and returns deck panels to the DeckList screen for all of the Decks contained in data */ public static List <DeckPanel> CreateDeckPanels() { List <DeckPanel> DeckPanels = new List <DeckPanel>(); if (DeckList.Count == 0) { return(DeckPanels); } DeckPanel newDeckPanel; foreach (KeyValuePair <int, Deck> d in DeckList) { newDeckPanel = new DeckPanel(d.Value); DeckPanels.Add(newDeckPanel); } return(DeckPanels); }
/* * Author: LM * Overload for Ben's version of the CreateDeckPanels() method * Takes in a search string from the DeckList screen search box * Returns a DeckPanel for all decks with a title that contains the current search string */ public static List <DeckPanel> CreateDeckPanels(string str) { List <DeckPanel> DeckPanels = new List <DeckPanel>(); if (DeckList.Count == 0) { return(DeckPanels); } DeckPanel newDeckPanel; foreach (KeyValuePair <int, Deck> d in DeckList) { if (d.Value.Title.ToLower().Contains(str)) { newDeckPanel = new DeckPanel(d.Value); DeckPanels.Add(newDeckPanel); } } return(DeckPanels); }