Ejemplo n.º 1
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            WeatherForecast.DayWeather dayWeather;
            try
            {
                dayWeather = new WeatherForecast.DayWeather()
                {
                    Day              = dateTimePicker1.Value,
                    Weather          = (WeatherForecast.Weather)weatherListBox.SelectedItem,
                    DayTemperature   = Convert.ToDouble(dayTempTextBox.Text),
                    NightTemperature = Convert.ToDouble(nightTempTextBox.Text)
                };

                _weatherService.AddDayWeather(dayWeather);
            }
            catch (Exception ex)
            {
                MessageBox.Show(MyStrings.AddException + ex.Message);
                return;
            }
            var args = new DayWeatherAddedEventArgs()
            {
                DayWeather = dayWeather
            };

            OnDayWeatherAdded(args);
            MessageBox.Show(MyStrings.AddSuccess);
        }
Ejemplo n.º 2
0
 protected virtual void OnDayWeatherAdded(DayWeatherAddedEventArgs e)
 {
     DayWeatherAdded?.Invoke(this, e);
 }
Ejemplo n.º 3
0
 private void OnDayWeatherAdded(object sender, DayWeatherAddedEventArgs e)
 {
     LoadData();
 }