Example #1
0
        public static void Main()
        {
            ApplicationThread applicationThread = new ApplicationThread();

            StartKMteller(applicationThread);
            StartConsole(applicationThread);
            Start(applicationThread);
        }
Example #2
0
        static void Main()
        {
            ApplicationThread applicationThread = new ApplicationThread();

            StartConsole(applicationThread);
            StartWinForm(applicationThread);
            Start(applicationThread);
        }
Example #3
0
        public static void Main(string[] args)
        {
            ApplicationThread applicationThread = new ApplicationThread();

            StartKMteller(applicationThread);
            StartWinForm(applicationThread);
            Start(applicationThread);
        }
Example #4
0
        public static void Start(ApplicationThread applicationThread)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Form1 form = new Form1();

            form.ApplicationThread = applicationThread;
            Application.Run(form);
        }
Example #5
0
        static void StartConsole(ApplicationThread applicationThread)
        {
            Assembly     assembly      = Assembly.LoadFrom("MVCPattern.Console.exe");
            Type         type          = assembly.GetType("MVCPattern.Console.Console");
            MethodInfo   consoleMethod = type.GetMethod("Start");
            consoleStart consoleStart  = (consoleStart)consoleMethod.CreateDelegate(typeof(consoleStart));
            Thread       consoleThread = new Thread(() => consoleStart(applicationThread));

            consoleThread.Start();
        }
Example #6
0
        static void StartWinForm(ApplicationThread applicationThread)
        {
            Assembly     assembly      = Assembly.LoadFrom("MVCPattern.WinForm.exe");
            Type         type          = assembly.GetType("MVCPattern.WinForm.WinForm");
            MethodInfo   winFormMethod = type.GetMethod("Start");
            winFormStart winFormStart  = (winFormStart)winFormMethod.CreateDelegate(typeof(winFormStart));
            Thread       winThread     = new Thread(() => winFormStart(applicationThread));

            winThread.Start();
        }
Example #7
0
        static void StartKMteller(ApplicationThread applicationThread)
        {
            Assembly      assembly      = Assembly.LoadFrom("MVCPattern.KMTeller.exe");
            Type          type          = assembly.GetType("MVCPattern.KMTeller.Program");
            MethodInfo    winFormMethod = type.GetMethod("Start");
            kmTellerStart kmTellerStart = (kmTellerStart)winFormMethod.CreateDelegate(typeof(kmTellerStart));
            Thread        winThread     = new Thread(() => kmTellerStart(applicationThread));

            winThread.Start();
        }
Example #8
0
        public static void Start(ApplicationThread applicationThread)
        {
            ConsoleThread consoleThread = new ConsoleThread();

            consoleThread.ApplicationThread = applicationThread;
            Thread oThread = new Thread(new ThreadStart(consoleThread.ReadLine));

            oThread.Start();
            oThread.Join();
        }
        private GameApplication()
        {
            Terrain           = new TerrainApplication();
            ConnectionManager = new ConnectionManagerApplication();
            SocketController  = new SocketControllerApplication("127.0.0.1", 8080);
            //registra comunicação com o terreno
            foreach (var action in Terrain.SocketMessageTypes)
            {
                SocketController.RegisterMessageType(action);
            }

            var updateChunksProcess = new ApplicationThread(100);

            //update thread event
            updateChunksProcess.OnRun += (obj) =>
            {
                string error;
                if (!Terrain.UpdateChunks(out error))
                {
                    Log(error);
                }
            };
            updateThreads.Add(updateChunksProcess);


            var updateBlocksProcess = new ApplicationThread(100);

            //update thread event
            updateBlocksProcess.OnRun += (obj) =>
            {
                string error;
                if (!Terrain.UpdateBlocks(out error))
                {
                    Log(error);
                }
            };
            updateThreads.Add(updateBlocksProcess);

            var updateApplication = new ApplicationThread(100);

            //update thread event
            updateApplication.OnRun += (obj) =>
            {
                string error;
                if (!Terrain.UpdateBlocks(out error))
                {
                    Log(error);
                }
            };
            updateThreads.Add(updateApplication);
        }
Example #10
0
        public GameApplication()
        {
            Terrain          = new TerrainApplication();
            SocketController = new SocketControllerApplication("127.0.0.1", 8080);

            foreach (var action in Terrain.SocketMessageTypes)
            {
                SocketController.RegisterMessageType(action);
            }

            var updateApplication = new ApplicationThread(100);

            //update thread event
            updateApplication.OnRun += (obj) =>
            {
                string updateError;
                if (!Update(out updateError))
                {
                    Log(updateError);
                }
            };
            updateThreads.Add(updateApplication);
        }
 public PerThreadScopedStorage(ApplicationThread current_thread)
 {
     this.current_thread = current_thread;
 }