Click here to Skip to main content
12,242,189 members (53,340 online)
Click here to Skip to main content

Tagged as

Stats

52.7K views
335 downloads
92 bookmarked
Posted

How we can write on C# in Linux: Implementing PanelApplet to Gnome Desktop

, 8 Mar 2010 CPOL
This article describes how we can use our programming skills on the .NET framework to implement platform-independent code
appletSource1
appletSource1.pidb
appletSource1.userprefs
appletSource1_Factory.server
bin
Debug
appletSource1.exe
appletSource1.exe.mdb
Data
weather.wsdl
Model
View
using System;
using System.Linq;
using System.Xml.Linq;
using System.Collections.Generic;

using WeatherApplet.Data;

namespace WeatherApplet.Model
{

	public static class WeatherService
	{
		private  static GlobalWeather service = new GlobalWeather();
		private static Dictionary<string, IEnumerable<string>> 
			citiesOfcountry = new Dictionary<string, IEnumerable<string>>();
			
		public static CurrentWeather GetWeather(string country, string city)
		{
			string xml = service.GetWeather(city, country);
			XElement root = XElement.Parse(xml);
			
			return CurrentWeather.Create(root.ToString());
		}
		
		
		public static IEnumerable<string> GetCitiesByCountry(string country)
		{
			if(!citiesOfcountry.ContainsKey(country))
			{
				string xml = service.GetCitiesByCountry(country);
				
				XElement root = XElement.Parse(xml);
								
				citiesOfcountry.Add(country, 
					    (from city in root.Elements()
				         orderby city.Element("City").Value
						 select city.Element("City").Value));
			}
			
			return citiesOfcountry[country];
		}
		
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Ilya Builuk
Software Developer (Senior) Nokia
Germany Germany
Interested in design/development of framework functionality using the best patterns and practices.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160426.1 | Last Updated 9 Mar 2010
Article Copyright 2010 by Ilya Builuk
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid