private void button2_Click(object sender, EventArgs e) { Form3 fm3 = new Form3(); fm3.ShowDialog(); dolo +=1; label1.Text = " " + dolo; }
private void button2_Click(object sender, EventArgs e) { Form3 frmdeutsch = new Form3(); this.Hide(); frmdeutsch.ShowDialog(); this.Close(); }
private void button3_Click(object sender, EventArgs e) { db.connect(); DataSet ds2 = new DataSet(); Form3 supplieraddForm = new Form3(); if (supplieraddForm.ShowDialog() == DialogResult.OK) { comboBox1.DataSource = null; comboBox1.Items.Clear(); db.dataSet(ds2, "suppliertable", db.con); dRow = new DataRow[ds2.Tables["suppliers"].Rows.Count]; for (int i = 0; i < ds2.Tables["suppliers"].Rows.Count; i++) { dRow[i] = ds2.Tables["suppliers"].Rows[i]; } System.Object[] SupplierObject = new System.Object[dRow.Length]; for (int i = 0; i < dRow.Length; i++) { SupplierObject[i] = dRow[i].ItemArray.GetValue(1).ToString(); } comboBox1.Items.AddRange(SupplierObject); comboBox1.SelectedIndex = comboBox1.Items.Count - 1; } }
private void button2_Click(object sender, System.EventArgs e) { //XmlDocument xml = new XmlDocument(); XmlReader reader = XmlReader.Create("http://openapi.naver.com/search?key=244f0fbe47576aa19d05fc5a79ebd70f&query=" + textBox1.Text + "&display=5&start=1&target=shop&sort=sim"); if (reader != null) { reader.ReadToFollowing("lprice"); string value = reader.ReadElementContentAsString(); label2.Text = value; } /* XmlReader reader_3 = XmlReader.Create("http://openapi.naver.com/search?key=244f0fbe47576aa19d05fc5a79ebd70f&query=" + textBox1.Text + "&display=5&start=1&target=shop&sort=sim"); reader_3.ReadToFollowing("lprice"); string value_3 = reader_3.ReadElementContentAsString(); label4.Text = value_3; XmlReader reader_4 = XmlReader.Create("http://openapi.naver.com/search?key=244f0fbe47576aa19d05fc5a79ebd70f&query=" + textBox1.Text + "&display=5&start=1&target=shop&sort=sim"); reader_4.ReadToFollowing("lprice"); string value_4 = reader_4.ReadElementContentAsString(); label5.Text = value_4; */ Form3 frmForm3 = new Form3(label2.Text, label3.Text, label4.Text, label5.Text); frmForm3.ShowDialog(); }
private void addSupplierToolStripMenuItem_Click(object sender, EventArgs e) { Form3 supplieraddForm = new Form3(); if (supplieraddForm.ShowDialog() == DialogResult.OK) { generatesupplierlist(); } }
private void button1_Click(object sender, EventArgs e) { Person p = new Person(Convert.ToInt32(textBox4.Text), textBox1.Text, Convert.ToInt32(textBox2.Text),textBox3.Text); new PersonAction().add(p); Form myForm = new Form3(); myForm.ShowDialog(); }
private void button3_Click(object sender, EventArgs e) { textBox1.ForeColor = Color.Black; using (connection = new MySqlConnection(ConnectionString)) { try { Mi_DataSet.Clear(); Mi_DataSet.Tables.Clear(); dataGridView1.Columns.Clear(); //Limpiamos el datagridview if (boton_consultar.Checked) //si hacemos una consulta { if ((Tabla_sel == null)|| (Tabla_sel == "")) { if ( idioma ) MessageBox.Show(fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/errorSeleccion1").InnerText, fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/errorSeleccion2").InnerText); else MessageBox.Show(fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/errorSeleccion1").InnerText, fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/errorSeleccion2").InnerText); return; } QueryString = "Select * from "+ Tabla_sel; //se realizará un Select * connection.Open(); adapter = new MySqlDataAdapter(QueryString, ConnectionString); adapter.Fill(Mi_DataSet); dataGridView1.DataSource = Mi_DataSet.Tables[0]; dataGridView1.AutoResizeColumns(); bindingSource1.DataSource = Mi_DataSet.Tables[0]; dataGridView1.ReadOnly = true; //Se pone el datagridview en modo solo lectura if (idioma) textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/ConsultaOK").InnerText; else textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/ConsultaOK").InnerText; usuarios = false; get_table_name_Click(sender, e); } else { if (boton_borrar.Checked) //Si queremos eliminar una tabla { usuarios = false; //Se lanza la ventana para pedir confirmación Form2 confirmacion = new Form2(Tabla_sel); if (confirmacion.ShowDialog(this) == DialogResult.Yes) { NonQueryString = "DROP TABLE " + Tabla_sel; command = connection.CreateCommand(); command.CommandText = NonQueryString; connection.Open(); adapter = new MySqlDataAdapter(command); command.ExecuteNonQuery(); if (idioma) textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/ElimTabla1").InnerText + Tabla_sel + fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/ElimTabla2").InnerText; else textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/ElimTabla1").InnerText + Tabla_sel + fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/ElimTabla2").InnerText; comboBox1.ResetText(); get_table_name_Click(sender, e); } } else { if (boton_modificar.Checked) { usuarios = false; //PRIMERO RECUPERAMOS LA TABLA QueryString = "SELECT * from " + Tabla_sel; queryDataSet = "SELECT * from " + Tabla_sel; //se realizará un Select * connection.Open(); adapter = new MySqlDataAdapter(QueryString, ConnectionString); adapter.Fill(Mi_DataSet); dataGridView1.DataSource = Mi_DataSet.Tables[0]; dataGridView1.AutoResizeColumns(); bindingSource1.DataSource = Mi_DataSet.Tables[0]; dataGridView1.ReadOnly = false; button4.Visible = true; if (idioma) textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/RecTabla").InnerText; else textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/RecTabla").InnerText; } else { if (boton_insertar.Checked) { usuarios = false; Form3 crear = new Form3(idioma); // Mostramos la ventana de creación de tabla if (crear.ShowDialog(this) == DialogResult.OK) { command = connection.CreateCommand(); command.CommandText = crear.sentencia; connection.Open(); adapter = new MySqlDataAdapter(command); command.ExecuteNonQuery(); if (idioma) textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/CreateTabla").InnerText; else textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/CreateTabla").InnerText; get_table_name_Click(sender, e); } } else { if (consultar_usuarios.Checked) { usuarios = true; QueryString = "select Host,User,Password,Select_priv,Insert_priv, Update_priv,Delete_priv,"+ "Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv," + "References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, "+ "Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv, Create_view_priv,"+ "Show_view_priv, Create_routine_priv, Alter_routine_priv, Create_user_priv, Event_priv,"+ "Trigger_priv, Create_tablespace_priv, ssl_type, max_questions, max_updates, max_connections, "+ "max_user_connections, plugin from mysql.user;"; //se realizará un Select * connection.Open(); adapter = new MySqlDataAdapter(QueryString, ConnectionString); adapter.Fill(Mi_DataSet); dataGridView1.DataSource = Mi_DataSet.Tables[0]; dataGridView1.AutoResizeColumns(); bindingSource1.DataSource = Mi_DataSet.Tables[0]; dataGridView1.ReadOnly = true; //Se pone el datagridview en modo solo lectura if (idioma) textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/ConsultaOK").InnerText; else textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/ConsultaOK").InnerText; usuarios = true; get_table_name_Click(sender, e); } else { if (crear_usuarios.Checked) { usuarios = true; Form5 crear = new Form5(idioma, servidor); // Mostramos la ventana de creación de usuario if (crear.ShowDialog(this) == DialogResult.OK) { command = connection.CreateCommand(); command.CommandText = crear.sentencia; connection.Open(); adapter = new MySqlDataAdapter(command); command.ExecuteNonQuery(); if (idioma) textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/CreateUsuario").InnerText; else textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/CreateUsuario").InnerText; get_table_name_Click(sender, e); } } else { if (mod_usuarios.Checked) { usuarios = true; // PRIMERO RECUPERAMOS LA TABLA // Con los parámetros necesarios (hay valores que son irrelevantes y dan problemas) QueryString = "select Host,User,Password,Select_priv,Insert_priv, Update_priv,Delete_priv," + "Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv," + "References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, " + "Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv, Create_view_priv," + "Show_view_priv, Create_routine_priv, Alter_routine_priv, Create_user_priv, Event_priv," + "Trigger_priv, Create_tablespace_priv, ssl_type, max_questions, max_updates, max_connections, " + "max_user_connections, plugin from mysql.user;"; queryDataSet = "select Host,User,Password,Select_priv,Insert_priv, Update_priv,Delete_priv," + "Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv," + "References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, " + "Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv, Create_view_priv," + "Show_view_priv, Create_routine_priv, Alter_routine_priv, Create_user_priv, Event_priv," + "Trigger_priv, Create_tablespace_priv, ssl_type, max_questions, max_updates, max_connections, " + "max_user_connections, plugin from mysql.user;"; //se realizará un Select * connection.Open(); adapter = new MySqlDataAdapter(QueryString, ConnectionString); adapter.Fill(Mi_DataSet); dataGridView1.DataSource = Mi_DataSet.Tables[0]; dataGridView1.AutoResizeColumns(); bindingSource1.DataSource = Mi_DataSet.Tables[0]; dataGridView1.ReadOnly = false; button4.Visible = true; if (idioma) textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/CambGuardado").InnerText; else textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/CambGuardado").InnerText; } else { if (eliminiar_usuarios.Checked) { usuarios = true; //Se lanza la ventana para pedir confirmación Form2 confirmacion = new Form2(Tabla_sel); if (confirmacion.ShowDialog(this) == DialogResult.Yes) { NonQueryString = "DROP USER " + Tabla_sel; command = connection.CreateCommand(); command.CommandText = NonQueryString; connection.Open(); adapter = new MySqlDataAdapter(command); command.ExecuteNonQuery(); if (idioma) textBox1.Text = fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/ElimUsuario1").InnerText + Tabla_sel + fichero.SelectSingleNode("/localizacion/es/ventanaprincipal/ElimUsuario2").InnerText; else textBox1.Text = fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/ElimUsuario1").InnerText + Tabla_sel + fichero.SelectSingleNode("/localizacion/en/ventanaprincipal/ElimUsuario2").InnerText; comboBox1.ResetText(); get_table_name_Click(sender, e); } } } } } } } } } } catch (Exception ex) { textBox1.ForeColor = Color.Red; textBox1.Text = ex.Message; } } }
//private void PonConectados(string [] trozos) //{ // int n = Convert.ToInt32(trozos[1]); // int i = 0; // dataGridView1.Rows.Clear(); // dataGridView1.Refresh(); // while (i < n) // { // if (i < n - 1) // { // dataGridView1.Rows.Add(); // } // dataGridView1.Rows[i].Cells[0].Value = trozos[i + 2]; // i++; // } //} private void AtenderServidor() { while (true) { //Recibimos la respuesta del servidor byte[] msg2 = new byte[80]; server.Receive(msg2); string [] trozos = Encoding.ASCII.GetString(msg2).Split('/'); int numtrozos = trozos.Length; int codigo = Convert.ToInt32(trozos[0]); string mensaje; int nForm; switch (codigo) { case 1: //Registra al nuevo usuario mensaje = trozos[1].Split('\0')[0]; Enviar de = new Enviar(PonMensaje); this.Invoke(de, new object[] { mensaje }); if (mensaje == "Usuario registrado") { ThreadStart ts = delegate { PonerEnMarchaFormulario4(); }; Thread T = new Thread(ts); T.Start(); } break; case 2: //Inicia sesión mensaje = trozos[1].Split('\0')[0]; de = new Enviar(PonMensaje); this.Invoke(de, new object[] { mensaje }); if (mensaje == "Usuario iniciado") { ThreadStart ts = delegate { PonerEnMarchaFormulario4(); }; Thread T = new Thread(ts); T.Start(); } else { MessageBox.Show("Vuelve a intentarlo, los datos son incorrectos"); } break; case 3: //Consulta el jugador que ganó en menor tiempo mensaje = trozos[1].Split('\0')[0]; nForm = Convert.ToInt32(trozos[1]); mensaje = trozos[2]; formularios[nForm].TomaJugador(mensaje); //de = new Enviar(PonMensaje); //this.Invoke(de, new object[] { mensaje }); //MessageBox.Show(mensaje); break; case 4: //Consulta el menor tiempo en ganar del jugador "usuario" mensaje = trozos[1].Split('\0')[0]; nForm = Convert.ToInt32(trozos[1]); mensaje = trozos[2]; formularios[nForm].TomaTiempo(mensaje); //de = new Enviar(PonMensaje); //this.Invoke(de, new object[] { mensaje }); //MessageBox.Show(mensaje); break; case 5: //Consulta el número de partidas ganadas por el jugador "usuario" mensaje = trozos[1].Split('\0')[0]; nForm = Convert.ToInt32(trozos[1]); mensaje = trozos[2]; formularios[nForm].TomaPartidas(mensaje); //de = new Enviar(PonMensaje); //this.Invoke(de, new object[] { mensaje }); //MessageBox.Show(mensaje); break; case 6: //Notificación lista conectados //EnviarTrozos de1 = new EnviarTrozos(PonConectados); //this.Invoke(de1, new object[] { trozos }); mensaje = trozos[2].Split('\0')[0]; if (mensaje != "0") { nForm = Convert.ToInt32(trozos[1]); int i = 3; while (i < trozos.Length) { mensaje = mensaje + "/" + trozos[i]; i++; } formularios[nForm].TomaConectados(mensaje); } break; case 7: //Recibe invitación del invitador string invitador = trozos[3].Split('\0')[0]; nForm = Convert.ToInt32(trozos[1]); string letra = trozos[2]; Form2 f2 = new Form2(); f2.enviado += new Form2.Enviar(Ejecutar); f2.textBox1.Text = invitador; f2.textBox2.Text = letra; f2.ShowDialog(); if (textBox3.Text == "Rechazada") { string mensaje2 = "7/" + nForm + "/Rechazada/" + invitador; // Enviamos al servidor byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje2); server.Send(msg); } else { string mensaje2 = "7/" + nForm + "/Aceptada/" + letra + "/" + invitador; //Enviamos al servidor byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje2); server.Send(msg); } break; case 8: //Recibe contestación del invitado mensaje = trozos[3].Split('\0')[0]; nForm = Convert.ToInt32(trozos[1]); if (trozos[2] == "Rechazada") { string invitado = trozos[3]; MessageBox.Show(": ha finalizado la partida", invitado); } else { string invitado = trozos[4]; letra = trozos[3]; Form3 f3 = new Form3(); f3.enviado += new Form3.Enviar(Ejecutar); f3.textBox1.Text = invitado; f3.label8.Text = letra; f3.ShowDialog(); if (textBox3.Text == "Rechazada") { string mensaje2 = "8/" + nForm + "/Rechazada/" + invitado; // Enviamos al servidor byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje2); server.Send(msg); } else { string mensaje2 = "8/" + nForm + "/Aceptada/" + letra + "/" + f3.textBox2.Text + "/" + f3.textBox3.Text + "/" + f3.textBox4.Text + "/" + f3.textBox5.Text + "/" + f3.textBox6.Text + "/" + invitado; //Enviamos al servidor byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje2); server.Send(msg); } } break; case 9: //recibe contestación del invitador mensaje = trozos[2].Split('\0')[0]; nForm = Convert.ToInt32(trozos[1]); if (trozos[2] == "Rechazada") { string invitador2 = trozos[3]; MessageBox.Show(": ha finalizado la partida", invitador2); } else { string invitador2 = trozos[9]; letra = trozos[3]; Form3 f3 = new Form3(); f3.enviado += new Form3.Enviar(Ejecutar); f3.textBox1.Text = invitador2; f3.label8.Text = letra; f3.textBox2.Text = trozos[4]; f3.textBox3.Text = trozos[5]; f3.textBox4.Text = trozos[6]; f3.textBox5.Text = trozos[7]; f3.textBox6.Text = trozos[8]; f3.ShowDialog(); if (textBox3.Text == "Rechazada") { string mensaje2 = "8/" + nForm + "/Rechazada/" + invitador2; // Enviamos al servidor byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje2); server.Send(msg); } else { string mensaje2 = "8/" + nForm + "/Aceptada/" + letra + "/" + f3.textBox2.Text + "/" + f3.textBox3.Text + "/" + f3.textBox4.Text + "/" + f3.textBox5.Text + "/" + f3.textBox6.Text + "/" + invitador2; //Enviamos al servidor byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje2); server.Send(msg); } } break; //case 10: //Elimina al usuario // mensaje = trozos[1].Split('\0')[0]; // de = new Enviar(PonMensaje); // this.Invoke(de, new object[] { mensaje }); // break; } } }
private void next_Click(object sender, EventArgs e) { #region Field_Data //Collecting The User Data store_data1[0] = emergency_contact.Text; store_data1[1] = emergency_contact_phone_number.Text; store_data1[2] = current_address.Text; store_data1[3] = permanent_address.Text; //Local Variables int x; double xx = 0; bool test; //The flag boolean is individual detection for errors from all 15 fields of entries bool[] flag = new bool[4] { true, true, true, true }; String message = ""; #endregion #region Code_Checker //Check Cases //Emergency Contact Name Checker - 0 x = store_data1[0].Length; if (x < 10) { flag[0] = false; message += "Emergency Contact Name must be atleast 10 characters long.\n\n"; } // //Emergency Contact Mobile Number Checker - 1 if (store_data1[1].Length != 10) { flag[1] = false; } else { test = double.TryParse(store_data1[1].Substring(0, 10), out xx); if (!test) // Checks if the 10 characters are digits { flag[1] = false; } } if (!flag[1]) { message += "Mobile Number wrongly entered, it is 10 digits number.\n\n"; } // //Current Address Checker - 2 x = store_data1[2].Length; if (x < 15) { flag[2] = false; message += "Current Address must be atleast 15 characters long.\n\n"; } // //Permanent Address Checker - 3 x = store_data1[3].Length; if (x < 15) { flag[3] = false; message += "Permanent Address must be atleast 15 characters long.\n\n"; } // //Two Vehicles x = (int)(two_vehicles_counter.Value); if ((x > 0) && (recieve[0] == "Not Entered")) { message += "2 Wheeler Vehice License Plates Not Entered.\n\n"; } // //Four Vehicles x = (int)(four_vehicles_counter.Value); if ((x > 0) && (recieve[1] == "Not Entered")) { message += "4 Wheeler Vehice License Plates Not Entered.\n\n"; } #endregion #region Form_Jump if (message != "") { MessageBox.Show(message, "ERROR - Please resolve the below mentioned problems!", MessageBoxButtons.OK, MessageBoxIcon.Error); message = ""; for (int i = 0; i <= 3; ++i) //set all flags false { flag[i] = true; } } else { String temporary = String.Format("Emergency Contact Name : {0}\nEmergency Contact Phone Number : {1}\nCurrent Address : {2}\nPermanent Address : {3}\n2 wheeler vehicles license plate : {4}\n4 wheeler vehicles license plate : {5}", store_data1[0], store_data1[1], store_data1[2], store_data1[3], recieve[0], recieve[1]); DialogResult ab = MessageBox.Show(temporary, "Are You Sure!", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);//Make Sure if (ab == DialogResult.Yes) { this.Hide(); store_data1[4] = recieve[0]; store_data1[5] = recieve[1]; Form3 form3 = new Form3(back_form1, store_data1); form3.ShowDialog(); this.Close(); } } #endregion }
private void pROJECTDETAILSToolStripMenuItem_Click(object sender, EventArgs e) { Form3 form = new Form3(); form.ShowDialog(); }
private void Form1_Load(object sender, EventArgs e) { Form3 frm3 = new Form3();//about frm3.ShowDialog(); }
private void button1_Click_1(object sender, EventArgs e) { Form3 frm = new Form3(); frm.ShowDialog(); }
//private void Formcap_KeyDown(object sender, KeyEventArgs e) //{ // if (!keyDownTimes.ContainsKey(e.KeyCode)) // { // keyDownTimes[e.KeyCode] = DateTime.Now; // //seqStr.Append("+in(" + e.KeyValue + "," );"); // } //} //private void Formcap_KeyUp(object sender, KeyEventArgs e) //{ // if (keyDownTimes.ContainsKey(e.KeyCode)) // { // keyDurations[e.KeyCode] = keyDownTimes[e.KeyCode] - DateTime.Now; // keyDownTimes.Remove(e.KeyCode); // seqStr.Append("in(" + e.KeyValue + "," + Math.Round(keyDurations[e.KeyCode].Duration().TotalMilliseconds) + ");"); // Debug.WriteLine("key : " + e.KeyCode + " -- keyValue : " + e.KeyValue + "\ntime : " + Math.Round(keyDurations[e.KeyCode].Duration().TotalMilliseconds)); // } //} public void repetAppend() { Form3 dialog2 = new Form3(); dialog2.changeLabelRepets(); dialog2.ShowDialog(); seqStr.Append(" rp(" + dialog2.nombreTxtBox + ");"); dialog2.Dispose(); }
private void label3_Click(object sender, EventArgs e) { this.Hide(); Form3 p2 = new Form3(); p2.ShowDialog(); }
// Load Trainer Editor private void button14_Click(object sender, EventArgs e) { Form3 trainerEditor = new Form3(); trainerEditor.ShowDialog(this); }
public void attendreAppend() { Form3 dialog = new Form3(); dialog.changeLabelAttendre(); dialog.ShowDialog(); nombreDuFormulaire = dialog.nombreTxtBox; seqStr.Append(" wt(" + nombreDuFormulaire * 1000 + ");"); dialog.Dispose(); }
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Form3 form3 = new Form3(); form3.ShowDialog(); }
/// <summary> /// О программе /// </summary> /// <param name="sender">Стандарт 2</param> /// <param name="e">Стандарт 1</param> private void ОПрограммеToolStripMenuItem_Click(object sender, EventArgs e) { Form3 secondForm = new Form3(); secondForm.ShowDialog(); }
private void button2_Click(object sender, EventArgs e) { if (SignUp.Checked) { Form2 F2 = new Form2(); F2.ShowDialog(); nombre = F2.SetNombre(); usuario = F2.SetUsuario(); contraseña = F2.SetContraseña(); // Quiero saber si me he podido dar de alta o no string mensaje = "1/" + nombre + "/" + usuario + "/" + contraseña; // Enviamos al servidor el nombre tecleado byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje); server.Send(msg); } else if (LogIn.Checked) { Form3 F3 = new Form3(); F3.ShowDialog(); user_login = F3.SetUser(); password_login = F3.SetPassword(); // Quiere loguearse string mensaje = "2/" + user_login + "/" + password_login; // Enviamos al servidor el nombre tecleado byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje); server.Send(msg); } else if (consulta_fecha.Checked) { Form4 F4 = new Form4(); F4.ShowDialog(); fecha = F4.getFecha(); string mensaje = "3/" + fecha; // Enviamos al servidor el nombre tecleado byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje); server.Send(msg); } else if (consulta_duracion.Checked) { Form5 F5 = new Form5(); F5.ShowDialog(); duracion = F5.getDuracion(); string mensaje = "4/" + duracion; // Enviamos al servidor la duracion que nos han pasado por consola byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje); server.Send(msg); } else if (consulta_lista.Checked) { string mensaje = "5/"; // Enviamos el código pertinente a la solicitud byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje); server.Send(msg); } else if (invitar.Checked) { Form6 F6 = new Form6(); F6.setListado(conectados); F6.ShowDialog(); string invitados = F6.GetListado(); string mensaje = "6/" + usuario + "/" + invitados; // 6/anakilator/1/juanito23 byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje); server.Send(msg); } }
private void назначитьВремяПациентуToolStripMenuItem1_Click(object sender, EventArgs e) { Form3 newForm3 = new Form3(); newForm3.ShowDialog(); dateTimePicker1.MinDate = DateTime.Today; List <Pacients> GetTime = dal.GetTimePac(); List <Doctors> GetDoc = dal.GetDoctors(); List <long> PriemPacients = dal.GetPriemPacients(); dataGridView2.Rows.Clear(); for (int i = 0; i < GetDoc.Count; i++) { dataGridView2.Rows.Add(); dataGridView2.Rows[i].Cells[1].Value = GetDoc[i].DocName; //dataGridView2.Columns["Column1"] =GetDoc[i].DocName; dataGridView2.Rows[i].Cells[0].Value = GetDoc[i].IdD; dataGridView2.Columns["Column1"].Width = 200; } for (int i = 0; i < dataGridView2.RowCount - 1; i++) { for (int j = 0; j < GetTime.Count; j++) { if (GetTime[j].Priem_Day == dateTimePicker1.Value.Day.ToString()) { string ID; ID = dataGridView2.Rows[i].Cells[0].Value.ToString(); if (ID == GetTime[j].IdD.ToString()) { if (GetTime[j].Priem_Hour == "8") { if (GetTime[j].Priem_Min == "00") { dataGridView2.Rows[i].Cells[2].Value = GetTime[j].PacName.ToString(); dataGridView2.Columns["Column2"].Width = 200; } else { if (GetTime[j].Priem_Min == "30") { dataGridView2.Rows[i].Cells[3].Value = GetTime[j].PacName.ToString(); dataGridView2.Columns["Column3"].Width = 200; } } } if (GetTime[j].Priem_Hour == "9") { if (GetTime[j].Priem_Min == "00") { dataGridView2.Rows[i].Cells[4].Value = GetTime[j].PacName.ToString(); dataGridView2.Columns["Column4"].Width = 200; } else { if (GetTime[j].Priem_Min == "30") { dataGridView2.Rows[i].Cells[5].Value = GetTime[j].PacName.ToString(); dataGridView2.Columns["Column5"].Width = 200; } } } if (GetTime[j].Priem_Hour == "10") { if (GetTime[j].Priem_Min == "00") { dataGridView2.Rows[i].Cells[6].Value = GetTime[j].PacName.ToString(); dataGridView2.Columns["Column6"].Width = 200; } else { if (GetTime[j].Priem_Min == "30") { dataGridView2.Rows[i].Cells[7].Value = GetTime[j].PacName.ToString(); dataGridView2.Columns["Column7"].Width = 200; } } } if (GetTime[j].Priem_Hour == "11") { if (GetTime[j].Priem_Min == "00") { dataGridView2.Rows[i].Cells[8].Value = GetTime[j].PacName.ToString(); dataGridView2.Columns["Column8"].Width = 200; } else { if (GetTime[j].Priem_Min == "30") { dataGridView2.Rows[i].Cells[9].Value = GetTime[j].PacName.ToString(); dataGridView2.Columns["Column9"].Width = 200; } } } if (GetTime[j].Priem_Hour == "12") { if (GetTime[j].Priem_Min == "00") { dataGridView2.Rows[i].Cells[10].Value = GetTime[j].PacName.ToString(); dataGridView2.Columns["Column10"].Width = 200; } else { if (GetTime[j].Priem_Min == "30") { dataGridView2.Rows[i].Cells[11].Value = GetTime[j].PacName.ToString(); dataGridView2.Columns["Column11"].Width = 200; } } } if (GetTime[j].Priem_Hour == "13") { if (GetTime[j].Priem_Min == "00") { dataGridView2.Rows[i].Cells[12].Value = GetTime[j].PacName.ToString(); dataGridView2.Columns["Column12"].Width = 200; } else { if (GetTime[j].Priem_Min == "30") { dataGridView2.Rows[i].Cells[13].Value = GetTime[j].PacName.ToString(); dataGridView2.Columns["Column13"].Width = 200; } } } if (GetTime[j].Priem_Hour == "14") { if (GetTime[j].Priem_Min == "00") { dataGridView2.Rows[i].Cells[14].Value = GetTime[j].PacName.ToString(); dataGridView2.Columns["Column14"].Width = 200; } else { if (GetTime[j].Priem_Min == "30") { dataGridView2.Rows[i].Cells[15].Value = GetTime[j].PacName.ToString(); dataGridView2.Columns["Column15"].Width = 200; } } } if (GetTime[j].Priem_Hour == "15") { if (GetTime[j].Priem_Min == "00") { dataGridView2.Rows[i].Cells[16].Value = GetTime[j].PacName.ToString(); dataGridView2.Columns["Column16"].Width = 200; } else { if (GetTime[j].Priem_Min == "30") { dataGridView2.Rows[i].Cells[17].Value = GetTime[j].PacName.ToString(); dataGridView2.Columns["Column17"].Width = 200; } } } if (GetTime[j].Priem_Hour == "16") { if (GetTime[j].Priem_Min == "00") { dataGridView2.Rows[i].Cells[18].Value = GetTime[j].PacName.ToString(); dataGridView2.Columns["Column18"].Width = 200; } else { if (GetTime[j].Priem_Min == "30") { dataGridView2.Rows[i].Cells[19].Value = GetTime[j].PacName.ToString(); dataGridView2.Columns["Column19"].Width = 200; } } } if (GetTime[j].Priem_Hour == "17") { if (GetTime[j].Priem_Min == "00") { dataGridView2.Rows[i].Cells[20].Value = GetTime[j].PacName.ToString(); dataGridView2.Columns["Column20"].Width = 200; } else { if (GetTime[j].Priem_Min == "30") { dataGridView2.Rows[i].Cells[21].Value = GetTime[j].PacName.ToString(); dataGridView2.Columns["Column21"].Width = 200; } } } if (GetTime[j].Priem_Hour == "18") { if (GetTime[j].Priem_Min == "00") { dataGridView2.Rows[i].Cells[22].Value = GetTime[j].PacName.ToString(); dataGridView2.Columns["Column22"].Width = 200; } else { if (GetTime[j].Priem_Min == "30") { dataGridView2.Rows[i].Cells[23].Value = GetTime[j].PacName.ToString(); dataGridView2.Columns["Column23"].Width = 200; } } } } } } } dataGridView2.Columns["ID"].Visible = false; //this.Close(); }
private void button1_Click(object sender, EventArgs e) { Form3 Rank = new Form3(); Rank.ShowDialog(); }
private void button1_Click_1(object sender, EventArgs e) { string conn = "server=DESKTOP-H3U6B32;uid=sa;pwd=12345678;database=MDB"; SqlConnection connection = new SqlConnection(conn);//连接数据库 connection.Open(); if (radioButton3.Checked == true) { string command = "select count('MID') from permission3 where MID='" + strtxt1 + "'"; SqlCommand mySqlCommand = new SqlCommand(command, connection); int i = Convert.ToInt32(mySqlCommand.ExecuteScalar()); if (i == 0) { MessageBox.Show("用户不存在"); } else { command = "select count('MID') from permission3 where MID='" + strtxt1 + "'and MPW='" + strtxt2 + "'"; SqlCommand sql = new SqlCommand(command, connection); int j = Convert.ToInt32(sql.ExecuteScalar()); if (j != 0) { MessageBox.Show("成功"); Form4 f4 = new Form4(); f4.ShowDialog(); this.Close(); } else { MessageBox.Show("密码错误"); } } } else if (radioButton2.Checked == true) { string command = "select count('TID') from permission2 where TID='" + strtxt1 + "'"; SqlCommand mySqlCommand = new SqlCommand(command, connection); int i = Convert.ToInt32(mySqlCommand.ExecuteScalar()); if (i == 0) { MessageBox.Show("用户不存在"); } else { command = "select count('TID') from permission2 where TID='" + strtxt1 + "'and TPW='" + strtxt2 + "'"; SqlCommand sql = new SqlCommand(command, connection); int j = Convert.ToInt32(sql.ExecuteScalar()); if (j != 0) { MessageBox.Show("成功"); Form3 f3 = new Form3(); f3.ShowDialog(); this.Close(); } else { MessageBox.Show("密码错误"); } } } else if (radioButton1.Checked == true) { string command = "select count('SID') from permission1 where SID='" + strtxt1 + "'"; SqlCommand mySqlCommand = new SqlCommand(command, connection); int i = Convert.ToInt32(mySqlCommand.ExecuteScalar()); if (i == 0) { MessageBox.Show("用户不存在"); } else { command = "select count('SID') from permission1 where SID='" + strtxt1 + "'and SPW='" + strtxt2 + "'"; SqlCommand sql = new SqlCommand(command, connection); int j = Convert.ToInt32(sql.ExecuteScalar()); if (j != 0) { MessageBox.Show("成功"); Form2 f2 = new Form2(); f2.ShowDialog(); this.Close(); } else { MessageBox.Show("密码错误"); } } } }
// Metodo Jogada // private void Jogada_Click(object COMPONENTE, EventArgs e) { // Tabela Emabaralhada // ITEM = ((PictureBox)COMPONENTE).Tag.ToString(); string ITEM_IMG = TABELA[int.Parse(ITEM)].ToString(); string ENDERECO_TXT = string.Concat(LOCAL_TXT_FOTOS, ITEM_IMG, EXT_TXT); string ENDERECO_IMG = string.Concat(LOCAL_TXT_FOTOS, ITEM_IMG, EXT_IMG); // Carregando Imagem e Texto nos componentes // ((PictureBox)COMPONENTE).Image = Bitmap.FromFile(ENDERECO_IMG); ((PictureBox)COMPONENTE).Enabled = false; pictureBox_Visual.Image = Bitmap.FromFile(ENDERECO_IMG); StreamReader ARQUIVO = new StreamReader(ENDERECO_TXT, System.Text.ASCIIEncoding.UTF7); while (!ARQUIVO.EndOfStream) { string ARQ_DICA = ARQUIVO.ReadLine(); textBox_Principal.Text = ARQ_DICA; } // Teste de Verificação // if (TESTE == 0) { TESTE++; JOGADA = TABELA[int.Parse(ITEM)]; ITEM_COMP_1 = ITEM; } else { TESTE = 0; ITEM_COMP_2 = ITEM; // Pausa Antes da Verificação // Refresh(); Thread.Sleep(1500); if (JOGADA == TABELA[int.Parse(ITEM)]) { foreach (Object COMP in this.Controls) { if (COMP is PictureBox) { if (((PictureBox)COMP).Tag.ToString() == ITEM_COMP_1) { string ENDERECO = string.Concat(LOCAL_IMG_TURING, ITEM_COMP_1, EXT_IMG); ((PictureBox)COMP).Image = Bitmap.FromFile(ENDERECO); ((PictureBox)COMP).Enabled = false; } if (((PictureBox)COMP).Tag.ToString() == ITEM_COMP_2) { string ENDERECO = string.Concat(LOCAL_IMG_TURING, ITEM_COMP_2, EXT_IMG); ((PictureBox)COMP).Image = Bitmap.FromFile(ENDERECO); ((PictureBox)COMP).Enabled = false; } } } FIM = 0; foreach (Object COMP in this.Controls) { if (COMP is PictureBox) { if (((PictureBox)COMP).Enabled == true) { FIM = 1; } } } if (FIM == 0) { timer.Dispose(); FIM = 0; Form2 cadastro = new Form2(labelClock.Text); cadastro.ShowDialog(); string nome = cadastro.Name.Replace(" ", "_"); string tempo = labelClock.Text; if (File.Exists(strPathFile)) { using (StreamWriter sw = File.AppendText(strPathFile)) { sw.WriteLine("\n" + nome + ";" + tempo); } } Form3 Rank = new Form3(); Rank.ShowDialog(); } } else { foreach (Object COMP in this.Controls) { if (COMP is PictureBox) { if (((PictureBox)COMP).Tag.ToString() == ITEM_COMP_1) { string ENDERECO = string.Concat(LOCAL_IMG, ITEM_COMP_1, EXT_IMG); ((PictureBox)COMP).Image = Bitmap.FromFile(ENDERECO); ((PictureBox)COMP).Enabled = true; } if (((PictureBox)COMP).Tag.ToString() == ITEM_COMP_2) { string ENDERECO = string.Concat(LOCAL_IMG, ITEM_COMP_2, EXT_IMG); ((PictureBox)COMP).Image = Bitmap.FromFile(ENDERECO); ((PictureBox)COMP).Enabled = true; } } } } } }
//Main() private void Form1_Load(object sender, EventArgs e) { this.Hide(); Form3 start = new Form3(); start.ShowDialog(); textBox1.Text = (Environment.TickCount / 1000).ToString() + "秒"; // 获取系统启动后经过的时间 axShockwaveFlash1.Loop = false; // 调用flash控件,播放Flash动画,显示在Main() axShockwaveFlash1.Movie = Application.StartupPath + @"\\flashload.swf"; //指定Flash路径为DeBug下 axShockwaveFlash1.Play(); }
private void присоединенныйВариантToolStripMenuItem_Click(object sender, EventArgs e) { Form3 bf = new Form3(); bf.ShowDialog(); }
private void helpReferenceToolStripMenuItem_Click(object sender, EventArgs e) { Form3 helpReference = new Form3(); helpReference.ShowDialog(); }
private void toolStripButton1_Click(object sender, EventArgs e) { Form3 form3 = new Form3(); form3.ShowDialog(); }
private void button2_Click(object sender, EventArgs e) { Form3 diaria = new Form3(); diaria.ShowDialog(); }
private void выборОбработкиToolStripMenuItem_Click(object sender, EventArgs e) { Form3 b = new Form3(); b.ShowDialog(); }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "") { MessageBox.Show("Please enter your Lastname!"); textBox1.Focus(); return; } if (textBox2.Text == "") { MessageBox.Show("Please enter your Firstname!"); textBox2.Focus(); return; } if (textBox3.Text == "") { MessageBox.Show("Please enter your Username!"); textBox3.Focus(); return; } if (textBox4.Text == "") { MessageBox.Show("Please enter your Password!"); textBox4.Focus(); return; } else if (textBox4.Text != textBox5.Text) { MessageBox.Show("You have re-entered a wrong password!"); textBox4.Clear(); textBox5.Clear(); textBox4.Focus(); return; } else { //ADD admin4.Connect(); admin4.admin2 = new MySqlCommand("Insert into adminsaccount(LastName, FirstName, UserName, Password, Status) value (@LastName, @FirstName, @UserName, @Password, @Status)", admin4.adminn); admin4.admin2.Parameters.Add(new MySqlParameter("LastName", textBox1.Text)); admin4.admin2.Parameters.Add(new MySqlParameter("FirstName", textBox2.Text)); admin4.admin2.Parameters.Add(new MySqlParameter("UserName", textBox3.Text)); admin4.admin2.Parameters.Add(new MySqlParameter("Password", textBox4.Text)); admin4.admin2.Parameters.Add(new MySqlParameter("Status", label7.Text)); admin4.admin2.ExecuteNonQuery(); admin4.Disconnect(); textBox1.Text = string.Empty; textBox2.Text = string.Empty; textBox3.Text = string.Empty; textBox4.Text = string.Empty; textBox5.Text = string.Empty; MessageBox.Show("You are successfully registerd!"); this.Hide(); Form3 Form3 = new Form3(); Form3.ShowDialog(); } }
private void buttonEdit2_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { Form3 n = new Form3(); n.ShowDialog(); }
public static String ShowPromptBox(String title, String question, String defaultText) { Form3 testDialog = new Form3(); testDialog.textBox1.Text = defaultText; testDialog.textBox2.Text = question; testDialog.Text = title; String txtResult; // Show testDialog as a modal dialog and determine if DialogResult = OK. if (testDialog.ShowDialog() == DialogResult.OK) { // Read the contents of testDialog's TextBox. txtResult = testDialog.textBox1.Text; } else { txtResult = "Cancelled"; } testDialog.Dispose(); return txtResult; }
private void button1_Click(object sender, EventArgs e) //кнопка "Список выбывших жителей" { try { B.RemoveAt(listBox1.SelectedIndex); } catch { MessageBox.Show("Выберите запись"); } listBox1.Items.Clear(); foreach (Пароль.life a in B) { listBox1.Items.Add(a.firstname + "\t\t" + a.name + "\t\t" + a.otchestvo + "\t\t" + a.data.ToShortDateString() + "\t\t" + a.SP + "\t\t" + a.phone + "\t\t" + a.adres + "\t\t" + a.stropolis + "\t\t" + a.inn + "\t\t" + a.rozhd + "\t\t" + a.rab + "\t\t" + a.pol + "\t\t" + a.town + "\t\t"); } var r = new System.IO.StreamWriter("life.txt", false); //новый файл life1 foreach (Пароль.life a in B) { r.WriteLine(a.firstname); r.WriteLine(a.name); r.WriteLine(a.otchestvo); r.WriteLine(a.data); r.WriteLine(a.SP); r.WriteLine(a.phone); r.WriteLine(a.adres); r.WriteLine(a.stropolis); r.WriteLine(a.inn); r.WriteLine(a.rozhd); r.WriteLine(a.rab); r.WriteLine(a.pol); r.WriteLine(a.town); } r.Close(); A.Add(new Пароль.life() { firstname = Convert.ToString(textBox1.Text), name = Convert.ToString(textBox2.Text), otchestvo = Convert.ToString(textBox3.Text), data = dateTimePicker1.Value, SP = comboBox2.Text, phone = Convert.ToString(textBox6.Text), adres = Convert.ToString(textBox7.Text), stropolis = Convert.ToString(textBox8.Text), inn = Convert.ToString(textBox9.Text), rozhd = Convert.ToString(textBox4.Text), rab = Convert.ToString(textBox10.Text), pol = comboBox1.Text, town = Convert.ToString(textBox5.Text), pric = Convert.ToString(textBox11.Text) } ); var d = new System.IO.StreamWriter("life1.txt", true); foreach (Пароль.life res in A) { d.WriteLine(res.firstname); d.WriteLine(res.name); d.WriteLine(res.otchestvo); d.WriteLine(res.data); d.WriteLine(res.SP); d.WriteLine(res.phone); d.WriteLine(res.adres); d.WriteLine(res.stropolis); d.WriteLine(res.inn); d.WriteLine(res.rozhd); d.WriteLine(res.rab); d.WriteLine(res.pol); d.WriteLine(res.town); d.WriteLine(res.pric); } d.Close(); MessageBox.Show("Успешно сохранено!"); { Form3 a = new Form3(); this.Hide(); a.ShowDialog(); } }
private void Nextform_Click(object sender, EventArgs e) { Form3 Form3 = new Form3(); Form3.ShowDialog(); }
// Change value of SMIN private void editSMINToolStripMenuItem_Click(object sender, EventArgs e) { Form3 form3 = new Form3(); if (form3.ShowDialog(this) == DialogResult.OK && form3.Value <= SMAX) { SMIN = form3.Value; // Retrieves value of form2 SMINlbl.Text = String.Format("SMIN = {0}", SMIN); } else if (form3.DialogResult == DialogResult.OK && form3.Value > SMAX) { MessageBox.Show("SMIN cannot be greater than SMAX"); } form3.Dispose(); }
private void назначитьВремяПациентуToolStripMenuItem_Click(object sender, EventArgs e) { Form3 newForm3 = new Form3(); newForm3.ShowDialog(); }
//登录按键响应事件 private void ButtonLogin_Click(object sender, EventArgs e) { //新建ClassSqlConnect类,调用重构的ViewCount方法返回从数据库中查询的结果 ClassSqlConnect log = new ClassSqlConnect(); SqlDataReader reader = log.ViewCount(ComboxUserName.Text.ToString(),TxtPassword.Text.ToString()); if (reader.Read())//判断有数据,说明登录成功 { /*保存账号信息,将这部分信息保存在数据库(XML)中更好*/ ComboxUserName.Items.Add(ComboxUserName.Text.ToString()); Form nfm; //提取用户名信息 string UName = reader[1].ToString(); MessageBox.Show("欢迎你,"+ UName); //提取权限信息并选择应打开的界面 switch((int)reader[2]) { case 0: nfm = new Form2();//系统管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 1: nfm = new Form7();//人事经理管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 2: nfm = new Form3();//人事员工管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 3: nfm = new Form8();//财务经理管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 4: nfm = new Form4();//财务员工管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 5: nfm = new Form9();//销售经理管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 6: nfm = new Form6();//销售员工管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 7: nfm = new Form10();//仓库经理管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 8: nfm = new Form5();//仓库员工管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; default: MessageBox.Show("你没有登录权限," + UName,"没有权限"); ComboxUserName.Text = ""; TxtPassword.Text = ""; break; } } else { MessageBox.Show("用户名或密码错误!","错误"); TxtPassword.Text = ""; } //调用自定义的Close方法关闭sql连接 log.Close(); }
private void button2_Click(object sender, EventArgs e) { Form3 f3 = new Form3(); f3.ShowDialog(); }
private void fullVersionRequestToolStripMenuItem_Click(object sender, EventArgs e) { Form3 request = new Form3(); request.ShowDialog(); }
private void help_Click(object sender, EventArgs e) { Form3 fm = new Form3(); fm.ShowDialog(); }
private void openOptionsMenu(object sender, EventArgs e) { Form3 options = new Form3(); options.ShowDialog(); }
// Change value of BMAX private void editBMAXToolStripMenuItem_Click(object sender, EventArgs e) { Form3 form3 = new Form3(); if (form3.ShowDialog(this) == DialogResult.OK && form3.Value >= BMIN) { BMAX = form3.Value; // Retrieves value of form2 BMAXlbl.Text = String.Format("BMIN = {0}", BMAX); } else if (form3.DialogResult == DialogResult.OK && form3.Value < BMIN) { MessageBox.Show("BMAX cannot be less than BMIN"); } form3.Dispose(); }
private void AtenderServidor() { DelegadoParaEscribir delegado = new DelegadoParaEscribir(CambiaString); while (true) { //recibimos mensaje del servidor byte[] msg2 = new byte[80]; server.Receive(msg2); string[] recibido = Encoding.ASCII.GetString(msg2).Split('/'); int codigo = Convert.ToInt32(recibido[0]); string mensaje = recibido[1].Split('\0')[0]; switch (codigo) { case 3: //número de partidas ganadas por un jugador if (mensaje == "NO EXISTE") { resultado1.Invoke(delegado, new object[] { "resultado1", "El jugador introducido no existe.", null }); } else if (mensaje == "ERROR") { resultado1.Invoke(delegado, new object[] { "resultado1", "No se ha podido realizar la búsqueda en la base de datos.", null }); } else { resultado1.Invoke(delegado, new object[] { "resultado1", "Número de partidas ganadas: " + mensaje, null }); } break; case 4: //nombre del ganador de una partida concreta if (mensaje == "NO EXISTE") { resultado1.Invoke(delegado, new object[] { "resultado1", "La partida introducida no existe.", null }); } else if (mensaje == "ERROR") { resultado1.Invoke(delegado, new object[] { "resultado1", "No se ha podido realizar la búsqueda en la base de datos.", null }); } else { //MessageBox.Show("Nombre del ganador: " + mensaje); resultado1.Invoke(delegado, new object[] { "resultado1", "Nombre del ganador: " + mensaje, null }); } break; case 5: //numero de goles de un jugador en concreto if (mensaje == "NO EXISTE") { resultado1.Invoke(delegado, new object[] { "resultado1", "El jugador introducido no existe.", null }); } else if (mensaje == "ERROR") { resultado1.Invoke(delegado, new object[] { "resultado1", "No se ha podido realizar la búsqueda en la base de datos.", null }); } else { resultado1.Invoke(delegado, new object[] { "resultado1", "Número de goles marcados: " + mensaje, null }); } break; case 6: //lista de conectados mensaje = recibido[2].Split('\0')[0]; String[] lista = mensaje.Split(','); NConectados.Invoke(delegado, new object[] { "NConectados", recibido[1], null }); listBox1.Invoke(delegado, new object[] { "listBox1", null, lista }); break; case 7: Form3 invi = new Form3(mensaje); invi.ShowDialog(); while (invi.resultadoinvitacion == 0) { } invi.Close(); string ms; if (invi.resultadoinvitacion == 1) //ha aceptado la invitacion { ms = "8/SI," + mensaje + "," + usuario; byte[] msg = System.Text.Encoding.ASCII.GetBytes(ms); server.Send(msg); // //iniciar partida // } if (invi.resultadoinvitacion == 2) //no ha aceptado la invitacion { ms = "8/NO," + mensaje + "," + usuario; byte[] msg = System.Text.Encoding.ASCII.GetBytes(ms); server.Send(msg); } break; case 8: string[] trozos = mensaje.Split(','); if (trozos[0] == "SI") //la otra persona ha aceptado la invitación { MessageBox.Show(trozos[1] + " ha aceptado tu invitación. Prepárate para jugar."); // //iniciar partida // } if (trozos[0] == "NO") //la otra persona no ha aceptado la invitación { MessageBox.Show(trozos[1] + " ha rechazado tu invitación."); } break; case 9: string[] partes = mensaje.Split('$'); listBox2.Invoke(delegado, new object[] { "listBox2", null, partes }); break; } } }