private static void Main(string[] args) { weather = new WeatherData(); statistic = new StatisticReport(); current = new CurrentConditionsReport(); statistic.Register(weather); current.Register(weather); GetReports(); }
static void Main(string[] args) { WeatherData waetherStation = new WeatherData(); CurrentConditionsReport conditionsReport = new CurrentConditionsReport(); StatisticReport statisticReport = new StatisticReport(); conditionsReport.Register(waetherStation); statisticReport.Register(waetherStation); statisticReport.Unregister(waetherStation); waetherStation.StartNotify(); }
public static void Main(string[] args) { var weatherStation = new WeatherData(); var currentInfo = new CurrentConditionsReport(); var statisticInfo = new StatisticReport(); currentInfo.Register(weatherStation); statisticInfo.Register(weatherStation); while (true) { Thread.Sleep(2000); weatherStation.GenerateWeather(); Console.WriteLine("Current info: " + currentInfo); Console.WriteLine("Statistic: " + statisticInfo); } }
static void Main(string[] args) { Console.WriteLine("Create Current Conditions Report"); CurrentConditionsReport conditionsReport = new CurrentConditionsReport(); Console.WriteLine("Create Statistic Report"); StatisticReport statisticReport = new StatisticReport(); Console.WriteLine("Create observable object: Weather data"); WeatherData weatherData = new WeatherData(50, 2); Console.WriteLine("Register observers Current Conditions Report and Statistic Report"); conditionsReport.Register(weatherData); statisticReport.Register(weatherData); weatherData.StartMeasure(); Console.ReadLine(); }