コード例 #1
0
        //Thread workerThread;
        //ControlForm form = new ControlForm();

        /*private void Worker()
         * {
         *  Application.EnableVisualStyles();
         *  Application.Run(form);
         * }*/


        protected override void Append(LoggingEvent loggingEvent)
        {
            ControlForm form = Program.controlForm;

            if (form != null && form.isLoaded)
            {
                string v = RenderLoggingEvent(loggingEvent);
                if (!form.isFormClosing && form.formCloseMutex.WaitOne(1))
                {
                    form.Invoke(new Action(() =>
                    {
                        form.Append(v);
                    }
                                           ));
                    form.formCloseMutex.ReleaseMutex();
                }
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            cancelSource      = new CancellationTokenSource();
            cancellationToken = cancelSource.Token;

            PlayerController[] cnt = new PlayerController[2];

            cnt[0] = new TestController();
            cnt[1] = new DummyController();

            Game game = new Game(cnt);

            controlFormThread = new Thread(ControlFormWorker);
            controlForm       = new ControlForm(game);
            controlFormThread.Start();
            controlForm.loadEvent.WaitOne();


            log.Info("Game starting begin.");
            game.cancellationToken = cancellationToken;
            game.Run();
            log.Info("Goodbye.");
        }