private void button2_Click(object sender, EventArgs e) { lock_soru = 0; Random rnd = new Random(); int random_soru_id = rnd.Next(1, rde.tblQuestions.Count()); tblQuestion question_row = rde.tblQuestions.Where(t => t.Id == random_soru_id).FirstOrDefault(); dogru_cevap = question_row.Cevap; foreach (Client_Info cl in clients) { question_row = rde.tblQuestions.Where(t => t.Id == random_soru_id).FirstOrDefault(); if (question_row != null) { NetworkStream netstream = cl.GetTcpClient().GetStream(); string data = "|" + question_row.Soru + "-" + question_row.A + "-" + question_row.B + "-" + question_row.C + "-" + question_row.D + "|"; byte[] send_data = Encoding.UTF8.GetBytes(data); netstream.Write(send_data, 0, send_data.Length); } else { richTextBox1.AppendText("Oyunda anlaşılamayan bir hata var.\n"); } } Thread thTimer = new Thread(() => timerthread()); thTimer.Start(); }
private void button3_Click(object sender, EventArgs e) { tblQuestion question_row = rde.tblQuestions.Where(t => t.Id == 1).FirstOrDefault(); MessageBox.Show(question_row.Soru); }