Exemple #1
0
        /// <summary>
        /// Event implementation that notifies the user when a population has changed
        /// </summary>
        /// <param name="sender">The source of the event</param>
        /// <param name="eventArgs">The event arguements</param>
        public void NotifyPopulationChanged(object sender, PopulationChangeEventArgs eventArgs)
        {
            string oldPopulation = string.Format("{0:n0}", eventArgs.OldPopulation);
            string newPopulation = string.Format("{0:n0}", eventArgs.NewPopulation);

            Console.WriteLine($"\n{CapitalizeString(eventArgs.CityName)}, {CapitalizeString(eventArgs.ProvinceName)} Population Changed From {oldPopulation} to {newPopulation}\n");
        }
 /// <summary>
 /// Invokes all event subscribers registered to NotifyPopulationChange when called
 /// </summary>
 /// <param name="e">The event arguements</param>
 public void OnPopulationChange(PopulationChangeEventArgs e)
 {
     NotifyPopulationChange?.Invoke(this, e);
 }