public async Task AddSectionAsync(BasicSection thisSection) //now can be all async since the console supports async. { await Task.Run(() => { _alreadyHad = true; var firstList = thisSection.SongList !.ToCustomBasicList(); if (firstList.Count == 0) { throw new BasicBlankException("When getting custom list, can't have 0 songs"); } _pList = new CustomBasicList <IBaseSong>(); var howManySongs = PrivateHowManySongs(thisSection, firstList.Count); if (howManySongs == 0) { throw new BasicBlankException("PrivateHowManySongs Can't Return 0 Songs"); } firstList.ShuffleList(howManySongs); //i think if (firstList.Count == 0) { throw new BasicBlankException("Can't have 0 songs after shuffling. Rethink"); } firstList.ForEach(items => { SongsChosen.Add(items.ID); //i think }); _pList = firstList; _rList.AddRange(firstList); }); }
public async Task <ICustomBasicList <IBaseSong> > GetRandomListAsync() { ICustomBasicList <IBaseSong>?tempList = null; await Task.Run(() => { SongsChosen.Clear(); if (_alreadyHad == true) { _alreadyHad = false; tempList = _rList.ToCustomBasicList(); //to get a new one. return; } tempList = _rList.GetRandomList(); //i think this would work too. return; }); return(tempList !); //decided to risk it. }
public MusicShuffleProcesses() { SongsChosen.Clear(); //i think }