No matter what I do my first Console.Readline entry breaks me out of console. This happens whether I am in debug or release.
I get past my WriteLine
("Which Room Would you like to Trigger? \nRoom 1001 or Room 1002")
and as soon as I hit the ReadLine the console closes.
I'm still learning C# but I never had this issue with Python raw_input(prompt) which I am assuming is the equivalent to C# ReadLine.
My code is below.
bool loopChk = true;
do
{
Console.WriteLine("Which Room Would you like to Trigger? \nRoom 1001 or Room 1002");
string line = Console.ReadLine();
if (line == "1001")
{
await objClient.WritePropertyAsync(fqrs[0], "Present Value", a_bOn ? "on" : "off", CancellationToken.None);
Console.WriteLine("You have Triggered Room 1001");
}
else if (line == "1002")
{
await objClient.WritePropertyAsync(fqrs[1], "Present Value", a_bOn ? "on" : "off", CancellationToken.None);
Console.WriteLine("You have Triggered Room 1002");
}
else if (line == "exit")
{
break;
}
} while (loopChk);