예제 #1
0
파일: Form1.cs 프로젝트: wshanshan/DDD
        public Form1(string simModel, string host, string port, string user)
        {
            InitializeComponent();
            userID = user;
            hostName = host;
            portNumber = port;
            simModelName = simModel;
            simModelInfo = smr.readModel(simModelName);
            AddToTextBoxText("Welcome " + userID + ".");
            server = new NetworkClient();
            server.Connect(hostName, Convert.ToInt32(portNumber));
            SimulationEventDistributor dist = new SimulationEventDistributor(ref simModelInfo);
            SimulationEventDistributorClient cc = new SimulationEventDistributorClient();

            dist.RegisterClient(ref cc);
            server.Subscribe("TextChat");
            isRunning = true;
            waitForEventsThread = new Thread(new ThreadStart(WaitForEvents));
            waitForEventsThread.Start();

        }
예제 #2
0
        /// <summary>
        /// Constructs a watcher
        /// </summary>
        /// <param name="inputDelta">Time to sleep between checking ticks</param>
        public TickWatcher(NetworkClient s, string simModel)
        {
            string simModelName = simModel;
            simModelInfo = smr.readModel(simModelName);
            server = s;
            SimulationEventDistributor dist = new SimulationEventDistributor(ref simModelInfo);
            SimulationEventDistributorClient cc = new SimulationEventDistributorClient();

            dist.RegisterClient(ref cc);/////////////////
            server.Subscribe("TimeTick");


        }