コード例 #1
0
 public LoopWorker(TextBoxOutputManager textBoxOutputManager)
 {
     om = textBoxOutputManager;
     SetThreadPriority(ThreadPriority.Normal);
     SetUniversePause(0);
     SetFramePause(0);
 }
コード例 #2
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      = @"";
        }
コード例 #3
0
 public ThreadTechnique(TextBoxOutputManager textBoxOutputManager, System.Threading.ThreadPriority threadPriority)
 {
     blockedUniverseUpdThread = false;
     blockedScreenUpdThread   = false;
     om = textBoxOutputManager;
     universeUpdThread = new Task(() =>
     {
         System.Threading.Thread.CurrentThread.Priority = threadPriority;
         UniverseUpdateLoop();
     });
     universeUpdThread.Start();
     screenUpdThread = new Task(() =>
     {
         System.Threading.Thread.CurrentThread.Priority = threadPriority;
         UniverseUpdateLoop();
     });
     screenUpdThread.Start();
 }
コード例 #4
0
 public void Dispose()
 {
     Stop();
     om = null;
 }