static void Main(string[] args)
        {
            MessageMonitor messageMonitor = new MessageMonitor();

            SystemNotificationBar systemNotificationBar =
                new SystemNotificationBar(messageMonitor);
            YouChat       youChat       = new YouChat(messageMonitor);
            SmartBracelet smartBracelet =
                new SmartBracelet(messageMonitor);

            messageMonitor.messagesCome("在吗", DateTime.Now.ToString());
            Thread.Sleep(1000);
            messageMonitor.messagesCome("今晚有没有空", DateTime.Now.ToString());
            Thread.Sleep(3000);
            messageMonitor.messagesCome("emmm, 我想去看电影 :)", DateTime.Now.ToString());
            Thread.Sleep(2000);
            messageMonitor.messagesCome("你有想看的电影吗", DateTime.Now.ToString());
        }
示例#2
0
 public SystemNotificationBar(MessageMonitor monitor)
 {
     this.monitor = monitor;
     this.monitor.registerObserver(this);
 }
 public YouChat(MessageMonitor monitor)
 {
     this.monitor = monitor;
     this.monitor.registerObserver(this);
 }
 public SmartBracelet(MessageMonitor monitor)
 {
     this.monitor = monitor;
     this.monitor.registerObserver(this);
 }