public BattleshipGameForm(ref LocalClient client, int ID)
 {
     InitializeComponent();
     Text += " - " + client.Username;
     InitGrid(EnemyGrid);
     AssignGridClickEvent(EnemyGrid, false);
     InitGrid(PlayerGrid);
     AssignGridClickEvent(PlayerGrid, true);
     shipPositions = new GridPosition[5, 2];
     this.client = client;
     this.client.CommandRecieved += new CommandRecievedEventHandler(GameCommandRecieved);
     gameID = ID;
     gridTarget = new GridPosition(-1, -1);
 }
        public ChatForm(ref LocalClient client, LoginForm parent)
        {
            InitializeComponent();

            AcceptButton = btnSend;

            this.parent = parent;
            clientList = new List<string>();
            this.client = client;
            Text += " - " + client.Username;
            this.client.CommandRecieved += new CommandRecievedEventHandler(CommandRecieved);
            this.client.ConnectionLost += new ServerConnectionLostEventHandler(ConnectionLost);
            this.client.RequestClientList();
            lblWins.Text = "Your Wins: " + this.client.Wins;
            lblLosses.Text = "Your Losses: " + this.client.Losses;
        }
 private void btnLogin_Click(object sender, EventArgs e)
 {
     if (txtServerIP.Text.Trim() == "")
     {
         MessageBox.Show("IP field is blank!", "Invalid IP", MessageBoxButtons.OK);
     }
     else if (txtServerPort.Text.Trim() == "")
     {
         MessageBox.Show("Port field is blank!", "Invalid Port", MessageBoxButtons.OK);
     }
     else
     {
         client = new LocalClient(IPAddress.Parse(txtServerIP.Text.Trim()), Int32.Parse(txtServerPort.Text), "N/A");
         client.CommandRecieved += new CommandRecievedEventHandler(CommandRecieved);
         client.ConnectionSuccessful += new SuccessfulConnectionEventHandler(ConnectionSuccessful);
         client.ConnectionUnsuccessful += new UnsuccsessfulConnectionEventHandler(ConnectionUnsuccessful);
         LoginToServer();
     }
 }