/// <summary>
        /// Se encontro un server
        /// </summary>
        internal void addServerToList(TgcSocketClient.TgcAvaliableServer server)
        {
            dataGridViewAvaliableServers.Rows.Add(dataGridViewAvaliableServers.Rows.Count,
                                                  server.HostName,
                                                  server.Ip);

            //seleccionar el primer elemento de la tabla
            dataGridViewAvaliableServers.Enabled          = true;
            dataGridViewAvaliableServers.Rows[0].Selected = true;
            dataGridViewAvaliableServers_RowEnter(null, null);
        }
 /// <summary>
 /// Agregar un server a mano
 /// </summary>
 private void buttonAddServer_Click(object sender, EventArgs e)
 {
     string textIp = textBoxAddServer.Text;
     IPAddress ip;
     bool result = IPAddress.TryParse(textIp, out ip);
     if (result)
     {
         TgcSocketClient.TgcAvaliableServer server = new TgcSocketClient.TgcAvaliableServer("Manual", ip.ToString());
         networkingControl.AvaliableServers.Add(server);
         dataGridViewAvaliableServers.Rows.Add(new object[] { dataGridViewAvaliableServers.Rows.Count, server.HostName, server.Ip });
         dataGridViewAvaliableServers.Enabled = true;
         dataGridViewAvaliableServers.Rows[0].Selected = true;
         dataGridViewAvaliableServers_RowEnter(null, null);
     }
     else
     {
         MessageBox.Show(this, "La IP ingresada es incorrecta", "Add Server", MessageBoxButtons.OK, MessageBoxIcon.Error);
         textBoxAddServer.Text = "";
     }
 }
        /// <summary>
        /// Agregar un server a mano
        /// </summary>
        private void buttonAddServer_Click(object sender, EventArgs e)
        {
            string    textIp = textBoxAddServer.Text;
            IPAddress ip;
            bool      result = IPAddress.TryParse(textIp, out ip);

            if (result)
            {
                TgcSocketClient.TgcAvaliableServer server = new TgcSocketClient.TgcAvaliableServer("Manual", ip.ToString());
                networkingControl.AvaliableServers.Add(server);
                dataGridViewAvaliableServers.Rows.Add(new object[] { dataGridViewAvaliableServers.Rows.Count, server.HostName, server.Ip });
                dataGridViewAvaliableServers.Enabled          = true;
                dataGridViewAvaliableServers.Rows[0].Selected = true;
                dataGridViewAvaliableServers_RowEnter(null, null);
            }
            else
            {
                MessageBox.Show(this, "La IP ingresada es incorrecta", "Add Server", MessageBoxButtons.OK, MessageBoxIcon.Error);
                textBoxAddServer.Text = "";
            }
        }
Exemple #4
0
 /// <summary>
 /// Agregar server encontrado a la lista de servers disponibles
 /// </summary>
 internal void addServerToList(TgcSocketClient.TgcAvaliableServer server)
 {
     serversDialog.addServerToList(server);
 }
 /// <summary>
 /// Conectarse a un server en particular
 /// </summary>
 internal bool connectToServer(int serverIndex, string clientName)
 {
     TgcSocketClient.TgcAvaliableServer server = avaliableServers[serverIndex];
     client.initializeClient(clientName);
     return(client.connect(server.Ip, this.port));
 }