예제 #1
0
 private void Global_RatingUpdated(object sender, Global.RatingUpdatedEventArgs e)
 {
     if (e.Location.Equals(_location, StringComparison.OrdinalIgnoreCase))
     {
         if (_rating != e.Rating)
         {
             _rating = e.Rating;
             RatingUpdated?.Invoke(this, EventArgs.Empty);
         }
     }
 }
예제 #2
0
        public static void UpdateRating(string location, int rating)
        {
            if (string.IsNullOrEmpty(location))
            {
                throw new ArgumentNullException(nameof(location));
            }
            if (rating < 0 || rating > 5)
            {
                throw new ArgumentOutOfRangeException(nameof(rating));
            }

            RatingUpdated?.Invoke(null, new RatingUpdatedEventArgs(location, rating));
        }
 private void HandleRatingMessage(RatingDto payload)
 {
     CurrentTrack.Rating = ExtractRating(payload);
     RatingUpdated?.Invoke(this, new RatingUpdatedEventArgs(CurrentTrack.Rating));
 }