public Form1() { Deck decktoDeal; List<Card> cardsofDeck1 = new List<Card>(); decktoDeal = new Deck(); Random random = new Random(); int Deck1Count = random.Next(1,11); for (int i = 0; i < Deck1Count; i++) cardsofDeck1.Add(decktoDeal.Deal(random.Next(decktoDeal.Count))); deck1 = new Deck(cardsofDeck1); deck1.Sort(); //RedrawDeck(1); deck2 = new Deck(); deck2.Sort(); //RedrawDeck(2); InitializeComponent(); foreach (string cardName in deck1.GetCardName()) listBox1.Items.Add(cardName); label1.Text = "Deck #1(" + deck1.Count + " cards)"; foreach (string cardName in deck2.GetCardName()) listBox2.Items.Add(cardName); label2.Text = "Deck #2(" + deck2.Count + " cards)"; listBox1.SelectedIndex = 0; listBox2.SelectedIndex = 0; }
public Form1() { Deck decktoDeal; List <Card> cardsofDeck1 = new List <Card>(); decktoDeal = new Deck(); Random random = new Random(); int Deck1Count = random.Next(1, 11); for (int i = 0; i < Deck1Count; i++) { cardsofDeck1.Add(decktoDeal.Deal(random.Next(decktoDeal.Count))); } deck1 = new Deck(cardsofDeck1); deck1.Sort(); //RedrawDeck(1); deck2 = new Deck(); deck2.Sort(); //RedrawDeck(2); InitializeComponent(); foreach (string cardName in deck1.GetCardName()) { listBox1.Items.Add(cardName); } label1.Text = "Deck #1(" + deck1.Count + " cards)"; foreach (string cardName in deck2.GetCardName()) { listBox2.Items.Add(cardName); } label2.Text = "Deck #2(" + deck2.Count + " cards)"; listBox1.SelectedIndex = 0; listBox2.SelectedIndex = 0; }
private void RedrawDeck(int DeckNumber) { if (DeckNumber == 1) { listBox1.Items.Clear(); foreach (string cardName in deck1.GetCardName()) { listBox1.Items.Add(cardName); } label1.Text = "Deck #1(" + deck1.Count + " cards)"; } else { listBox2.Items.Clear(); foreach (string cardName in deck2.GetCardName()) { listBox2.Items.Add(cardName); } label2.Text = "Deck #2(" + deck2.Count + " cards)"; } }