public Form1() { this.itemsStartX = 200; this.itemsStartY = 100; this.itemsMargin = 45; this.Items = new List <Control>(); this.Weights = new List <Control>(); InitializeComponent(); Form vizualizer = new Vizualizer( values: new int[] { 1, 4, 5, 7 }, weights: new int[] { 1, 3, 4, 5 }, bagCapacity: 7 ); vizualizer.Show(); this.Hide(); }
private void startButton_Click(object sender, EventArgs e) { //Add validation for negative numbers int[] values = new int[this.Items.Count]; int[] weights = new int[this.Weights.Count]; for (int i = 0; i < this.Items.Count; i++) { values[i] = int.Parse(this.Items[i].Text); weights[i] = int.Parse(this.Weights[i].Text); } //int xBagDim = int.Parse(xBagDimension.Text); //int yBagDim = int.Parse(yBagDimension.Text); int bagCap = int.Parse(bagCapacity.Text); Form vizualizer = new Vizualizer(bagCap, values, weights); vizualizer.Show(); this.Hide(); }