A simple way would be moving the code in the (outer switch) cases in dedicated methods, e.g.
switch (choice)
{
case 1:
ProcessLiftLeg(f1);
break;
with
ProcessLiftLeg(F f)
{
f.LiftLeg();
Thread.Sleep(1000);
Write("Press 1 to lover a leg: ");
var choice = byte.Parse(ReadLine());
if ( choice == 1)
{
f.LowerLeg();
Thread.Sleep(2000);
Clear();
}
}
Note, your
while
iterates indefinitely with the same
choice
value.