public void SetCurrentConditions(String weatherDescription) { this.CurrentConditions = weatherDescription; // Depending on the original use case of validating rainy or sunny days, // Instantiate the weatherAlert interface with the appropriate class if (weatherDescription == "rainy") { weatherAlert = new Phone(); String alert = weatherAlert.GenerateWeatherAlert(weatherDescription); Console.WriteLine(alert); } if (weatherDescription == "sunny") { weatherAlert = new Emailer(); String alert = weatherAlert.GenerateWeatherAlert(weatherDescription); Console.WriteLine(alert); } }
public WeatherAlertViewModel(IWeatherAlert model) { DisplayName = "Weather alerts"; _alert = model; }
public FogDecorator(IWeatherAlert weather) : base(weather) { }
public Decorator(IWeatherAlert weather) { this.weather = weather; }
public SnowDecorator(IWeatherAlert weather) : base(weather) { }
public RainDecorator(IWeatherAlert weather) : base(weather) { }
public WindDecorator(IWeatherAlert weather) : base(weather) { }
public WeatherAlertViewModelSample() { _alert = new WeatherAlert(DateTime.Now.AddHours(2), "", DateTime.Now, "ETC", "Bad Weather", "Weather Alert", "crap"); }
public WeatherAlertViewModelSample() { _alert = new WeatherAlert(DateTime.Now.AddHours(2),"", DateTime.Now, "ETC", "Bad Weather","Weather Alert", "crap"); }