コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            int width, height;

            UniverseParser.LoadFromFile();
            try
            {
                width  = Convert.ToInt32(textBox1.Text);
                height = Convert.ToInt32(textBox2.Text);
            }
            catch
            {
                MessageBox.Show(@"Wrong field value!");
                return;
            }
            UniverseParser.LoadFromFile();
            universe             = new Universe(width, height);
            textBoxOutputManager = new TextBoxOutputManager(universe, richTextBox1, label1);


            InitConfigs();
            universe.GenerateCells(UniverseConsts.DefGenerateCells);
            textBoxOutputManager.StartSimulation();
            isWorking = true;

            button1.Enabled  = false;
            button2.Enabled  = true;
            button3.Enabled  = true;
            button5.Enabled  = true;
            textBox1.Enabled = false;
            textBox2.Enabled = false;
            label1.Text      = @"";
        }
コード例 #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (textBoxOutputManager == null)
     {
         return;
     }
     if (isWorking)
     {
         textBoxOutputManager.PauseSimulation();
         isWorking = false;
     }
     else
     {
         textBoxOutputManager.StartSimulation();
         isWorking = true;
     }
 }