private void button2_Click(object sender, EventArgs e) //start { SelectNeighbourhoodLogic(); _logikaPeridyczne = checkBox1.Checked; SelectGrainType(); _iloscStartowychZiaren = Convert.ToInt32(textBox3.Text); _logic = new Algorytmy(_x, _y, _iloscStartowychZiaren, _ukladZiaren, Convert.ToInt32(textBox4.Text)); if (backgroundWorker1.IsBusy != true) { // Start the asynchronous operation. backgroundWorker1.RunWorkerAsync(); } else { //backgroundWorker1.CancelAsync(); } }
private void button4_Click(object sender, EventArgs e) //reset { _work = false; for (int i = 0; i < _x + 4; i++) { for (int j = 0; j < _y + 4; j++) { _logic.Mapa[i, j] = new Punkt(); _logic.NowaMapa[i, j] = new Punkt(); } } _work = true; SelectNeighbourhoodLogic(); _logikaPeridyczne = checkBox1.Checked; SelectGrainType(); _iloscStartowychZiaren = Convert.ToInt32(textBox3.Text); _logic = new Algorytmy(_x, _y, _iloscStartowychZiaren, _ukladZiaren, Convert.ToInt32(textBox4.Text)); _logic.Start(); }