예제 #1
0
        /// <summary>
        /// 开播
        /// </summary>
        public void Playing()
        {
            var args = new PlayingEventArgs()
            {
                PlayingContent = "LOL",
                Sender         = this
            };

            //把消息通知给所有的观察者
            foreach (var observer in _observers)
            {
                observer.OnPlaying(args);
            }
        }
예제 #2
0
 /// <summary>
 /// 通过这个方法获取主播直播的消息
 /// </summary>
 /// <param name="args"></param>
 public void OnPlaying(PlayingEventArgs args)
 {
     Console.WriteLine($"我是{Name}");
     Console.WriteLine($"收到主播开播消息:");
     Console.WriteLine($"主播:{args.Sender.Name},正在直播:{args.PlayingContent}");
 }