예제 #1
0
        private Program()
        {
            //com = ComFactory.MakeDefault();
            com = ComFactory.MakeDummy();
            com.setOnRead(tempOnRead);

            Task.Delay(0).ContinueWith((t) =>
            {
                string cmd;
                while (true)
                {
                    cmd = Console.ReadLine();
                    Console.WriteLine("echo: " + cmd);
                    if (cmd.Equals("x"))
                    {
                        break;
                    }

                    if (cmd.Equals("r"))
                    {
                        com.Send(ComData.RequestClose());
                        continue;
                    }

                    com.Send(new ComData(cmd));
                }

                Console.WriteLine("close");
                EventBulletin.GetInstance().Notify(EventBulletin.Event.CLOSE, null, null);
            });

            controllerDefault = ControllerFactory.MakeDefault(com);
            mainWindow        = new MainWindow(controllerDefault);
            mainWindow.Show();

            EventBulletin.Subscribe(EventBulletin.Event.CLOSE, (o, e) => { tempOnClose(); });

            app = new Application();
            app.Run(mainWindow);
        }