Ejemplo n.º 1
0
 /// <summary>
 /// Gets a string representing wind information.
 /// </summary>
 /// <param name="t"></param>
 /// <returns></returns>
 public static string Wind(this TabularTime t, bool descriptive)
 {
     return(descriptive ?
            string.Format("{0} to the {1}",
                          t.WindSpeed.Name, t.WindDirection.Name) :
            string.Format("{0} m/s {1}",
                          t.WindSpeed.MetersPerSecond.ToString(), t.WindDirection.Code));
 }
Ejemplo n.º 2
0
        ListViewItem CreateWeatherItem(TabularTime i, bool includeDateInString)
        {
            var lvi = new ListViewItem();

            lvi.Text = string.Format(includeDateInString ? "{2} {0} - {1}" : "{0} - {1}",
                                     i.From.ToShortTimeString(), i.To.ToShortTimeString(),
                                     i.From.ToShortDateString());
            lvi.SubItems.Add(i.Symbol.Name);
            if (imperialUnits && i.Temperature.Unit != "fahrenheit")
            {
                i.Temperature = i.Temperature.AsFahrenheit();
            }
            lvi.SubItems.Add(i.Temperature.ToString());
            lvi.SubItems.Add(i.Precipitation.ToString());
            lvi.SubItems.Add(i.Wind(descriptiveWind));
            lvi.SubItems.Add(i.Pressure.ToString());
            lvi.Tag = i;
            return(lvi);
        }
Ejemplo n.º 3
0
 public static bool FitsInPeriod(this TabularTime t, DateTime time)
 {
     return(time > t.From && time < t.To);
 }