private void Next_Click(object sender, EventArgs e) { if (flag_next) { server.Start(); connection = server.AcceptSocket(); nstream = new NetworkStream(connection); bW = new BinaryWriter(nstream); bR = new BinaryReader(nstream); bW.Write(flag_category); bW.Write(flag_level); if (connection.Connected && bR.ReadBoolean()) { this.Hide(); MainBody body = new MainBody(flag_category, flag_level, this); body.ShowDialog(); this.Show(); } else { Next_Click(sender, e); } } else { MessageBox.Show("Please Choose Level and Category."); } }
private void playagain() { if (s1.client.Connected) { MessageBox.Show("conneccted 1"); string input = s1.br.ReadString(); //input = "MAhmoud"; //while ((input += s1.br.ReadByte().ToString()) != null){ MessageBox.Show(input); } //MessageBox.Show("conneccted 2"); MainBody m = new MainBody(input, s1); MessageBox.Show("object created"); this.Hide(); m.ShowDialog(); this.Show(); /* * complete_r = complete_s = rightorwrong_s = false; * flag_correct = 0; * //DrawLines(name);*/ } }
private void playagain() { //Form1 form1 = new Form1(); MainBody m = new MainBody(category_value, level_value, f1); MessageBox.Show("object created"); this.Hide(); //form1.ShowDialog(); name = "omar"; f1.bW.Write(name); m.ShowDialog(); this.Show(); }
private void Next_Click(object sender, EventArgs e) { if (flag_next) { MainBody body = new MainBody(); DialogResult dialogResult = body.ShowDialog(); //this.Close(); } else { MessageBox.Show("Please Choose Level and Category."); } }
public void play() { try { client = new TcpClient(); client.Connect(localhost, port); networkStream = client.GetStream(); br = new BinaryReader(networkStream); bw = new BinaryWriter(networkStream); string word = ""; if (client.Connected) { category = br.ReadInt32(); level = br.ReadInt32(); if (category == 1) { category_name = "Football"; } else if (category == 2) { category_name = "Actors"; } else if (category == 3) { category_name = "Films"; } else if (category == 4) { category_name = "Politions"; } else if (category == 5) { category_name = "Countrys"; } if (level == 1) { level_name = "Easy"; } else if (level == 2) { level_name = "Meduim"; } else if (level == 3) { level_name = "Hard"; } } DialogResult result2 = MessageBox.Show($"Do You Want to Start Game?! with Category:{category_name} and Level:{level_name}", "Important Query", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result2 == DialogResult.Yes) { bw.Write(true); word = br.ReadString(); MainBody mainBody = new MainBody(word, this); mainBody.ShowDialog(); } else if (result2 == DialogResult.No) { bw.Write(false); MessageBox.Show("press play again to play"); close_connect(); } } catch { MessageBox.Show("No server to connect"); } }