public ElementOfThread SearchThread(record rec) { var clas = new WorkWithThreads(); if (clas.GetExectionThreads() != null) { ElementOfThread t = null; foreach (var temp in clas.GetExectionThreads()) { if (temp.GetName() == rec) { t = temp; } } if (t == null) { return(null); } else { return(t); } } else { return(null); } }
public void ProcessingMenuPlayList(List <ElementOfThread> list) { int sel = -1; while (sel != 0) { sel = MenuPlayList(list); if (sel != 0) { int ch = sel; ch--; if (list != null) { ElementOfThread r = null; foreach (var next in list) { if (ch < 1) { r = next; break; } ch--; } ProcessingMenuRecord(r.GetName()); } } else if (list == null) { Console.WriteLine("PlayList is empty\nPress any key to back"); Console.ReadLine(); } } }
private int YouNumberInQueue() { var t = new ConsoleWriter(); int c = 0; var clas = new WorkWithThreads(); if (clas.GetExectionThreads() != null) { ElementOfThread p = null; foreach (var temp in clas.GetExectionThreads()) { if (temp.GetName() == this) { p = temp; c--; } c++; } return(c); } else { return(-1); } }
public void AddPlaingRecord(record rec) { Thread ExThread = new Thread(rec.WriteToConsoleAndWait); ElementOfThread element = new ElementOfThread(ExThread, rec); if(PlayingRecords == null) CreateNewQueue(); PlayingRecords.Add(element); ExThread.Start(); }
public void AbortRecord(record r) { var cl = new ConsoleWriter(); ElementOfThread element = cl.SearchThread(r); PlayingRecords.Remove(element); if (PlayingRecords.Count == 0) { PlayingRecords.Clear(); } }
public void AddPlaingRecord(record rec) { Thread ExThread = new Thread(rec.WriteToConsoleAndWait); ElementOfThread element = new ElementOfThread(ExThread, rec); if (PlayingRecords == null) { CreateNewQueue(); } PlayingRecords.Add(element); ExThread.Start(); }