Example #1
0
        public SongVote AddSongVote(SongVote vote)
        {
            if (CanVote)
            {
                AllVotes[vote.VoterId] = vote.SongId;
                VotingResultsStream.OnNext(GenerateVotingResults(AllSongs, AllVotes, CanVote));
                return(vote);
            }

            return(new SongVote {
                VoterId = vote.VoterId, SongId = AllVotes[vote.VoterId]
            });
        }
Example #2
0
        public void Reset(IEnumerable <Song> songs, Song currentlyPlaying)
        {
            Logger.LogDebug("PartyService: Reset");
            Console.WriteLine("PartyService: Reset");

            AllSongs.Clear();
            foreach (Song song in songs)
            {
                AllSongs.Add(song);
            }

            AllVotes.Clear();
            CanVote          = true;
            CurrentlyPlaying = currentlyPlaying;

            SongListingStream.OnNext(GenerateSongListing(AllSongs, CurrentlyPlaying));
            VotingResultsStream.OnNext(GenerateVotingResults(AllSongs, AllVotes, CanVote));
        }
Example #3
0
 public void LockVoting()
 {
     CanVote = false;
     VotingResultsStream.OnNext(GenerateVotingResults(AllSongs, AllVotes, CanVote));
 }