public void AddGumInList(Gum gum) { GumList.Add(gum); if (GumAdded != null) { GumAdded(gum); } Console.WriteLine("Gum added!"); }
private void button1_Click(object sender, EventArgs e) { decimal quantity = numericUpDown1.Value; string gumFlavor = comboBoxGumSelection.SelectedItem.ToString(); string bubble = "Bubble Gum"; string mint = "Mint"; if (gumFlavor.Contains(bubble)) { Gum newGum = new Gum(gumFlavor, 3.25, quantity); m_model.AddGumInList(newGum); this.Hide(); MainNavigation aMainNavigation = new MainNavigation(m_model); aMainNavigation.Closed += (s, args) => this.Close(); aMainNavigation.Show(); } else if (gumFlavor.Contains(mint)) { Gum newGum = new Gum(gumFlavor, 2.20, quantity); m_model.AddGumInList(newGum); this.Hide(); MainNavigation aMainNavigation = new MainNavigation(m_model); aMainNavigation.Closed += (s, args) => this.Close(); aMainNavigation.Show(); } else { Gum newGum = new Gum(gumFlavor, 2.75, quantity); m_model.AddGumInList(newGum); this.Hide(); MainNavigation aMainNavigation = new MainNavigation(m_model); aMainNavigation.Closed += (s, args) => this.Close(); aMainNavigation.Show(); } }