public void add(string url) { Debug.WriteLine($"Adding '{url}' to downloadlist."); ytdl_Item d = new ytdl_Item(url); if (proxy != "") { d.param = $"--proxy {proxy}"; } urls.Add(d); d.StatusChangedEventHandler += StatusChangedEvent; ListChanged(); if (running_threads < max_threads) { running_threads++; d.download(); } }
private void next() { ytdl_Item n = null; try { Debug.WriteLine($"Next: {urls.First(s => s.status.HasFlag(ytdl_State.notstarted))}"); n = urls.First(s => s.status.HasFlag(ytdl_State.notstarted)); } catch { Debug.WriteLine("EXEPTION: next()"); } if (n != null) { running_threads++; n.download(); } }