示例#1
0
        public MainWindow()
        {
            InitializeComponent();

            WeatherAlertSubject    = new WeatherAlertSubject();
            WeatherAlertOberserver = new WeatherAlertOberserver(WeatherAlertSubject);

            WeatherSubject  = new WeatherSubject();
            WeatherObserver = new WeatherObserver(WeatherSubject);

            //Set by default.
            WeatherSubject.SearchCity = "Eindhoven";

            DataContext = WeatherObserver;
        }
示例#2
0
 public WeatherAlertOberserver(WeatherAlertSubject subject)
 {
     _weatherAlertSubject = subject;
     _weatherAlertSubject.Attach(this);
 }