示例#1
0
文件: PubSub.cs 项目: Premsjce/DJP
 public void Publish()
 {
     if(OnPublish!= null)
     {
         NotificationEvent notificationEvent = new NotificationEvent($"Published form {Name}", DateTime.Now);
         OnPublish(this, notificationEvent);
     }
 }
示例#2
0
文件: PubSub.cs 项目: Premsjce/DJP
 protected virtual void OnNotificationRecieved(Publisher publisher, NotificationEvent notificationEvent)
 {
     Console.WriteLine($"Hey, {SubsriberName}, {notificationEvent.NotificationMessage} - {publisher.Name} at {notificationEvent.NotificationDate}");
 }