private void btnSubmit_Click(object sender, RoutedEventArgs e) { try { int index = cbxItemType.SelectedIndex; int itemID = int.Parse(txtItemID.Text); int numTeeth = int.Parse(txtNumTeeth.Text); int numItems = int.Parse(txtNumItems.Text); switch (index) { case 0: sprocket = new AluminumSprocket(itemID, numItems, numTeeth); break; case 1: sprocket = new PlasticSprocket(itemID, numItems, numTeeth); break; case 2: sprocket = new SteelSprocket(itemID, numItems, numTeeth); break; } DialogResult = true; Close(); } catch (Exception) { DialogResult = false; } }
public void Remove(Sprocket item) { items.Remove(item); Calc(); }
public void Add(Sprocket item) { items.Add(item); Calc(); }