Ejemplo n.º 1
0
        private void check_button_Click(object sender, EventArgs e)
        {
            if (IdPwcheck()) // id , pw  모두 입력 됐으면
            {
                userId = user_id_textbox.Text;
                string   userpw      = user_pw_textbox.Text;
                string[] client_info = new string[2];
                client_info[0] = userId;
                client_info[1] = userpw;
                clientSocket.OnSendData("login" + "|" + client_info[0] + "/" + client_info[1] + "|", null);
                waitHandle.WaitOne(); //로그인 결과가 올때까지 대기 상태가 되어야 한다.
                if (loginstate)
                {
                    clientSocket.Disconnect();
                    MessageBox.Show("로그인 성공!", "확인", MessageBoxButtons.OK, MessageBoxIcon.None);
                    Main_form main_form = new Main_form(userId);
                    this.Invoke(new MethodInvoker(this.Hide)); // 크로스 스레드 해결

                    main_form.ShowDialog();
                    if (main_form.DialogResult != DialogResult.OK)
                    {
                        this.Invoke(new MethodInvoker(this.Dispose));  // 크로스 스레드 해결
                    }
                }
                else
                {
                    MessageBox.Show("로그인 실패!", "오류", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Ejemplo n.º 2
0
 private void check_button_Click(object sender, EventArgs e)
 {
     if (IdPwcheck()) // id , pw  모두 입력 됐으면
     {
         string   user_id     = user_id_textbox.Text;
         string   user_pw     = user_pw_textbox.Text;
         string[] client_info = new string[2];
         client_info[0] = user_id;
         client_info[1] = user_pw;
         client_socket.set_socket_evnet(login_success);
         client_socket.OnSendData("login" + ";" + client_info[0] + ";" + client_info[1], null);
         waitHandle.WaitOne();
         MessageBox.Show("로그인 성공!", "확인", MessageBoxButtons.OK, MessageBoxIcon.None);
         Main_form main_form = new Main_form();
         this.Hide();
         main_form.ShowDialog();
         if (main_form.DialogResult != DialogResult.OK)
         {
             this.Dispose();
         }
     }
 }