private void HandleLoginReply(TcpMessage msg) { bool username = msg.GetBoolAttributes().ElementAt(0); bool password = msg.GetBoolAttributes().ElementAt(1); bool code = msg.GetBoolAttributes().ElementAt(2); username = true; password = true; code = true; if (!username && !password && !code) { } else { online_user_window.Visible = true; login_window.Visible = false; } }
private void HandleJoinReply(TcpMessage msg) { bool username = msg.GetBoolAttributes().ElementAt(0); bool password = msg.GetBoolAttributes().ElementAt(1); bool mail = msg.GetBoolAttributes().ElementAt(2); string caption = null; string info = null; MessageBoxIcon i = MessageBoxIcon.Error; if (!username) { caption = "Your account was disapproved."; info = "The suggested username allready exist.\n" + "Please enter a new one."; } else if (!password) { caption = "Your account was disapproved."; info = "The suggested password has incorrect format or is not concidered safe.\n" + "Please enter a new valid password, with the following criteria:\n" + "(1) Minimum number of letters: 5\n" + "(2) Minimum number of numerals: 3\n" + "(3) Minimal number of capital letters: 1"; } else if (!mail) { caption = "Your account was disapproved."; info = "You have not entered a valid email.\n" + "Please enter a new one."; } else { caption = "Your account has been accepted!"; info = "Please login and enter the confirmation-code, that has been sent to your email."; i = MessageBoxIcon.Asterisk; } MessageBox.Show(info, caption, MessageBoxButtons.OK, i); }