private void btnMatch_Click(object sender, EventArgs e) { if (lbUsers.SelectedIndex != -1) { matchRequest = new MatchRequest(); matchRequest.SendToUserName = lbUsers.SelectedItem.ToString(); matchRequest.VisibleChanged += matchRequest_VisibleChanged; matchRequest.ShowDialog(); } else { MessageBox.Show("Select a user from user list to play match."); } }
private void HandleResponse(string response) { if (response.StartsWith("\n!shout!") || response.StartsWith("!shout!")) { lbChat.Items.Add(response); } else if (response.StartsWith("\n!private!") || response.StartsWith("!private!")) { lbChat.Items.Add(response); } else if (response.StartsWith("\nKibitz*") || response.StartsWith("Kibitz*")) { lbChat.Items.Add(response); } else if (response.Contains("Total") && response.Contains("user(s)") && response.Contains("online")) { PopulateUserList(response); } else if (response.Contains("Total") && response.Contains("game(s)")) { PopulateGameList(response); } else if (response.Contains("You have been kicked out due to multiple login")) { MessageBox.Show(response); this.Close(); } else if (response.StartsWith("Please input mail body")) { //ignore this line } else if(response.StartsWith("!MAILBOX!")) { PopulateMailList(response); } else if (response.Contains("You have received a new message")) { MessageBox.Show(response); SendListMail(); } else if (response.StartsWith("!OBSERVE!") || response.StartsWith("\n!OBSERVE!")) { PopulateObservedGames(response); } else if (response.StartsWith("!GAME!") || response.StartsWith("\n!GAME!")) { PopulateYourGames(response); } else if (response.Contains("invites your for a game")) { string[] splitresponse = System.Text.RegularExpressions.Regex.Split(response, "[ \n]"); matchRequest = new MatchRequest(); matchRequest.requestText = response; matchRequest.pieceText = splitresponse[9]; matchRequest.timerText = splitresponse[10]; matchRequest.SendToUserName = splitresponse[1]; matchRequest.VisibleChanged += matchRequest_VisibleChanged; matchRequest.ShowDialog(); } else MessageBox.Show(response); }