private void addComponentButton_Click(object sender, RoutedEventArgs e) { try { int xCoord = Int32.Parse(xBox.Text); int yCoord = Int32.Parse(yBox.Text); int height = Int32.Parse(heightBox.Text); int width = Int32.Parse(widthBox.Text); currentFactory.AddComponent(currentComponents[componentComboBox.SelectedIndex], xCoord, yCoord, height, width); componentList.Content += "\n" + currentComponents[componentComboBox.SelectedIndex]; } catch (Exception ex) { } }