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/>.
20
namespace WeatherDocklet
23
/// Helper class that contains labels for all units and conversion functions.
25
public class WeatherUnits
28
/// The current unit for temperature values (F, C, etc).
30
public static string TempUnit { get; set; }
33
/// The current unit for wind values (Mph, KM/h, etc).
35
public static string WindUnit { get; set; }
38
/// Converts a temperature in degrees Farenheit to degrees Celsius.
41
/// A <see cref="System.Int32"/> representing a temperature in degrees Farenheit.
44
/// A <see cref="System.Int32"/> value representing the F argument converted to degrees Celsius.
46
public static int ConvertFtoC (int F)
48
return (int) Math.Round ((double) (F - 32) * 5 / 9);
54
/// <param name="Mph">
55
/// A <see cref="System.Int32"/>
58
/// A <see cref="System.Int32"/> value representing the Mph argument converted to Km/h.
60
public static int ConvertMphToKmh (int Mph)
62
return (int) Math.Round ((double) Mph * 1.609344);