I for some reason am not able to call another method through the timer and use a variable "x" to input a value into that method using the timer so if anyone could please show me how to properly get a input from the user into that ExecMain method it would be greatly appreciated :)
static void Main(string[] args)
{
// Timer.
var t = new Timer(TimerCallback, null, 0, 2000);
// Prevent the app from closing
Console.ReadLine();
}
private static void TimerCallback(Object o)
{
Console.Clear();
ExecMain(x); //This is where i want to to add a "int x = Convert.ToInt32(Console.ReadLine());"
} //So i basically want it to execute the "ExecMain" method every 2 seconds with the "x" input
static void ExecMain(int input)
{
int treeHeight = input, Space, sX;
Console.WriteLine("Tree:");
for (int i = 1; i <= treeHeight; i++) //Height loop
{
for (Space = 1; Space <= (treeHeight - i); Space++) //space loop
Console.Write(" ");
for (sX = 1; sX <= i; sX++) //left x loop with random ornaments
Console.Write(GetChar(GetRand()));
for (sX = (i - 1); sX >= 1; sX--) //right x loop with random ornaments
Console.Write(GetChar(GetRand()));
Console.WriteLine();
}
for (int k = 1; k <= (treeHeight - 2); k++)
{
Console.Write(" ");
}
Console.Write("| |");
Console.WriteLine();
Console.ReadLine();
}