private static void OnSongSuggestion(SharkEvent p_SharkEvent) { var s_Event = (SongSuggestionEvent)p_SharkEvent; lock (Suggestions) { SongSuggestion s_Suggestion; // No entry exists for this suggestion yet; create one. if (!Suggestions.TryGetValue(s_Event.SongID, out s_Suggestion)) { s_Suggestion = new SongSuggestion() { SongID = s_Event.SongID, SongName = s_Event.SongName, AlbumID = s_Event.AlbumID, AlbumName = s_Event.AlbumName, ArtistID = s_Event.ArtistID, ArtistName = s_Event.ArtistName, Suggester = new SimpleUser() { UserID = s_Event.UserID, Name = s_Event.User.Username, ProfilePicture = s_Event.User.Picture }, OtherSuggesters = new List <SimpleUser>() }; Suggestions.Add(s_Event.SongID, s_Suggestion); return; } // This user has already suggested this song; ignore. if (s_Suggestion.Suggester.UserID == s_Event.UserID || s_Suggestion.OtherSuggesters.Any(p_User => p_User.UserID == s_Event.UserID)) { return; } s_Suggestion.OtherSuggesters.Add(new SimpleUser() { UserID = s_Event.UserID, Name = s_Event.User.Username, ProfilePicture = s_Event.User.Picture }); } }
public static void ApproveSuggestion(SongSuggestion p_Suggestion) { Application.Library.Broadcast.ApproveSuggestion(p_Suggestion.SongID); }