static void hero_WorldSaved(object sender, WorldSavedEventArgs e) { StringBuilder superHeroMessageBuilder = new StringBuilder(); superHeroMessageBuilder.Append("Superhero reporting progress! Name: ") .Append(e.SaviourName).Append(", has been working for ").Append(e.WorkHasBeenOngoingHours) .Append(" hours, ").Append(" date of next occasion: ").Append(e.DateOfNextCatastrophy); Console.WriteLine(superHeroMessageBuilder.ToString()); }
private void OnWorldSaved(int hoursPassed, string saviourName, DateTime dateForNextCatastrophy) { if (null != WorldSaved) { WorldSavedEventArgs e = new WorldSavedEventArgs() { DateOfNextCatastrophy = dateForNextCatastrophy, SaviourName = saviourName, WorkHasBeenOngoingHours = hoursPassed }; WorldSaved(this, e); } }