The "Tower of Hanoi" is an ancient mathematical puzzle. It can be patiently solved in 2n-1 steps where n is the number of disks on the starting peg.
It has an equally elegant recursive solution that will just use a LOT of computational resources to complete.
For these reasons it is "painful" to watch it unfold in front of our eyes while doing nothing.
So we can enjoy the time by listening to some music
Design a Windows Forms App (.NET Framework).
It should allow users to enter the number of disks (textbox) and view in output the list of moves (multiline textbox).
The application has 4 buttons to perform the following:
The main challenge of this application is to perform the tasks in an "asynchronous" fashion.
IMPORTANT: Remember that every time you want to modify a GUI control from a thread/task that is not the one that originated that control you MUST use a MethodInvoker .
Starting the computation of the Hanoi Tower should leave the user the possibility to stop it, and interact with the rest of the application (e.g. the music).
The same should happen while playing music.
To Play a sound file from within a Windows Form Application please refer to https://docs.microsoft.com/en-us/dotnet/desktop/winforms/controls/how-to-play-a-sound-from-a-windows-form
Use the .wav file attached that comes from: https://freesound.org/people/sonsbcnintercultural/sounds/256120/
(I find traditional Persian music very soothing.)
Load the file from the binary folder (e.g this.Player.SoundLocation = @"soundexample.wav";)
Please notice how some method calls for SoundPlayer are already "asynchronous".
The Form should have appropriate Access shortcuts (see Chapter 15 Section 15.2) for the 4 buttons (like Alt+P should activate the 'Play Music' button).
The controls should be enabled/disabled depending on the currently available functionalities.
Display the current progress toward the solution of the Tower (choose appropriate controls/implementations e.g.: percentage labels and progressbars, Hint: we know exactly how many moves we have to do)