//what happens when the user clicks the run simulation button private void runSimBtn_Click(object sender, EventArgs e) { iterationNum = 0; double diffA = 0, diffB = 0, feedA, killB; ColourFactory colourFactory = new ColourFactory(); IColourPicker colourScheme; //gets the selected colour scheme or defaults to grayscale if (grayScaleRbtn.Checked) { colourScheme = colourFactory.MakeColour(ColourChoices.GrayScale); } else if (blueRbtn.Checked) { colourScheme = colourFactory.MakeColour(ColourChoices.Colour1); } else if (redRbtn.Checked) { colourScheme = colourFactory.MakeColour(ColourChoices.Colour2); } else { colourScheme = colourFactory.MakeColour(0); } try { //gets the user specified values feedA = Convert.ToDouble(feedATxtBox.Text); killB = Convert.ToDouble(killBTxtBox.Text); if ((feedA > 1) || (killB < 0)) { MessageBox.Show("Please enter numbers between 0 and 1"); feedATxtBox.Text = ""; killBTxtBox.Text = ""; return; } //gets the user specified laplacian function to use if (perpendicularRbtn.Checked) { lapFunc = LaplacianFunctions.PerpendicularLaplacian; diffA = PERPDIFFA; diffB = PERPDIFFB; } else if (convolutionRbtn.Checked) { lapFunc = LaplacianFunctions.ConvolutionLaplacian; diffA = CONVDELTADIFFA; diffB = CONVDELTADIFFB; } else if (deltaRbtn.Checked) { lapFunc = LaplacianFunctions.DeltaMeansLaplacian; diffA = CONVDELTADIFFA; diffB = CONVDELTADIFFB; } //if a laplacian function has been selected makes a simulation manger //then starts the timer if (lapFunc != null) { manager = new SimulationManager(pattern, canvas, formGraphics, canvasBounds, lapFunc, colourScheme, CELLSIZE, GRIDSIZE, diffA, diffB, feedA, killB); timer1.Enabled = true; } else //if laplacian function hasnt been selected { MessageBox.Show("Please select a Laplacian Function"); } } catch (FormatException) //if user hasn't entered a and b values { MessageBox.Show("Please enter Values between 0 and 1 for Feed A and Kill B"); } }
//what happens when the user clicks the run simulation button private void runSimBtn_Click(object sender, EventArgs e) { iterationNum = 0; double diffA = 0, diffB = 0, feedA, killB; ColourFactory colourFactory = new ColourFactory(); IColourPicker colourScheme; //gets the selected colour scheme or defaults to grayscale if(grayScaleRbtn.Checked) { colourScheme = colourFactory.MakeColour(ColourChoices.GrayScale); } else if (blueRbtn.Checked) { colourScheme = colourFactory.MakeColour(ColourChoices.Colour1); } else if (redRbtn.Checked) { colourScheme = colourFactory.MakeColour(ColourChoices.Colour2); } else { colourScheme = colourFactory.MakeColour(0); } try { //gets the user specified values feedA = Convert.ToDouble(feedATxtBox.Text); killB = Convert.ToDouble(killBTxtBox.Text); if((feedA > 1)||(killB < 0)) { MessageBox.Show("Please enter numbers between 0 and 1"); feedATxtBox.Text = ""; killBTxtBox.Text = ""; return; } //gets the user specified laplacian function to use if (perpendicularRbtn.Checked) { lapFunc = LaplacianFunctions.PerpendicularLaplacian; diffA = PERPDIFFA; diffB = PERPDIFFB; } else if (convolutionRbtn.Checked) { lapFunc = LaplacianFunctions.ConvolutionLaplacian; diffA = CONVDELTADIFFA; diffB = CONVDELTADIFFB; } else if (deltaRbtn.Checked) { lapFunc = LaplacianFunctions.DeltaMeansLaplacian; diffA = CONVDELTADIFFA; diffB = CONVDELTADIFFB; } //if a laplacian function has been selected makes a simulation manger //then starts the timer if (lapFunc != null) { manager = new SimulationManager(pattern, canvas, formGraphics, canvasBounds, lapFunc, colourScheme, CELLSIZE, GRIDSIZE, diffA, diffB, feedA, killB); timer1.Enabled = true; } else //if laplacian function hasnt been selected { MessageBox.Show("Please select a Laplacian Function"); } } catch (FormatException) //if user hasn't entered a and b values { MessageBox.Show("Please enter Values between 0 and 1 for Feed A and Kill B"); } }