Exemplo n.º 1
0
 public void update(WeatherInfo info)
 {
     if (m_form != null)
     {
         m_form.updateOpenWeatherMapData(info);
     }
 }
Exemplo n.º 2
0
 public void update(WeatherInfo info)
 {
     if (m_form != null)
     {
         m_form.updateApixuData(info);
     }
 }
Exemplo n.º 3
0
 public void updateApixuData(WeatherInfo info)
 {
     this.Invoke((MethodInvoker)(() =>
     {
         mainInfoApixu.Text = info.description;
         tempApixu.Text = info.temp;
         pressureApixu.Text = info.pressure;
         humidityApixu.Text = info.humidity;
         updTimeApixu.Text = DateTime.Now.ToString("dd.MM.yyyy hh:mm");
     }));
 }
Exemplo n.º 4
0
        private void updateButton_Click(object sender, EventArgs e)
        {
            WeatherInfo weather = factory.getService(comboBox1.SelectedIndex).updateWeatherInfo(textBox1.Text);

            textBox1.Text = weather.town;
            label4.Text   = weather.description;
            label6.Text   = weather.temp;
            label8.Text   = weather.pressure;
            label10.Text  = weather.humidity;
            label5.Text   = DateTime.Now.ToString("dd.MM.yyyy hh:mm");
        }
Exemplo n.º 5
0
 private void updateWeaterInfo()
 {
     foreach (string service in m_factory.services())
     {
         WeatherInfo data = m_factory.getServiceByName(service).updateWeatherInfo(m_town);
         data.service = service;
         if (WeatherInfoLoaded != null)
         {
             WeatherInfoLoaded(data);
         }
     }
 }
Exemplo n.º 6
0
 public void updateOpenWeatherMapData(WeatherInfo info)
 {
     this.Invoke((MethodInvoker)(() =>
     {
         if (info.service == "Open Weather Map")
         {
             mainInfoOWM.Text = info.description;
             tempOWM.Text = info.temp;
             pressureOWM.Text = info.pressure;
             humidityOWM.Text = info.humidity;
             updTimeOWM.Text = DateTime.Now.ToString("dd.MM.yyyy hh:mm");
         }
     }));
 }
Exemplo n.º 7
0
 private void updateWeaterInfo()
 {
     foreach (string service in m_factory.services())
     {
         WeatherInfo data = m_factory.getServiceByName(service).updateWeatherInfo(m_town);
         foreach (var observer in m_observers)
         {
             if (observer.objectName == service)
             {
                 observer.update(data);
             }
         }
     }
 }
Exemplo n.º 8
0
        public WeatherInfo parse(string info)
        {
            if (info.Length == 0)
                return new WeatherInfo();

            WeatherInfo weather = new WeatherInfo();

            JObject o = JObject.Parse(info);

            weather.town = (string)o["location"]["name"];
            weather.temp = (string)o["current"]["temp_c"];
            weather.pressure = (string)o["current"]["pressure_mb"];
            weather.humidity = (string)o["current"]["humidity"];
            weather.description = (string)o["current"]["condition"]["text"];

            return weather;
        }
Exemplo n.º 9
0
        public WeatherInfo parse(string info)
        {
            if (info.Length == 0)
            {
                return(new WeatherInfo());
            }

            WeatherInfo weather = new WeatherInfo();

            JObject o = JObject.Parse(info);

            weather.town        = (string)o["name"];
            weather.temp        = (string)o["main"]["temp"];
            weather.pressure    = (string)o["main"]["pressure"];
            weather.humidity    = (string)o["main"]["humidity"];
            weather.description = (string)o["weather"][0]["main"] + ": " + (string)o["weather"][0]["description"];

            return(weather);
        }
Exemplo n.º 10
0
 public void notify(IObserver observer, WeatherInfo data)
 {
     throw new NotImplementedException();
 }