Hello, I am trying to write a method that loops and repeatedly calls other methods. There is a single place inside the loop that I need to pause and wait for a user to click one of several buttons on the GUI. I have done this with command line code before, but I'm not sure how to wait and check it any buttons have been clicked. If someone could help me out, I would be very grateful. Below is an example of what I would like to do.
While(MoreLeftToD0){ Method1(); WaitForUserToClickButton(); If(Button1 was clicked) ProcessWithButton1(); else ProcessWithButton2(); }
EDIT: I think a bit more info may help, and perhaps I am thinking about this incorrectly. I am trying to build a simple game that has 2 players 0, 1, or 2 of these players may be bots and the other(s) will be humans. I want a basic Player class that has Human and Bot classes which inherit from Player.
The loop is for the game board and I want to just be able to call CurrentPlayer.GetMove(gameBoard) which, for the bot, will pass the game board in and let them decide on a move. However, if it is a human, GetMove() should wait for the user to click the button on the GUI stating what they want to do on the board and then process the click accordingly.
Hopefully this will clear up the purpose a bit. If there is a better way to do this, I'd love to hear suggestions. Thanks!