introduced waiting

This commit is contained in:
clragon 2019-02-20 21:56:34 +01:00
commit 680d2f4cd7

View file

@ -408,7 +408,7 @@ namespace ExeToBat
else
{
Console.WriteLine("No files specified");
new System.Threading.ManualResetEvent(false).WaitOne(500);
Wait(500);
}
@ -460,6 +460,16 @@ namespace ExeToBat
}
public static void Wait(int ms)
{
using (System.Threading.ManualResetEvent wait = new System.Threading.ManualResetEvent(false))
{
wait.WaitOne(ms);
}
}
/// <summary>
/// A function that displays a list as an enumerated menu on the Cli. Items can be chosen and will be processed by passed functions.
/// <para>Rest in peace, Cloe.</para>
@ -536,7 +546,7 @@ namespace ExeToBat
{
Console.Write("{0}> {1}", Prompt, readInput);
ConsoleKeyInfo input = Console.ReadKey();
new System.Threading.ManualResetEvent(false).WaitOne(20);
Wait(20);
int choiceNum = -1;
switch (input)
{
@ -631,7 +641,7 @@ namespace ExeToBat
{
Console.Write("{0}? [{1}]> ", title, "Y/N");
string Input = Console.ReadKey().KeyChar.ToString();
new System.Threading.ManualResetEvent(false).WaitOne(20);
Wait(20);
Console.Write("\n");
if (string.Equals(Input, "Y", StringComparison.OrdinalIgnoreCase))
{
@ -654,7 +664,7 @@ namespace ExeToBat
public static void ResetInput(string error = "Input Invalid")
{
Console.Write(string.Format("[{0}] {1}", "Error", error));
new System.Threading.ManualResetEvent(false).WaitOne(150);
Wait(150);
ClearCurrentConsoleLine();
Console.SetCursorPosition(0, Console.CursorTop - 1);
ClearCurrentConsoleLine();