Ejemplo n.º 1
0
        private void StartDummyLoop()
        {
            lock (RunDummyThreadLock)
            {
                _runDummyThread = true;
            }

            Thread dummyThread = new Thread(() =>
            {
                NameWakeupData currentDummy = null;
                bool localRunDummyThread    = true;

                while (localRunDummyThread)
                {
                    try
                    {
                        var dummy = _reversalTool.GetDummy();

                        if (!Equals(dummy, currentDummy))
                        {
                            currentDummy = dummy;

                            SetDummyName(currentDummy?.CharName);
                        }
                    }
                    catch (Win32Exception)
                    {
                        StopDummyLoop();

                        Application.Current.Shutdown();
                        return;
                    }
                    catch (Exception)
                    {
                        StopDummyLoop();
                        MessageBox.Show("Can't read Dummy!");
                        Application.Current.Shutdown();
                        return;
                    }

                    lock (RunDummyThreadLock)
                    {
                        localRunDummyThread = _runDummyThread;
                    }

                    Thread.Sleep(2000);
                }
#if DEBUG
                Console.WriteLine(@"dummyThread ended");
#endif
            })
            {
                Name = "dummyThread"
            };

            dummyThread.Start();
        }
Ejemplo n.º 2
0
 private void _reversalTool_DummyChanged(NameWakeupData dummy)
 {
     SetDummyName(dummy.CharName);
 }