Beispiel #1
0
        public Form1()
        {
            InitializeComponent();
            ws   = new WeatherStation();
            obs1 = new Website();
            obs2 = new Wireless();

            ws.Attach(obs1);
            ws.Attach(obs2);

            listObs = new List <FormObserver>();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            WeatherStation weatherStation = new WeatherStation();
            NewsAgency     agency1        = new NewsAgency("Alpha");
            NewsAgency     agency2        = new NewsAgency("Beta");
            NewsAgency     agency3        = new NewsAgency("Gamma");
            NewsAgency     agency4        = new NewsAgency("Delta");

            weatherStation.Attach(agency1);
            weatherStation.Attach(agency2);
            weatherStation.Attach(agency3);
            weatherStation.Attach(agency4);
            weatherStation.Temperature = 22.1f;
            weatherStation.Temperature = 37.5f;
            weatherStation.Temperature = 49.4f;
            weatherStation.Temperature = 0.4f;
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            WeatherStation weatherStation = new WeatherStation();

            NewsAgency agency1 = new NewsAgency("Best News Agency");

            weatherStation.Attach(agency1);
            NewsAgency agency2 = new NewsAgency("Fake News Agency");

            weatherStation.Attach(agency2);
            NewsAgency agency3 = new NewsAgency("Yellow Press Agency");

            weatherStation.Attach(agency3);

            weatherStation.Temp = 18.4f;
            weatherStation.Temp = 25.6f;
            weatherStation.Temp = 31.4f;
            weatherStation.Temp = 14.4f;
            weatherStation.Temp = 29.6f;

            Console.ReadKey();
        }