mirror of
https://github.com/markjprice/cs11dotnet7.git
synced 2026-04-04 13:57:37 +00:00
Initial commit
This commit is contained in:
parent
bc96ccb183
commit
18f89e91d4
62 changed files with 1661 additions and 2 deletions
24
vs4win/Chapter06/PeopleApp/Program.EventHandlers.cs
Normal file
24
vs4win/Chapter06/PeopleApp/Program.EventHandlers.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using Packt.Shared;
|
||||
|
||||
partial class Program
|
||||
{
|
||||
// a method to handle the Shout event received by the harry object
|
||||
static void Harry_Shout(object? sender, EventArgs e)
|
||||
{
|
||||
if (sender is null) return;
|
||||
Person? p = sender as Person;
|
||||
if (p is null) return;
|
||||
|
||||
WriteLine($"{p.Name} is this angry: {p.AngerLevel}.");
|
||||
}
|
||||
|
||||
// another method to handle the Shout event received by the harry object
|
||||
static void Harry_Shout2(object? sender, EventArgs e)
|
||||
{
|
||||
if (sender is null) return;
|
||||
Person? p = sender as Person;
|
||||
if (p is null) return;
|
||||
|
||||
WriteLine($"Stop it!");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue