public void receiveInvitation(string username) // username is the name of the sender of an invitation { richTextBox.AppendText("Invitation received from " + username + "\n"); Pop_up invitation = new Pop_up(username); DialogResult newdialogResult = invitation.ShowDialog(); if (newdialogResult == DialogResult.Yes) { if (opponent == "") { sendResponse(username, "y"); opponent = username; } else { richTextBox.AppendText("You are already in game, cannot accept invitation" + "\n"); } } else if (newdialogResult == DialogResult.No) { sendResponse(username, "n"); } }
private void receiveInvitation(string username) // username is the name of the sender of an invitation { richTextBox.AppendText("Invitation received from " + username + "\n"); Pop_up invitation = new Pop_up(); DialogResult newdialogResult = invitation.ShowDialog(); /* * DialogResult dialogResult = MessageBox.Show("Do you accept? ", username + " sent you an invitation", MessageBoxButtons.YesNo); * if (dialogResult == DialogResult.Yes) * { * sendResponse(username, "y"); * } * else if (dialogResult == DialogResult.No) * { * sendResponse(username, "n"); * } */ if (newdialogResult == DialogResult.Yes) { sendResponse(username, "y"); } else if (newdialogResult == DialogResult.No) { sendResponse(username, "n"); } }