public int GetUserInputChar() { try { InputCharQueue.Clear(); InputCharQueue.Clear(); WaitForUserInput?.Invoke(this, EventArgs.Empty); while (InputCharQueue.Count == 0) { Thread.Sleep(10); } return(InputCharQueue.Pop()); } finally { EndWaitForUserInput?.Invoke(this, EventArgs.Empty); } }
public string GetUserInputString() { try { InputCharQueue.Clear(); InputCharQueue.Clear(); WaitForUserInput?.Invoke(this, EventArgs.Empty); while (!InputCharQueue.Contains('\r')) { Thread.Sleep(10); } InputCharQueue.Pop(); //pops \r return(new string(InputCharQueue.Reverse().ToArray())); } finally { EndWaitForUserInput?.Invoke(this, EventArgs.Empty); } }