public void WriteToConsoleAndWait() { System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); int p = (int)duration.TotalSeconds + 1; var cl = new ConsoleWriter(); int youoffset = YouNumberInQueue(); while (p != -1) { Console.SetCursorPosition(0, youoffset + cl.GetCountStringsFromConsole()); Console.WriteLine("::" + ((int)((duration.TotalSeconds - p) / 60)).ToString() + ":" + ((duration.TotalSeconds - p) % 60).ToString() + "::" + duration.Minutes.ToString() + ':' + duration.Seconds.ToString() + "::" + artist + " - " + name + "::" + "playing now"); Thread.Sleep(990); stopWatch.Stop(); p--; } var cl1 = new WorkWithThreads(); cl1.AbortRecord(this); Console.SetCursorPosition(0, youoffset + cl.GetCountStringsFromConsole()); string s = "::" + ((int)((duration.TotalSeconds - p) / 60)).ToString() + ":" + ((duration.TotalSeconds - p) % 60).ToString() + "::" + duration.Minutes.ToString() + ':' + duration.Seconds.ToString() + "::" + artist + " - " + name + "::" + "playing now"; string news = ""; for (int i = 0; i <= s.Length; i++) { news = news + ' '; } Console.WriteLine(news); Console.SetCursorPosition(0, cl.GetCountStringsFromConsole() - 2); }
public void WriteToConsoleAndWait() { System.Diagnostics.Stopwatch stopWatch=new System.Diagnostics.Stopwatch(); int p = (int)duration.TotalSeconds+1; var cl = new ConsoleWriter(); int youoffset = YouNumberInQueue(); while(p!=-1) { Console.SetCursorPosition(0,youoffset+cl.GetCountStringsFromConsole()); Console.WriteLine("::" + ((int)((duration.TotalSeconds - p) / 60)).ToString() + ":" + ((duration.TotalSeconds - p) % 60).ToString() + "::" + duration.Minutes.ToString() + ':' + duration.Seconds.ToString() + "::" + artist + " - " + name + "::" + "playing now"); Thread.Sleep(990); stopWatch.Stop(); p--; } var cl1 = new WorkWithThreads(); cl1.AbortRecord(this); Console.SetCursorPosition(0, youoffset + cl.GetCountStringsFromConsole()); string s="::" + ((int)((duration.TotalSeconds - p) / 60)).ToString() + ":" + ((duration.TotalSeconds - p) % 60).ToString() + "::" + duration.Minutes.ToString() + ':' + duration.Seconds.ToString() + "::" + artist + " - " + name + "::" + "playing now"; string news = ""; for(int i = 0;i <= s.Length;i++) { news = news + ' '; } Console.WriteLine(news); Console.SetCursorPosition(0, cl.GetCountStringsFromConsole()-2); }
public void ProcessingMenuRecord(record r) { Console.SetCursorPosition(0, 0); if(r == null) { Console.Clear(); Console.WriteLine("none record doesn't play\nPress any key to back"); Console.ReadLine(); } else { int sel = -1; while(sel != 0) { sel = MenuRecord(r); Console.Clear(); Console.SetCursorPosition(0, 0); switch(sel) { case 0: break; case 1: var th =SearchThread(r); if(th == null) { var cl = new WorkWithThreads(); ConsoleCLear(); cl.AddPlaingRecord(r); Console.SetCursorPosition(0, 0); Console.WriteLine("Your record is started successfull\nPress any key to back"); Console.ReadLine(); } else { Console.WriteLine("this record is plying now"); Console.WriteLine("Press any key to back"); Console.ReadLine(); } sel = 0; break; case 2: try { var thr =SearchThread(r); var cl = new WorkWithThreads(); cl.AbortRecord(r); Console.SetCursorPosition(0, 0); Console.WriteLine("Your record is stoped successfull"); } catch { Console.SetCursorPosition(0, 0); Console.WriteLine("Your record doesn't playing now"); } Console.WriteLine("Press any key to back"); Console.ReadLine(); sel = 0; break; case 3: r.WriteToConsole(); r.WriteAbout(); Console.WriteLine("Press any key to back"); Console.ReadLine(); break; } } } }
public void ProcessingMenuRecord(record r) { Console.SetCursorPosition(0, 0); if (r == null) { Console.Clear(); Console.WriteLine("none record doesn't play\nPress any key to back"); Console.ReadLine(); } else { int sel = -1; while (sel != 0) { sel = MenuRecord(r); Console.Clear(); Console.SetCursorPosition(0, 0); switch (sel) { case 0: break; case 1: var th = SearchThread(r); if (th == null) { var cl = new WorkWithThreads(); ConsoleCLear(); cl.AddPlaingRecord(r); Console.SetCursorPosition(0, 0); Console.WriteLine("Your record is started successfull\nPress any key to back"); Console.ReadLine(); } else { Console.WriteLine("this record is plying now"); Console.WriteLine("Press any key to back"); Console.ReadLine(); } sel = 0; break; case 2: try { var thr = SearchThread(r); var cl = new WorkWithThreads(); cl.AbortRecord(r); Console.SetCursorPosition(0, 0); Console.WriteLine("Your record is stoped successfull"); } catch { Console.SetCursorPosition(0, 0); Console.WriteLine("Your record doesn't playing now"); } Console.WriteLine("Press any key to back"); Console.ReadLine(); sel = 0; break; case 3: r.WriteToConsole(); r.WriteAbout(); Console.WriteLine("Press any key to back"); Console.ReadLine(); break; } } } }