~ubuntu-branches/debian/sid/docky/sid

« back to all changes in this revision

Viewing changes to StandardPlugins/Weather/src/WeatherUnits.cs

  • Committer: Package Import Robot
  • Author(s): Rico Tzschichholz
  • Date: 2012-01-19 19:03:38 UTC
  • mfrom: (1.1.14) (10.1.9 experimental)
  • Revision ID: package-import@ubuntu.com-20120119190338-n44q7tmqsrkudvk7
Tags: 2.1.3-2
* Upload to unstable
* debian/watch:
  + Look for xz tarballs from now on

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//  
2
 
//  Copyright (C) 2009 Robert Dyer
3
 
// 
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.
8
 
// 
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.
13
 
// 
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/>.
16
 
// 
17
 
 
18
 
using System;
19
 
 
20
 
namespace WeatherDocklet
21
 
{
22
 
        /// <summary>
23
 
        /// Helper class that contains labels for all units and conversion functions.
24
 
        /// </summary>
25
 
        public class WeatherUnits
26
 
        {
27
 
                /// <value>
28
 
                /// The current unit for temperature values (F, C, etc).
29
 
                /// </value>
30
 
                public static string TempUnit { get; set; }
31
 
                
32
 
                /// <value>
33
 
                /// The current unit for wind values (Mph, KM/h, etc).
34
 
                /// </value>
35
 
                public static string WindUnit { get; set; }
36
 
                
37
 
                /// <summary>
38
 
                /// Converts a temperature in degrees Farenheit to degrees Celsius.
39
 
                /// </summary>
40
 
                /// <param name="F">
41
 
                /// A <see cref="System.Int32"/> representing a temperature in degrees Farenheit.
42
 
                /// </param>
43
 
                /// <returns>
44
 
                /// A <see cref="System.Int32"/> value representing the F argument converted to degrees Celsius.
45
 
                /// </returns>
46
 
                public static int ConvertFtoC (int F)
47
 
                {
48
 
                        return (int) Math.Round ((double) (F - 32) * 5 / 9);
49
 
                }
50
 
                
51
 
                /// <summary>
52
 
                /// 
53
 
                /// </summary>
54
 
                /// <param name="Mph">
55
 
                /// A <see cref="System.Int32"/>
56
 
                /// </param>
57
 
                /// <returns>
58
 
                /// A <see cref="System.Int32"/> value representing the Mph argument converted to Km/h.
59
 
                /// </returns>
60
 
                public static int ConvertMphToKmh (int Mph)
61
 
                {
62
 
                        return (int) Math.Round ((double) Mph * 1.609344);
63
 
                }
64
 
        }
65
 
}