Пример #1
0
 private WeatherInfo ToWeatherInfo(ForecastTime currentWeather, bool forTime)
 {
     return(new WeatherInfo(
                forTime ? currentWeather.From : currentWeather.Day,
                currentWeather.Temperature.Value,
                currentWeather.Temperature.Min,
                currentWeather.Temperature.Max,
                currentWeather.Pressure.Value,
                currentWeather.Humidity.Value,
                currentWeather.Precipitation.Value,
                $"{(int)currentWeather.WindSpeed.Mps}",
                currentWeather.Clouds.Value,
                currentWeather.Symbol.Number.ToString()));
 }
Пример #2
0
        private void SendForecast(ForecastTime fr, int num)
        {
            ushort tempJoin    = (ushort)(1 + num - 1);
            ushort weatherJoin = (ushort)(2 + num - 1);
            ushort iconJoin    = (ushort)(5 + num - 1);
            ushort timeJoin    = (ushort)(5 + num - 1);
            ushort tempSJoin   = (ushort)(9 + num);

            OnAnalog?.Invoke(tempJoin, (ushort)(fr.Temperature.Value * 10));
            OnSerial?.Invoke(weatherJoin, fr.Symbol.Name);
            OnAnalog?.Invoke(iconJoin, IconToCrestronVT(fr.Symbol.Var, fr.To));
            string sTime = fr.To.ToString("t") + (fr.To.Day == DateTime.Now.Day ? "" : " (+1)");

            OnSerial?.Invoke(timeJoin, sTime);
            OnSerial?.Invoke(tempSJoin, Math.Round(fr.Temperature.Value, 1).ToString() + "°");
        }