2
// Copyright (C) 2009 Robert Dyer
4
// This program is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// GNU General Public License for more details.
14
// You should have received a copy of the GNU General Public License
15
// along with this program. If not, see <http://www.gnu.org/licenses/>.
21
namespace WeatherDocklet
24
/// Stores information about one day's weather forecast.
26
public struct WeatherForecast
29
/// The high value for the forecast day.
34
/// The low value for the forecast day.
39
/// The day of the week (3 char string, ex: Mon, Tue, etc).
44
/// The condition for the forecast day.
46
public string condition;
49
/// If there is a chance of precipitation.
54
/// An icon name representing the condition for the forecast day.
59
/// Takes a short name for a day and returns the full name.
61
/// <param name="dow">
62
/// A <see cref="System.string"/> indicating the short name for the day.
65
/// A <see cref="System.string"/> of the day's full name.
67
public static string DayName (string dow)
69
DayOfWeek day = DayOfWeek.Sunday;
71
if (dow.Equals ("Mon"))
72
day = DayOfWeek.Monday;
73
else if (dow.Equals ("Tue"))
74
day = DayOfWeek.Tuesday;
75
else if (dow.Equals ("Wed"))
76
day = DayOfWeek.Wednesday;
77
else if (dow.Equals ("Thu"))
78
day = DayOfWeek.Thursday;
79
else if (dow.Equals ("Fri"))
80
day = DayOfWeek.Friday;
81
else if (dow.Equals ("Sat"))
82
day = DayOfWeek.Saturday;
83
else if (dow.Equals ("Sun"))
84
day = DayOfWeek.Sunday;
86
if (DateTime.Now.DayOfWeek == day)
87
return Catalog.GetString ("Today");
89
if (DateTime.Now.AddDays (1).DayOfWeek == day)
90
return Catalog.GetString ("Tomorrow");
92
return DateTime.Now.AddDays (day - DateTime.Now.DayOfWeek).ToString ("dddd");