/// <summary> /// When the user presses the Generation Button, retrieves inputs from text boxes and runs Plate Generation. /// </summary> private void GenerationButton_Click(object sender, EventArgs e) { errorDisplay.Text = ""; if (!Int32.TryParse(sizeInput.Text, out int size)) { errorDisplay.Text += "Size is not an integer. "; return; } if (!Int32.TryParse(numberOfPlatesInput.Text, out int numberOfPlates)) { errorDisplay.Text += "Number of Plates is not an integer. "; return; } List <double>[] genParams = new List <double> [3]; genParams = ProcessString(genParamsInput.Text, 3); if (genParams == null || genParams[0].Count != genParams[1].Count || genParams[1].Count != genParams[2].Count) { errorDisplay.Text += "Magnitude is input incorrectly. Format is: 12.3,4.56,789; . "; return; } double[] magnitude = new double[genParams[0].Count]; double[] radius = new double[genParams[1].Count]; double[] pointConcentration = new double[genParams[2].Count]; for (int i = 0; i < genParams[0].Count; i++) { magnitude[i] = genParams[0][i]; radius[i] = genParams[1][i]; pointConcentration[i] = genParams[2][i]; } if (!Int32.TryParse(cutoffInput.Text, out int cutoff)) { errorDisplay.Text += "Cutoff is not an integer. "; return; } PlateLayer PlateLayerI = new PlateLayer(size, numberOfPlates); PlateLayerI.PlateGeneration(magnitude, radius, pointConcentration, cutoff); PlateLayerI.SavePlates(directoryInput.Text, outNameInput.Text); pictureBox.ImageLocation = directoryInput.Text + "\\" + outNameInput.Text + ".png"; Rectangle resolution = Screen.PrimaryScreen.Bounds; //if (resolution.Width > 2 * size && resolution.Height > size - 280) //{ // pictureBox.Width = 2 * size; // pictureBox.Height = size; // Form.ActiveForm.Width = 2 * size; // Form.ActiveForm.Height = size + 280; //} //else //{ // pictureBox.Width = resolution.Width; // pictureBox.Height = resolution.Height - 280; // Form.ActiveForm.Width = resolution.Width; // Form.ActiveForm.Height = resolution.Height; //} errorDisplay.Text = "No errors yet. Errors will be displayed here."; }
/// <summary> /// When the user presses the Generation Button, retrieves inputs from text boxes and runs Plate Generation. /// </summary> private void GenerationButton_Click(object sender, EventArgs e) { errorDisplay.Text = ""; if (!Int32.TryParse(sizeInput.Text, out int size)) { errorDisplay.Text += "Size is not an integer. "; return; } if (!Int32.TryParse(numberOfPlatesInput.Text, out int numberOfPlates)) { errorDisplay.Text += "Number of Plates is not an integer. "; return; } List <double>[] genParams = new List <double> [3]; genParams = ProcessString(genParamsInput.Text, 3); if (genParams == null || genParams[0].Count != genParams[1].Count || genParams[1].Count != genParams[2].Count) { errorDisplay.Text += "Magnitude is input incorrectly. Format is: 12.3,4.56,789; . "; return; } double[] magnitude = new double[genParams[0].Count]; double[] radius = new double[genParams[1].Count]; double[] pointConcentration = new double[genParams[2].Count]; for (int i = 0; i < genParams[0].Count; i++) { magnitude[i] = genParams[0][i]; radius[i] = genParams[1][i]; pointConcentration[i] = genParams[2][i]; } if (!Int32.TryParse(cutoffInput.Text, out int cutoff)) { errorDisplay.Text += "Cutoff is not an integer. "; return; } PlateLayer PlateLayerI = new PlateLayer(size, numberOfPlates); PlateLayerI.PlateGeneration(magnitude, radius, pointConcentration, cutoff); PointIO pointIO = new PointIO { directory = directoryInput.Text }; pointIO.SaveHeightImage(outNameInput.Text, PlateLayerI.PastHeights); pointIO.SaveMapData(outNameInput.Text, PlateLayerI.PastHeights); pictureBox.ImageLocation = directoryInput.Text + "\\" + outNameInput.Text + ".png"; errorDisplay.Text = "No errors yet. Errors will be displayed here."; }