G
Guest
I have a C# application that works, with a main menu where the user can
choose different options that run, and then return to the menu. I want to
change it so that the user can starting running an option, then initiate
another menu option, so that both are running at the same time,
independently. As each one finished, that thread would end and the main menu
would remain. Right now my code is like this:
while(true){
MenuChoice=GetChoice();
if(MenuChoice=='A'){
ApplicationA();
}
}
If the user picked A, it runs application A, and then control returns to the
menu program.
In the code it should be something like this:
while(true){
MenuChoice=GetChoice();
if(MenuChoice=='A'){
if(StartThread()){
ApplicationA();
}
}
}
So that each time a menu choice is started, it is a new thread, and the main
menu thread keeps waiting for input from the user if they choose another
option.
The threads should be totally independent, so that I can have static
classes, etc, but they do not interact in any way.
Is there a way to do this? Thanks.
choose different options that run, and then return to the menu. I want to
change it so that the user can starting running an option, then initiate
another menu option, so that both are running at the same time,
independently. As each one finished, that thread would end and the main menu
would remain. Right now my code is like this:
while(true){
MenuChoice=GetChoice();
if(MenuChoice=='A'){
ApplicationA();
}
}
If the user picked A, it runs application A, and then control returns to the
menu program.
In the code it should be something like this:
while(true){
MenuChoice=GetChoice();
if(MenuChoice=='A'){
if(StartThread()){
ApplicationA();
}
}
}
So that each time a menu choice is started, it is a new thread, and the main
menu thread keeps waiting for input from the user if they choose another
option.
The threads should be totally independent, so that I can have static
classes, etc, but they do not interact in any way.
Is there a way to do this? Thanks.