Exemple #1
0
 public RoomForm(RoomChose parent, Room room, string Playername, GameManager_2 game_host, int ishost) // bien ishost xac dinh la day được gọi từ vào phòng hay tạo phòng
 {
     this.parent     = parent;
     this.room_info  = room;
     this.Playername = Playername;
     this.game_host  = game_host;
     this.ishost     = ishost;
     InitializeComponent();
     //   Label_RoomID.Text = room_info.RoomID.ToString();
     check_timer          = new Timer();
     check_timer.Tick    += new EventHandler(timer_tick);
     check_timer.Interval = 300;
     check_timer.Enabled  = true;
     if (ishost == 1)
     {
         guna2Button_Ready.Enabled = false;
         guna2Button_Start.Enabled = true;
     }
     else
     {
         guna2Button_Ready.Enabled = true;
         guna2Button_Start.Enabled = false;
     }
     guna2Button_Sophong.Text = "Phòng " + room_info.RoomID.ToString();
 }
        public ResultForm2(RoomChose parent, List <string> result)
        {
            InitializeComponent();
            this.parent = parent;
            this.result = result;
            //foreach (string pl in result)
            //{
            //    listView1.Items.Add(pl);

            //}
        }
 private void Confirm_button_Click(object sender, EventArgs e)
 {
     if (TypeCode_textbox.Text == signUpForm.verifyCode)
     {
         SupportUtility.CreateAccount(signUpForm.Email_textbox.Text, signUpForm.Name_textbox.Text, signUpForm.Pass_textbox.Text);
         roomChose = new RoomChose(signUpForm.Name_textbox.Text, signUpForm.logInForm);
         this.signUpForm.logInForm.inRoom = roomChose;
         roomChose.Show();
         signUpForm.Dispose();
         this.Dispose();
     }
     else
     {
         MessageBox.Show("Mã xác nhận sai!");
     }
 }
Exemple #4
0
        private void guna2Button1_Click(object sender, EventArgs e)
        {
            if (Mycnt.State != ConnectionState.Open)
            {
                Mycnt.Open();
            }

            SqlCommand com;
            string     query;

            if (ishost == 1)
            {
                room_info.HostID = "";
                query            = string.Format("Update Roomlist set HostID ='',IsClosed ='0',IsReady ='0',IsStart ='0' where RoomID ='{0}'", room_info.RoomID);
                com = new SqlCommand(query, Mycnt);
                com.ExecuteNonQuery();
            }
            else
            {
                room_info.GuestID = "";
                query             = string.Format("Update Roomlist set GuestID ='',IsClosed ='0',IsReady ='0',IsStart ='0' where RoomID ='{0}'", room_info.RoomID);
                com = new SqlCommand(query, Mycnt);
                com.ExecuteNonQuery();
            }

            query = string.Format("update RoomList set HostID = GuestID, GuestID = ''where HostID = '' and GuestID != ''" +
                                  "  delete from RoomQuestions Where RoomID in (select RoomID from RoomList Where HostId = '' and guestID = '')"
                                  + "delete from Roomlist where HostID = '' and GuestID = ''");
            com = new SqlCommand(query, Mycnt);
            com.ExecuteNonQuery();
            Mycnt.Close();
            //RoomChose newroomchose = new RoomChose(Playername,this.parent.loginForm);


            LogInForm a = this.parent.loginForm;
            string    b = Playername;

            this.parent.Dispose();
            parent = new RoomChose(b, a);// sua ở đây
            this.Close();
            this.parent.Show();

            //newroomchose.Show();
        }
Exemple #5
0
 //--------------------------
 // Handle Event
 private void SignIn_button_Click(object sender, EventArgs e)
 {
     if (this.Name_textbox.Text != "" && this.Pass_textbox.Text != "")
     {
         if (SupportUtility.IsExistAccount(this.Name_textbox.Text))
         {
             if (SupportUtility.IsCorrectAccount(this.Name_textbox.Text, this.Pass_textbox.Text))
             {
                 if (!SupportUtility.IsSignIn(Name_textbox.Text))
                 {
                     //inRoom = new RoomChose(this.Name_textbox.Text);
                     inRoom = new RoomChose(this.Name_textbox.Text, this);
                     this.Hide();
                     inRoom.Show();
                     SupportUtility.SetSignIn(Name_textbox.Text);
                 }
                 else
                 {
                     MessageBox.Show("Tài khoản đang được sử dụng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 }
             }
             else
             {
                 MessageBox.Show("Mật khẩu không đúng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         else
         {
             MessageBox.Show("Tài khoản không tồn tại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     else
     {
         MessageBox.Show("Vui lòng nhập đủ thông tin", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
 public ConfirmNewAccount(RoomChose roomChose)
 {
     InitializeComponent();
     this.roomChose = roomChose;
 }
Exemple #7
0
 // khoi tao bo cau hoi ch0 guest
 public GameManager_2(Start parent, RoomChose roomchose, List <QuestionGame2> temp)
 {
     this.roomchose = roomchose;
     this.parent    = parent;
     this.list      = temp;
 }