Exemplo n.º 1
0
 public static WeatherResponse GetCurrentWeatherResponse(Forecast forecast)
 {
     return(new WeatherResponse()
     {
         // convert the data from api to the data that we want to share to client
         WeatherText = forecast.WeatherText,
         IsDayTime = forecast.IsDayTime,
         Pressure = forecast.Pressure.Imperial.Value,
         RelativeHumidity = forecast.RelativeHumidity,
         RetrievedTime = Timestamp.FromDateTime(DateTime.UtcNow),
         Temperature = forecast.Temperature.Imperial.Value,
         UVIndex = forecast.UVIndex,
         WeatherIcon = forecast.weatherIcon,
         WeatherUri = $"https://developer.accuweather.com/sites/default/fi"
     });
 }
Exemplo n.º 2
0
 private int PanelDisplayer(int panelCounter, Forecast forecast)
 {
     // Iterate all picture box
     foreach (PictureBox pb in Controls.Cast <Control>().Where(x => x is PictureBox).Select(x => x as PictureBox))
     {
         // If picture box name contains panel counter (need for sequential display)
         if (pb.Name.Contains(panelCounter.ToString()))
         {
             // Set icon
             pb.BackgroundImage = forecast.Weather[0].Icon;
             // Add one to panel counter
             panelCounter++;
         }
         continue;
     }
     return(panelCounter);
 }
Exemplo n.º 3
0
 protected override void DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling)
 {
     _forecastViewController = BeatSaberUI.CreateViewController <Forecast>();
     _effectViewController   = BeatSaberUI.CreateViewController <EffectSettings>();
     try
     {
         if (firstActivation)
         {
             SetTitle("Forecast");
             showBackButton = true;
             _forecastViewController.flow = this;
             ProvideInitialViewControllers(_forecastViewController);
         }
     }
     catch (Exception ex)
     {
         Plugin.Log.Error(ex);
     }
 }
Exemplo n.º 4
0
 public async Task pullForecastAsync()
 {
     string json = new WebClient().DownloadString(this.URL + "?lat=" + this.LATITUDE + "&lon=" + this.LONGITUDE + "&units=" + this.UNITE + "&lang=" + this.LANG + "&appid=" + this.APIKEY);
     //Séréalisation du json pour obtenir un objet
     this.f = JsonConvert.DeserializeObject<Forecast>(json);
 }