示例#1
0
        /// <summary>
        /// Adds a statistic or updates an existing one if a matching statistic is found
        /// </summary>
        /// <param name="type">
        /// A <see cref="LiveRadioStatisticType"/> that defines the type of the statistic
        /// </param>
        /// <param name="plugin_name">
        /// A <see cref="System.String"/> -- the name of the originating plugin
        /// </param>
        /// <param name="short_message">
        /// A <see cref="System.String"/> with the short info for the statistic
        /// </param>
        /// <param name="long_message">
        /// A <see cref="System.String"/> with the description of the statistic
        /// </param>
        /// <param name="count">
        /// A <see cref="System.Int32"/> -- the number of elements associated with the message
        /// </param>
        private void AddStatistic(LiveRadioStatisticType type,
                                  string plugin_name,
                                  string short_message,
                                  string long_message,
                                  int count)
        {
            LiveRadioStatistic stat = statistics.Find(delegate(LiveRadioStatistic statistic) {
                return(MessageEqual(statistic,
                                    type,
                                    plugin_name,
                                    short_message,
                                    long_message));
            }) ?? new LiveRadioStatistic(type,
                                         plugin_name,
                                         short_message,
                                         long_message);

            stat.AddCount(count);
            if (!statistics.Contains(stat))
            {
                statistics.Add(stat);
            }
            LiveRadioStatisticListModel model = statistic_view.Model as LiveRadioStatisticListModel;

            model.SetList(statistics);
        }
示例#2
0
 /// <summary>
 /// Tests if the messages and types of a LiveRadioStatistic matches with the given parameters
 /// </summary>
 /// <param name="statistic">
 /// A <see cref="LiveRadioStatistic"/> to test
 /// </param>
 /// <param name="type">
 /// A <see cref="LiveRadioStatisticType"/> type to match
 /// </param>
 /// <param name="origin">
 /// A <see cref="System.String"/> containing the plugin name to match
 /// </param>
 /// <param name="short_description">
 /// A <see cref="System.String"/> containing the short info to match
 /// </param>
 /// <param name="long_description">
 /// A <see cref="System.String"/> containing the long info to match
 /// </param>
 /// <returns>
 /// A <see cref="System.Boolean"/> true, if all parameters match the properties of the tested statistic, false otherwise
 /// </returns>
 private bool MessageEqual(LiveRadioStatistic statistic,
                           LiveRadioStatisticType type,
                           string origin,
                           string short_description,
                           string long_description)
 {
     if (statistic.ShortDescription.Equals(short_description) &&
         statistic.LongDescription.Equals(long_description) &&
         statistic.Origin.Equals(origin) &&
         statistic.Type.Equals(type))
     {
         return(true);
     }
     return(false);
 }
 /// <summary>
 /// Tests if the messages and types of a LiveRadioStatistic matches with the given parameters
 /// </summary>
 /// <param name="statistic">
 /// A <see cref="LiveRadioStatistic"/> to test
 /// </param>
 /// <param name="type">
 /// A <see cref="LiveRadioStatisticType"/> type to match
 /// </param>
 /// <param name="origin">
 /// A <see cref="System.String"/> containing the plugin name to match
 /// </param>
 /// <param name="short_description">
 /// A <see cref="System.String"/> containing the short info to match
 /// </param>
 /// <param name="long_description">
 /// A <see cref="System.String"/> containing the long info to match
 /// </param>
 /// <returns>
 /// A <see cref="System.Boolean"/> true, if all parameters match the properties of the tested statistic, false otherwise
 /// </returns>
 private bool MessageEqual(LiveRadioStatistic statistic,
                            LiveRadioStatisticType type,
                            string origin,
                            string short_description,
                            string long_description)
 {
     if (statistic.ShortDescription.Equals (short_description)
         && statistic.LongDescription.Equals (long_description)
         && statistic.Origin.Equals (origin)
         && statistic.Type.Equals (type))
         return true;
     return false;
 }