public void AcceptRequestExecute() { try { MessageBoxResult result = MessageBox.Show("Are you sure you want to accept request?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { bool isAccepted = requests.AcceptRequest(Request); if (isAccepted == true) { Thread.Sleep(1000); MessageBox.Show("Request accepted!", "Notification", MessageBoxButton.OK); NotFriendsList = users.UsersNotInFriends(User); RequestList = requests.ViewRecipientRequest(User); } else { MessageBox.Show("Request cannot be accepted.", "Notification", MessageBoxButton.OK); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }