示例#1
0
        /// <summary>
        /// Handles click events from the Run/Stop button.
        /// </summary>
        private void RunStop_Btn_Click(object sender, EventArgs e)
        {
            // Sanity check the inputs
            if (2 * DampingBorderWidth_NUD.Value > Math.Min(GridSizeX_NUD.Value, Math.Min(GridSizeY_NUD.Value, GridSizeZ_NUD.Value)))
            {
                MessageBox.Show("Damping border must be less than half the minimum grid dimension.");
                return;
            }

            if (RunStop_Btn.Text == "Stop")
            {
                RunStop_Btn.Enabled     = false;
                PauseResume_Btn.Enabled = false;

                m_evolver.Cancel();
            }
            else
            {
                RunStop_Btn.Text        = "Stop";
                PauseResume_Btn.Enabled = true;
                Main_ProgressBar.Value  = 0;
                EnableInputs(false);

                m_params = GetParamsFromUi();
                Properties.Settings.Default.LastRunParams = m_params.ToString();
                Properties.Settings.Default.Save();
                CreateAnimationFrames();
            }
        }