private void InitializeAgent()
        {
            if (!useOldAgent)
            {
                agent = new NewAgent(ipAddress, portNumber);
            }
            else
            {
                agent = new OldAgent(ipAddress, portNumber);
            }

            agent.AgentStatus            += new EventHandler <AbstractAgent.AgentStatusEventArgs>(agent_AgentStatus);
            agent.DisconnectedFromServer += new EventHandler <EventArgs>(agent_DisconnectedFromServer);
        }
Beispiel #2
0
 /*Public Interface*/
 public NetworkUnit(AbstractAgent agent)
 {
     this.agent = agent;
     REVEAL_AND_MARK_COMMAND = new TcpCommunications.MinesweeperCommands.MinesweeperCommand(TcpCommunications.MinesweeperCommands.MinesweeperCommand.CommandType.REVEAL_AND_MARK);
     NEW_GAME_COMMAND        = new TcpCommunications.MinesweeperCommands.MinesweeperCommand(TcpCommunications.MinesweeperCommands.MinesweeperCommand.CommandType.NEW_GAME);
 }
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     useOldAgent = comboBox1.SelectedIndex == 0;
     agent       = null;
 }