Skip to content

Usage Instructions (v.1.2.0.0) [DEPRECATED]

Marco Stambor edited this page Jul 17, 2016 · 1 revision

WARNING: These instructions are deprecated!

Using the library is quite simple:

using YahooWeatherNET;

public class Main
{
  private YahooWeatherProvider m_weatherProvider;
  private TemperatureUnit m_tempUnit = TemperatureUnit.Celsius;
  
  public void GetWeatherSync()
  {
    // the lookup is made using a location code (woeid). this method will return the location code matching your search term.
    // you can search for cities or POIs
    string woeid = YahooWeatherProvider.ResolveWeatherCode("Cologne");
  
    m_weatherProvider = new YahooWeatherProvider(woeid, m_tempUnit, "CONSUMER KEY", "CONSUMER SECRET");
    WeatherItem wItem = m_weatherProvider.GetWeather();
  }
  
  public async void GetWeatherAsync()
  {
    string woeid = YahooWeatherProvider.ResolveWeatherCode("Cologne");
  
    m_weatherProvider = new YahooWeatherProvider(woeid, m_tempUnit, "CONSUMER KEY", "CONSUMER SECRET");
    WeatherItem wItem = await m_weatherProvider.GetWeatherAsync();
  }
}

Replace "CONSUMER KEY" and "CONSUMER SECRET" with the strings you aquired from the Yahoo Developer Network. Resolving woeids does not need authentication.

Clone this wiki locally