コード例 #1
0
        private void Choncauhoi()
        {
            if (daudoc < ListCauhoi.Count)
            {
                ListKQ.Clear();
                panelResult.Visible = false;
                VisibleControl(false);
                lblNoidungcauhoi.Visible = true;
                lblNoidungcauhoi.Text    = "";
                lblName.Text             = "";
                BellRang = false;


                thoigian          = 30;
                lblDongho.Visible = true;
                timer1.Start();
                try
                {
                    playClock.PlayLooping();
                }
                catch { }

                string cauhoi = ListCauhoi[daudoc].ToString();
                lblNoidungcauhoi.Text = cauhoi;
                string msg = cauhoi;
                frmmain.Broadcast("STARTVCNV|" + msg);
            }
        }
コード例 #2
0
ファイル: frmKhoidong.cs プロジェクト: nguyenvutud/ITGala
        private void Chondoithi()
        {
            thoigian = 120;
            frmmain.Broadcast("KHOIDONG|" + thoigian.ToString());
            frmGoicauhoiKD frmgoicauhoi = new frmGoicauhoiKD();
            UserConnection client;

            foreach (DictionaryEntry entry in frmmain.clients)
            {
                client = (UserConnection)entry.Value;
                string dc = client.Name;
                frmgoicauhoi.cmbDoichoi.Items.Add(dc);

                frmgoicauhoi.cmbGoicauhoi.Items.Add("Đội: " + dc);
            }
            frmgoicauhoi.ShowDialog();
            try
            {
                Name           = frmgoicauhoi.cmbDoichoi.SelectedItem.ToString();
                lblDoithi.Text = "ĐỘI: " + Name;

                switch (frmgoicauhoi.cmbGoicauhoi.SelectedIndex.ToString())
                {
                case "0":
                    filename = "cauhoi//khoidong1.txt";
                    break;

                case "1":
                    filename = "cauhoi//khoidong2.txt";
                    break;

                case "2":
                    filename = "cauhoi//khoidong3.txt";
                    break;

                case "3":
                    filename = "cauhoi//khoidong4.txt";
                    break;
                }
            }
            catch { }
            frmgoicauhoi.Dispose();
        }
コード例 #3
0
ファイル: frmTangtoc.cs プロジェクト: nguyenvutud/ITGala
        private void RightKeyPress(object sender, KeyEventArgs e)
        {
            if (e.KeyValue == 39)
            {
                if (!Hienthiketqua)
                {
                    Hienthiketqua = true;
                    HienthiKQ();
                }
                else
                {
                    lblNoidungcauhoi.Visible = true;
                    panelResult.Visible      = false;
                    Hienthiketqua            = false;
                    lblNoidungcauhoi.Text    = "";
                    lblName.Text             = "";
                    string cauhoi = streamreader.ReadLine();
                    string dapan  = streamreader.ReadLine();
                    //string da1 = streamreader.ReadLine();
                    //string da2 = streamreader.ReadLine();
                    //string da3 = streamreader.ReadLine();
                    if (cauhoi != null)
                    {
                        lblDongho.Visible = true;
                        thoigian          = 30;
                        timer1.Start();
                        try
                        {
                            playClock.PlayLooping();
                        }
                        catch { }
                        lblNoidungcauhoi.Text += cauhoi + "\n";
                        lblDapan.Text          = dapan;
                        string msg = lblNoidungcauhoi.Text;
                        frmmain.Broadcast("STARTTT|" + msg);
                    }
                    else
                    {
                        lblNoidungcauhoi.Text = "";
                        frmmain.Broadcast("STARTTT|" + "FINISH");
                        lblDongho.Visible = false;
                        try
                        {
                            streamreader.Close();
                        }catch {}
                    }
                }
            }
            if (e.Control && (e.KeyValue == 13))
            {
                Pathsound = @"sound\true1.wav";
                try
                {
                    Thread thread = new Thread(new ThreadStart(SoundPlayer));
                    thread.Start();
                }catch {}

                lblDongho.Visible        = false;
                panelResult.Visible      = true;
                lblNoidungcauhoi.Visible = false;
                HienthiKQ();
            }
            //if()
            //{

            //}
        }
コード例 #4
0
ファイル: frmFinally.cs プロジェクト: nguyenvutud/ITGala
        private void RightKeyPress(object sender, KeyEventArgs e)
        {
            if (e.KeyValue == 39)
            {
                //VisibleControl(false);
                picBell.Visible       = false;
                lblNoidungcauhoi.Text = "";
                lblName.Text          = "";
                Name        = "";
                labelR.Text = e.KeyValue.ToString();
                BellRang    = false;
                if (daudoc < ListCauhoi.Count)
                {
                    string cauhoi = ListCauhoi[daudoc].ToString();
                    lblNoidungcauhoi.Text = cauhoi;
                    string msg = cauhoi;
                    frmmain.Broadcast("STARTVD|" + msg);
                    daudoc++;
                }
                else
                {
                    lblNoidungcauhoi.Text = "";
                    frmmain.Broadcast("STARTVD|FINISH");
                }
            }
            if (e.KeyValue == 37)
            {
                //VisibleControl(false);
                picBell.Visible       = false;
                lblNoidungcauhoi.Text = "";
                Name = "";
                if (daudoc > 0)
                {
                    lblName.Text = "";
                    BellRang     = false;
                    daudoc--;
                    string cauhoi = ListCauhoi[daudoc].ToString();
                    lblNoidungcauhoi.Text = cauhoi;
                    string msg = cauhoi;
                    frmmain.Broadcast("STARTVD|" + msg);
                }
                else
                {
                    lblNoidungcauhoi.Text = "";
                    frmmain.Broadcast("STARTVD|FINISH");
                }
            }

            if (e.KeyValue == 82)     //reset: phím r
            {
                labelR.Text     = e.KeyValue.ToString();
                BellRang        = false;
                lblName.Text    = "";
                picBell.Visible = false;
                frmmain.SendToClients("RESET|", Name);
            }
            if (e.KeyValue == 68)     //tra loi dung. Phím d
            {
                labelR.Text = e.KeyValue.ToString();
                Pathsound   = @"sound\WinFirst.wav";
                Thread threadsound = new Thread(new ThreadStart(SoundPlayer));
                threadsound.Start();
            }
            if (e.KeyValue == 83)    //tra loi sai. Phím s
            {
                labelR.Text = e.KeyValue.ToString();
                Pathsound   = @"sound\false1.wav";
                Thread threadsound = new Thread(new ThreadStart(SoundPlayer));
                threadsound.Start();
            }
        }