private void abrirVentanaToolStripMenuItem_Click(object sender, EventArgs e) { if (dataGridView1.Rows.Count > 0) { PanelDeControl ventana = new PanelDeControl(); ventana.Show(); ventana.Text = dataGridView1.SelectedRows[0].Cells["HashSocket"].Value.ToString(); ventana.Tag = dataGridView1.SelectedRows[0].Cells["HashSocket"].Value.ToString(); } }
private void abrirVentanaToolStripMenuItem_Click(object sender, EventArgs e) { if (dataGridView1.Rows.Count > 0) { PanelDeControl ventana = new PanelDeControl(); Funciones x = new Funciones(); ventana.Text = x.FormarCadena(dataGridView1); ventana.Tag = dataGridView1.SelectedRows[0].Cells["HashSocket"].Value.ToString(); _msc.MostrarMdi(ActiveForm, ventana, "PanelDeControl", Convert.ToString(ventana.Tag)); } }
private void RunClient() { NetworkStream networkStream; StreamWriter streamWriter; StreamReader streamReader; StringBuilder strInput; var socketNuevo = socketForServer; networkStream = new NetworkStream(socketNuevo); streamReader = new StreamReader(networkStream); streamWriter = new StreamWriter(networkStream); strInput = new StringBuilder(); while (true) { try { strInput.Append(streamReader.ReadLine()); strInput.Append("\r\n"); } catch (Exception err) { Cleanup(socketNuevo, streamReader, streamWriter, networkStream); DisplayMessage("<Error en conexion: " + err.Message + " " + socketNuevo.GetHashCode() + ">\n"); break; } string cadenaEvaluar = EvaluaCadena(strInput, socketNuevo); if (cadenaEvaluar.Length == 0) // Evitar repeticion de datos { if (strInput.ToString().Length == 2) { if (socketNuevo == SocketRepeticion) { contRepeticion++; } else { contRepeticion = 0; } SocketRepeticion = socketNuevo; if (contRepeticion > 5) { contRepeticion = 0; DisplayMessage("<Conexion perdida con: " + socketNuevo.GetHashCode() + ">\n"); string formarCadena273 = "273 " + ObtenerNickPorHash(socketNuevo.GetHashCode().ToString()); EnviarBroadCast(formarCadena273, socketNuevo.GetHashCode().ToString(), ObtenerCanalPorHash(socketNuevo.GetHashCode().ToString())); EliminarClienteLista(socketNuevo); Cleanup(socketNuevo, streamReader, streamWriter, networkStream); break; } } DisplayMessage(strInput.ToString()); } else { FormCollection fc = Application.OpenForms; foreach (Form frm in fc) { if (frm.Tag.ToString() == cadenaEvaluar) { PanelDeControl pnlControl = (PanelDeControl)frm; Application.DoEvents(); pnlControl.textBox1.AppendText(strInput.ToString()); //MessageBox.Show(@"Form Encontrada para sck"); } } } Application.DoEvents(); strInput.Remove(0, strInput.Length); } //CleanupGeneral(); }