Example #1
0
 private void login_btn_Click(object sender, EventArgs e)
 {
     if (!ID_Box.Text.Equals("") && !PW_Box.Text.Equals(""))
     {
         string loginResult = loginReceive.loginReveiveToServer("userLogin", ID_Box.Text, PW_Box.Text);
         if (loginResult.Equals("true"))
         {
             loginStausLabel.Text = "";
             UserInfo.userId      = ID_Box.Text;
             UserIP          = UserGetIP.GetLocalIP();
             UserInfo.userIP = UserIP;
             contextmenustripform.IconVisiblefalse();
             loginformCheck = false;
             Mainform mainform = new Mainform(contextmenustripform);
             mainform.Show();
             ID_Box.Clear();
             PW_Box.Clear();
             ID_Box.Focus();
             this.Hide();
             //서버로 로그인 id에 맞는 값을 받아와야 함.
         }
         else
         {
             //MessageBox.Show("ID 혹은 PW가 일치하지 않습니다.", "로그인실패", MessageBoxButtons.OK, MessageBoxIcon.Error);
             loginStausLabel.Text      = "ID 또는 PW가 일치하지 않습니다.";
             loginStausLabel.ForeColor = Color.Red;
             ID_Box.Clear();
             //PW_Box.Clear();
             PW_Box.Text         = "Password";
             PW_Box.ForeColor    = Color.Gray;
             PW_Box.PasswordChar = '\0';
             login_btn.BackColor = Color.White;
             login_btn.ForeColor = Color.Gray;
             login_btn.Enabled   = false;
             ID_Box.Focus();
         }
     }
     else
     {
         loginStausLabel.Text      = "ID 또는 PW를 적어주세요.";
         loginStausLabel.ForeColor = Color.Red;
         ID_Box.Focus();
         //MessageBox.Show("ID 혹은 PW를 적어주세요.", "로그인실패", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #2
0
 private void ID_Box_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyData == Keys.Enter)
     {
         if (!PW_Box.Text.Equals("") && !(PW_Box.Text.Equals("Password") && PW_Box.ForeColor == Color.Gray))
         {
             string loginCheck = loginReceive.loginReveiveToServer("userLogin", ID_Box.Text, PW_Box.Text);
             if (loginCheck.Equals("true"))
             {
                 loginStausLabel.Text = "";
                 UserInfo.userId      = ID_Box.Text;
                 UserIP          = UserGetIP.GetLocalIP();
                 UserInfo.userIP = UserIP;
                 contextmenustripform.IconVisiblefalse();
                 loginformCheck = false;
                 Mainform mainform = new Mainform(contextmenustripform);
                 mainform.Show();
                 ID_Box.Clear();
                 PW_Box.Clear();
                 ID_Box.Focus();
                 this.Hide();
             }
             else
             {
                 loginStausLabel.Text      = "ID 또는 PW가 일치하지 않습니다.";
                 loginStausLabel.ForeColor = Color.Red;
                 ID_Box.Clear();
                 //PW_Box.Clear();
                 PW_Box.Text         = "Password";
                 PW_Box.ForeColor    = Color.Gray;
                 PW_Box.PasswordChar = '\0';
                 login_btn.BackColor = Color.White;
                 login_btn.ForeColor = Color.Gray;
                 login_btn.Enabled   = false;
                 ID_Box.Focus();
             }
         }
         else
         {
             PW_Box.Focus();
         }
     }
 }
Example #3
0
        private void chatFormClosing(object sender, FormClosingEventArgs e)
        {
            if (MessageBox.Show("채팅창을 종료하시겠습니까?", "채팅종료", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                //여기에 서버랑 연결을 끊는 부분 작성
                Watcher.watcher.EnableRaisingEvents = false;
                JsonSend.test = 0;
                if (m_Client != null)
                {
                    m_Client.Close();
                }

                c_mainform.Show();
                c_mainform.Enabled     = true;
                ChatFormCheck          = false;
                Mainform.mainformCheck = true;
            }
            else
            {
                e.Cancel = true;
                return;
            }
        }
Example #4
0
        private void exitToolStripMenuItem_MouseUp(object sender, MouseEventArgs e)
        {
            switch (e.Button)
            {
            case MouseButtons.Left:
                if (register.registerCheck == true)
                {
                    register.registerCheck = false;
                    register_form.Dispose();
                    login.Enabled        = true;
                    Login.loginformCheck = true;
                }
                else if (enterRoomCheck.enterRoomformCheck == true)
                {
                    enterRoomCheck.enterRoomformCheck = false;
                    enterRoomcheck.Dispose();
                    mainform.Enabled       = true;
                    Mainform.mainformCheck = true;
                }
                else if (Chat_Form.ChatFormCheck == true)
                {
                    IconVisiblefalse();
                    if (chatform.m_Client != null)
                    {
                        chatform.m_Client.Close();
                    }
                    Chat_Form.ChatFormCheck = false;
                    chatform.Dispose();
                    Mainform.mainformCheck = true;
                    mainform.Enabled       = true;
                    mainform.Show();
                    IconVisibletrue();
                }
                else if (CreateRoom_Form.createRoomCheck == true)
                {
                    IconVisiblefalse();
                    CreateRoom_Form.createRoomCheck = false;
                    createroom.Dispose();
                    Mainform.mainformCheck = true;
                    mainform.Enabled       = true;
                    IconVisibletrue();
                }
                else if (UserList_Form.userlistformCheck == true)
                {
                    IconVisiblefalse();
                    UserList_Form.userlistformCheck = false;
                    userlistform.Dispose();
                    CreateRoom_Form.createRoomCheck = true;
                    createroom.Enabled = true;
                    IconVisibletrue();
                }
                else
                {
                    if (MessageBox.Show("종료하시겠습니까?", "종료 메시지", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        this.notifyIcon.Visible = false;
                        System.Environment.Exit(1);
                    }
                    else
                    {
                        return;
                    }
                }
                break;

            case MouseButtons.Right:
                // Right click
                break;
            }
        }
Example #5
0
        private void loginbtn_Click(object sender, EventArgs e)
        {
            if (!IDBox.Text.Equals("") && !PWBox.Text.Equals(""))
            {
                string loginResult = loginReceive.loginReveiveToServer("userLogin", IDBox.Text, PWBox.Text);
                if (loginResult.Equals("true"))
                {
                    if (enterRoomCheck.enterRoomformCheck == true)
                    {
                        contextMenuStripForm.LockIconVisiblefalse();
                        sbloginformCheck = false;
                        mainform.Show();
                        enterRoomcheck.Show();
                        enterRoomcheck.Focus();
                        enterRoomCheck.enterRoomformCheck = true;
                        contextMenuStripForm.IconVisibletrue();
                        PWBox.Clear();
                        this.Dispose();
                    }
                    else if (Chat_Form.ChatFormCheck == true)
                    {
                        contextMenuStripForm.LockIconVisiblefalse();
                        chatform.Show();
                        chatform.Focus();
                        sbloginformCheck        = false;
                        Chat_Form.ChatFormCheck = true;
                        contextMenuStripForm.IconVisibletrue();
                        PWBox.Clear();
                        this.Dispose();
                    }
                    else if (CreateRoom_Form.createRoomCheck == true)
                    {
                        contextMenuStripForm.LockIconVisiblefalse();
                        mainform.Show();
                        createroom.Show();
                        createroom.Focus();
                        sbloginformCheck = false;
                        CreateRoom_Form.createRoomCheck = true;
                        contextMenuStripForm.IconVisibletrue();
                        PWBox.Clear();
                        this.Dispose();
                    }
                    else if (UserList_Form.userlistformCheck == true)
                    {
                        contextMenuStripForm.LockIconVisiblefalse();
                        mainform.Show();
                        createroom.Show();
                        userlistform.Show();
                        userlistform.Focus();
                        sbloginformCheck = false;
                        UserList_Form.userlistformCheck = true;
                        contextMenuStripForm.IconVisibletrue();
                        PWBox.Clear();
                        this.Dispose();
                    }
                    else
                    {
                        contextMenuStripForm.LockIconVisiblefalse();
                        mainform.Show();
                        mainform.Focus();
                        sbloginformCheck       = false;
                        Mainform.mainformCheck = true;
                        contextMenuStripForm.IconVisibletrue();
                        PWBox.Clear();
                        this.Dispose();
                    }


                    //서버로 로그인 id에 맞는 값을 받아와야 함.
                }
                else
                {
                    //MessageBox.Show("비밀번호가 일치하지 않습니다.", "로그인실패", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    sbLoginStatus.Text      = "비밀번호가 일치하지 않습니다.";
                    sbLoginStatus.ForeColor = Color.Red;
                    PWBox.Clear();
                }
            }
            else
            {
                sbLoginStatus.Text      = "비밀번호를 적어주세요.";
                sbLoginStatus.ForeColor = Color.Red;
                //MessageBox.Show("비밀번호를 적어주세요.", "로그인실패", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }