using System; using System.Threading; namespace consoleApp2 { class ThreadTest { static void Main() { Thread t1 = new Thread(staric); // this is staric in a positin e Thread t2 = new Thread(staric2); // this is staric 2 in diffrent position while (true) { char x = Console.ReadKey().KeyChar; int Time = 1; if (x == 't' && Time == 1) { Time++; t1.Start(); } else if (x == 't' && Time > 1) { Time++; t2.Start(); } if (x == 'x' && Time == 1) { Time++; t1.Suspend(); } else if (x == 'x' && Time == 2) { Time++; t2.Suspend(); } } } static void staric() { while (true) { Console.SetWindowPosition(0, 0); Console.Write("-"); Thread.Sleep(70); Console.Clear(); Console.Write("\\"); Thread.Sleep(70); Console.Clear(); Console.Write("|"); Thread.Sleep(70); Console.Clear(); Console.Write("/"); Thread.Sleep(70); Console.Clear(); } } static void staric2() { while (true) { Console.SetWindowPosition(0, 1); Console.Write("s"); } } } }
Time
while
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)