Esempio n. 1
0
        public void RunLoop(Action frame)
        {
            MultithreadLoop loop = new MultithreadLoop();

            _currentLoop = loop;
            while (_currentLoop == loop && !loop.Stop && _ctrl.Visible)
            {
                CheckRenderLoopEvents();
                frame();
                DoEvents();
            }
        }
Esempio n. 2
0
        public void RunMultithreadLoop(Action frame)
        {
            MultithreadLoop loop = new MultithreadLoop();

            _currentLoop = loop;
            var th = new Thread(delegate()
            {
                while (_currentLoop == loop && !loop.Stop)
                {
                    CheckRenderLoopEvents();
                    frame();
                }
            });

            th.Start();
            while (_ctrl.Visible && th.IsAlive)
            {
                DoEvents();
                Thread.Sleep(100);
            }
            loop.Stop = true;
            th.Join();
        }