<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>EntwicklerForum.org &#187; .Net / ASP.Net / C#</title>
	<atom:link href="http://www.entwicklerforum.org/category/net/feed" rel="self" type="application/rss+xml" />
	<link>http://www.entwicklerforum.org</link>
	<description>Tipps und Tricks für Entwickler</description>
	<lastBuildDate>Fri, 09 Dec 2011 17:54:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Wetter App mit Silverlight erstellen &#252;ber Google Weather API</title>
		<link>http://www.entwicklerforum.org/wetter-app-mit-silverlight-erstellen-uber-google-weather-api-6</link>
		<comments>http://www.entwicklerforum.org/wetter-app-mit-silverlight-erstellen-uber-google-weather-api-6#comments</comments>
		<pubDate>Mon, 24 Oct 2011 13:23:09 +0000</pubDate>
		<dc:creator>r.doderer</dc:creator>
				<category><![CDATA[.Net / ASP.Net / C#]]></category>
		<category><![CDATA[Silverlight, Flex, Flash]]></category>
		<category><![CDATA[C, C++, Objective-C]]></category>

		<guid isPermaLink="false">http://www.entwicklerforum.org/?p=1685</guid>
		<description><![CDATA[Vorwort Dieses Tutorial ist f&#252;r Einsteiger gedacht. Um mitarbeiten zu k&#246;nnen ben&#246;tigen Sie Visual Studio 2010 mit dem Silverlight 4 Add On und Vorkenntnisse in C#. Ich zeige Ihnen hier lediglich eine von vielen L&#246;sungen dieses Problems. Inhalt Google Weather API Erstellen eines Proxy-Services Klassendiagramm Erstellen der Klassen Erstellen der GUI &#160; Google Weather API [...]]]></description>
			<content:encoded><![CDATA[<p><span style="text-decoration: underline;">Vorwort</span></p>
<p>Dieses Tutorial ist f&#252;r Einsteiger gedacht. Um mitarbeiten zu k&#246;nnen ben&#246;tigen Sie Visual Studio 2010 mit dem Silverlight 4 Add On und Vorkenntnisse in C#. Ich zeige Ihnen hier lediglich eine von vielen L&#246;sungen dieses Problems.<br />
<span id="more-1685"></span><br />
<span style="text-decoration: underline;">Inhalt</span></p>
<ol>
<li><a href="#GoogleWeatherAPI">Google Weather API</a></li>
<li><a href="#ProxyService">Erstellen eines Proxy-Services</a></li>
<li><a href="#KlassenDiagramm">Klassendiagramm</a></li>
<li><a href="#Klassen">Erstellen der Klassen</a></li>
<li><a href="#GUI">Erstellen der GUI</a></li>
</ol>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><a name="GoogleWeatherAPI">Google Weather API</a></span></p>
<p>Vorab m&#252;ssen Sie dar&#252;ber im Klaren sein, dass die API nicht Dokumentiert ist. Schauen wir uns die API genauer an:</p>
<p>http://www.google.com/ig/api?weather=Stadt.Land&#038;hl=De</p>
<p>Wenn wir den Link genauer betrachten sehen wir, dass er drei Parameter besitzt welche wir ver&#228;ndern k&#246;nnen. Hier &#8220;Stadt&#8221;, &#8220;Land&#8221; und &#8220;De&#8221;. Man kann allerdings &#8220;Land&#8221; weglassen und anstelle einer Stadt deren Postleitzahl eingeben. Mit dem &#8220;De&#8221; am Ende des Links geben wir an in welcher Sprache uns die Wetterdaten &#252;bermittelt werden sollen. Wenn wir den Link nach diesen Angaben bearbeiten sieht er z.B. so aus:</p>
<p><a href="http://www.google.com/ig/api?weather=Berlin.germany&amp;hl=De" target="_blank">http://www.google.com/ig/api?weather=Berlin.germany&amp;hl=De </a></p>
<p>Hierbei ist es egal ob man das Land in Englisch oder in Deutsch schreibt.</p>
<p>Beim aufrufen dieses Links wird uns eine XML-Struktur angezeigt die wie folgt aussieht:</p>
<p><img src="http://www.entwicklerforum.org/wp-content/uploads/2011/10/xml_full.png" alt="" /></p>
<p>Es gibt nur drei unterschiedliche Parts die f&#252;r uns Interessant sind und zwar:</p>
<p><img src="http://www.entwicklerforum.org/wp-content/uploads/2011/10/important_datas.png" alt="" /></p>
<p>Nun werfen wir einen n&#228;heren Blick auf die drei verschiedenen Parts und suchen uns die Attribute raus die f&#252;r uns wichtig sind.</p>
<p><img src="http://www.entwicklerforum.org/wp-content/uploads/2011/10/xml_important_dates1.png" alt="" /></p>
<ol>
<li>Gibt uns Stadt und Bundesland.</li>
<li>Gibt uns das aktuelle Datum.</li>
<li>Gibt uns an wie das Wetter voraussichtlich wird.</li>
<li>Gibt uns die aktuelle Temperatur in Celsius.</li>
<li>Gibt uns die aktuelle Luftfeuchtigkeit.</li>
<li>Gibt den Pfad an wo das aktuelle Bild zum Wetter liegt.</li>
<li>Gibt uns die aktuelle Windst&#228;rke und Richtung.</li>
<li>Gibt uns den Wochentag.</li>
<li>Gibt uns die Mindesttemperatur.</li>
<li>Gibt uns die Maximaltemperatur.</li>
</ol>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><a name="ProxyService">Erstellen eines Proxy-Services</a></span></p>
<p>Da wir nun die XML-Struktur verstanden und uns die f&#252;r uns wichtigen Punkte herausgesucht haben, geht es daran die API mit Silverlight zu Konsumieren. Hier tritt das erste Problem auf. Silverlight bekommt keinen Zugriff auf die Google API, da es keine <em>crossdomain.xml </em>und keine <em>clientaccesspolicy.xml</em> findet, die Silverlight die Berechtigung zum Zugriff gibt. Silverlight braucht eine von diesen beiden Dateien. In diesen Dateien gibt der Eigent&#252;mer an auf welche Services und Inhalte von wem zugegriffen werden darf und auf welche nicht. Die <em>clientaccesspolicy.xml</em> ist speziell f&#252;r Silverlight entwickelt worden. Die <em>crossdomain.xml </em>wird von Flash verwendet aber da diese Datei schon ziemlich viel Verwendung im Internet hatte haben sich die Entwickler von Silverlight daf&#252;r entschlossen das Silverlight auch nach der<em> crossdomain.xml</em>-Datei sucht. Allerdings nur wenn es keine <em>clientaccesspolicy.xml</em> findet und wenn in der<em> crossdomain.xml</em> der Zugriff von allen Dom&#228;nen gestattet wird. Um trotzdem mit Silverlight auf die Google Weather API zugreifen zu k&#246;nnen, ist ein Proxy-Service notwendig, der sich auf der Download Dom&#228;ne der Silverlight Applikation befindet und die Anfragen an die API stellt. Einen solchen Service erstellen wir an dieser Stelle.</p>
<p><strong>Zur Verdeutlichung:</strong></p>
<p><img src="http://www.entwicklerforum.org/wp-content/uploads/2011/10/proxy_server.png" alt="" /></p>
<p>Den Proxy Service erstellen Sie, indem Sie zuerst eine Silverlight Applikation mit aktivem WCF-Dienst erstellen. Nun f&#252;gen Sie einen WCF Service hinzu, der sp&#228;ter auf die Google Weather API zugreifen wird.</p>
<p><img src="http://www.entwicklerforum.org/wp-content/uploads/2011/10/Create_WCF_Service.png" alt="" /></p>
<p>Diesen lassen wir nun die Google Weather API ansprechen. Hierzu verwenden wir den WebClient und den StreamReader. Folglich m&#252;ssen wir den Google Weather API Link als Stream deklarieren.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Linq</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Runtime.Serialization</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.ServiceModel</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.ServiceModel.Activation</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Net</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.IO</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">namespace</span> WeatherApp<span style="color: #008000;">.</span><span style="color: #0000FF;">Web</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #008000;">&#91;</span>ServiceContract<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">Namespace</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
    <span style="color: #008000;">&#91;</span>SilverlightFaultBehavior<span style="color: #008000;">&#93;</span>
    <span style="color: #008000;">&#91;</span>AspNetCompatibilityRequirements<span style="color: #008000;">&#40;</span>RequirementsMode <span style="color: #008000;">=</span> AspNetCompatibilityRequirementsMode<span style="color: #008000;">.</span><span style="color: #0000FF;">Allowed</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> GoogleWeatherApiService
    <span style="color: #008000;">&#123;</span>
        <span style="color: #008000;">&#91;</span>OperationContract<span style="color: #008000;">&#93;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> GetGoogleWeatherApiString<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> _strCity<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            WebClient client <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> WebClient<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            Stream stream <span style="color: #008000;">=</span> client<span style="color: #008000;">.</span><span style="color: #0000FF;">OpenRead</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;http://www.google.com/ig/api?weather=&quot;</span> <span style="color: #008000;">+</span> _strCity <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;&amp;amp;hl=De&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span>StreamReader streamReader <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> StreamReader<span style="color: #008000;">&#40;</span>stream, <span style="color: #000000;">System.<span style="color: #0000FF;">Text</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">Encoding</span><span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Default</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">return</span> streamReader<span style="color: #008000;">.</span><span style="color: #0000FF;">ReadToEnd</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #008080; font-style: italic;">// Add more operations here and mark them with [OperationContract]</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>In dem Link der Google API befindet sich der String <em>_strCity</em>, da der User sp&#228;ter seine Stadt eingeben k&#246;nnen soll.<br />
Nun f&#252;gen Sie der Silverlight Applikation eine neue Service Referenz hinzu, in dem Sie mit der rechten Maustaste auf Referenzen klicken und dann <em>Service Referenz hinzuf&#252;gen</em> ausw&#228;hlen. Wenn Sie dies getan haben &#246;ffnet sich folgendes Fenster:</p>
<p><img src="http://www.entwicklerforum.org/wp-content/uploads/2011/10/Create_WCF_Reverece.png" alt="" /></p>
<p>&#220;ber<em> Ermitteln</em> wird Visual Studio 2010 Ihren WCF-Service automatisch erkennen.</p>
<p><span style="text-decoration: underline;"><a name="KlassenDiagramm">Klassendiagramm</a></span></p>
<p>Jetzt ist es an der Zeit sich Gedanken dar&#252;ber zu machen, wie unsere Applikation funktionieren soll. Ich empfehle hierzu ein Klassendiagramm, welches Sie in Visual Studio 2010 durch Rechtsklick auf die Klasse erstellen k&#246;nnen. Wir brauchen drei verschiedene Klassen, eine zum Auslesen der Service Referenz und zwei, denen wir die ausgelesenen Daten &#252;bermitteln lassen, damit wir sp&#228;ter Listen dieser Klassen anfertigen k&#246;nnen. In meinem Fall hei&#223;en diese Klassen &#8220;Data&#8221;, &#8220;Current&#8221; und &#8220;Forecast&#8221;.</p>
<p><img src="http://www.entwicklerforum.org/wp-content/uploads/2011/10/Class_Diagramm.png" alt="" /></p>
<p>Welche Methode f&#252;r was zust&#228;ndig ist und was es mit dem Event auf sich hat, werden wir uns sp&#228;ter anschauen. Wichtig vorab zu wissen ist nur, dass die Variablen alle private deklariert wurden und die Eigenschaften der &#8220;Current&#8221; und &#8220;Forecast&#8221; Klassen sp&#228;ter die Variablen ver&#228;ndern.</p>
<p><span style="text-decoration: underline;"><a name="Klassen">Erstellen der Klassen</a></span></p>
<p>Da wir nun wissen, was unsere Klassen beinhalten sollen erstellen wir diese. Ich habe mit der &#8220;Current&#8221; Klassen begonnen.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> Current
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strCity<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> DateTime _oDate <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> DateTime<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strCondition<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">int</span> _intTemp<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strHumidity<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strWindCondition<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strImage<span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span></pre></div></div>

<p>Nun m&#252;ssen wir die Variablen Verkapseln, damit wir diese sp&#228;ter von au&#223;erhalb ver&#228;ndern lassen k&#246;nnen. Hierzu klicken sie einfach mit der rechten Maustaste auf die Variable klicken dann auf <em>Umgestalten</em> und w&#228;hlen <em>Einkapseln</em> aus.</p>
<p><img src="http://www.entwicklerforum.org/wp-content/uploads/2011/10/Encapsulate_Field.png" alt="" /></p>
<p>Wenn Sie dies getan haben wird sich ein Fenster &#246;ffnen in dem Sie den Namen der Variable angeben sollen:</p>
<p><img src="http://www.entwicklerforum.org/wp-content/uploads/2011/10/generate_Encapsulated_Field.png" alt="" /></p>
<p>Wenn Sie nun auf &#8220;OK&#8221; klicken wird die Verkapselung automatisch von Visual Studio 2010 generiert und sieht nun so aus:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strCity<span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> strCity
        <span style="color: #008000;">&#123;</span>
            get <span style="color: #008000;">&#123;</span> <span style="color: #0600FF; font-weight: bold;">return</span> _strCity<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
            set <span style="color: #008000;">&#123;</span> _strCity <span style="color: #008000;">=</span> value<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span></pre></div></div>

<p>Dies machen Sie f&#252;r jede Variable in der Klasse &#8220;Current&#8221;.<br />
Nun k&#246;nnen wir mit der Klasse &#8220;Forecast&#8221; beginnen. In dieser m&#252;ssen Sie ebenfalls die Variablen als privat deklarieren und diese dann Verkapseln.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> Forecast
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strDay<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">int</span> _intLowTemp<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">int</span> _intHighTemp<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">int</span> intHighTemp<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strCondition<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> strCondition<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strImage<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> strImage<span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span></pre></div></div>

<p>Wenn Sie mit diesen beiden Klassen fertig sind und jede Variable Verkapselt haben, k&#246;nnen Sie mit der Data-Klasse beginnen. Diese wird auf die Service Referenz zugreifen und das vom Proxy-Service abgefragte in einen String einspeichern. Dieser String wird mittels XmlReader ausgelesen und die f&#252;r uns wichtigen Daten den entsprechenden Klassen &#252;bergeben und dann eine Liste der Klasse erstellt.</p>
<p>Zuerst deklarieren wir die f&#252;r uns wichtigen Variablen und Listen. Hier brauchen wir keinerlei Verkapselung, da auf diese Variablen von anderen Klassen nicht zugegriffen wird.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> Data
    <span style="color: #008000;">&#123;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strCity<span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strDate<span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strCurrentCondition<span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strCondition<span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strCurrentTemp<span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strHumidity<span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strWindCondition<span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strDay<span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strLowTemp<span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strHighTemp<span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strImage<span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strWeatherData<span style="color: #008000;">;</span> 
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">public</span> List listCurrentList <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">public</span> List listForecastList <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>Nun werden wir uns darum k&#252;mmern, dass das vom WCF-Service an die Referenz &#252;bergebene in einen String eingespeichert wird.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> LoadData<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> _strCity<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            GoogleWeatherApiServiceClient client <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> GoogleWeatherApiServiceClient<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            client<span style="color: #008000;">.</span><span style="color: #0000FF;">GetGoogleWeatherApiStringCompleted</span> <span style="color: #008000;">+=</span> <span style="color: #008000;">new</span> EventHandler
                <span style="color: #008000;">&#40;</span>client_GetGoogleWeatherApiStringCompleted<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            client<span style="color: #008000;">.</span><span style="color: #0000FF;">GetGoogleWeatherApiStringAsync</span><span style="color: #008000;">&#40;</span>_strCity<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #6666cc; font-weight: bold;">void</span> client_GetGoogleWeatherApiStringCompleted
            <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, GetGoogleWeatherApiStringCompletedEventArgs e<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>e<span style="color: #008000;">.</span><span style="color: #0000FF;">Error</span> <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                _strWeatherData <span style="color: #008000;">=</span> e<span style="color: #008000;">.</span><span style="color: #0000FF;">Result</span><span style="color: #008000;">;</span>
                GetData<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                FireXMLReaderReady<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span></pre></div></div>

<p>Zur &#8220;GetData()&#8221;-Methode, die hier ausgef&#252;hrt wird, kommen wir sp&#228;ter. Die &#8220;FireXMLReaderReady()&#8221;-Methode werden wir jetzt implementieren. Die &#8220;FireXMLReaderReader()&#8221;-Methode entsteht durch ein Event, das wir erstellen m&#252;ssen, da die Daten Asynchron geladen werden. Durch das eben genannte asynchrone Laden kann es passieren, dass die Daten noch nicht fertig geladen sind, wenn wir auf diese zugreifen wollen. Um dieses Problem zu l&#246;sen werden wir ein Event erstellen, das ausgel&#246;st wird, wenn die Daten in den String eingetragen wurden.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">event</span> EventHandler XMLReaderReady<span style="color: #008000;">;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> FireXMLReaderReady<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>XMLReaderReady <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
                        XMLReaderReady<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span>, EventArgs<span style="color: #008000;">.</span><span style="color: #0000FF;">Empty</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span></pre></div></div>

<p>Wenn wir dieses Event erstellt haben kommen wir zum Hauptteil, indem wir die f&#252;r uns wichtigen Daten aus dem String auslesen und an die entsprechenden Klassen &#252;bergeben lassen.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">   <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> GetData<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            Current OCurrent <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Current<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            Forecast OForecast <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Forecast<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>            
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span>XmlReader reader <span style="color: #008000;">=</span> XmlReader<span style="color: #008000;">.</span><span style="color: #0000FF;">Create</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">new</span> StringReader<span style="color: #008000;">&#40;</span>_strWeatherData<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">while</span> <span style="color: #008000;">&#40;</span>reader<span style="color: #008000;">.</span><span style="color: #0000FF;">Read</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>reader<span style="color: #008000;">.</span><span style="color: #0000FF;">NodeType</span> <span style="color: #008000;">==</span> XmlNodeType<span style="color: #008000;">.</span><span style="color: #0000FF;">Element</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> <span style="color: #008000;">&#40;</span>reader<span style="color: #008000;">.</span><span style="color: #0000FF;">LocalName</span> <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                    <span style="color: #008000;">&#123;</span>
                        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>reader<span style="color: #008000;">.</span><span style="color: #0000FF;">HasAttributes</span><span style="color: #008000;">&#41;</span>
                        <span style="color: #008000;">&#123;</span>
&nbsp;
                            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;icon&quot;</span> <span style="color: #008000;">==</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">LocalName</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                            <span style="color: #008000;">&#123;</span>
                                _strImage <span style="color: #008000;">=</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">GetAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;data&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                            <span style="color: #008000;">&#125;</span>
                            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;city&quot;</span> <span style="color: #008000;">==</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">LocalName</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                            <span style="color: #008000;">&#123;</span>
                                _strCity <span style="color: #008000;">=</span> TranslateFerderalState<span style="color: #008000;">&#40;</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">GetAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;data&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                            <span style="color: #008000;">&#125;</span>
&nbsp;
                            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;forecast_date&quot;</span> <span style="color: #008000;">==</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">LocalName</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                            <span style="color: #008000;">&#123;</span>
                               _strDate <span style="color: #008000;">=</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">GetAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;data&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                            <span style="color: #008000;">&#125;</span>
&nbsp;
                            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;condition&quot;</span> <span style="color: #008000;">==</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">LocalName</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                            <span style="color: #008000;">&#123;</span>
                               _strCurrentCondition <span style="color: #008000;">=</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">GetAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;data&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                               _strCondition <span style="color: #008000;">=</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">GetAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;data&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                            <span style="color: #008000;">&#125;</span>
&nbsp;
                            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;temp_c&quot;</span> <span style="color: #008000;">==</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">LocalName</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                            <span style="color: #008000;">&#123;</span>
                                _strCurrentTemp <span style="color: #008000;">=</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">GetAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;data&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                            <span style="color: #008000;">&#125;</span>
&nbsp;
                            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;humidity&quot;</span> <span style="color: #008000;">==</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">LocalName</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                            <span style="color: #008000;">&#123;</span>
                                _strHumidity <span style="color: #008000;">=</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">GetAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;data&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                            <span style="color: #008000;">&#125;</span>
&nbsp;
                            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;wind_condition&quot;</span> <span style="color: #008000;">==</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">LocalName</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                            <span style="color: #008000;">&#123;</span>
                                _strWindCondition <span style="color: #008000;">=</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">GetAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;data&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                            <span style="color: #008000;">&#125;</span>
&nbsp;
                            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;day_of_week&quot;</span> <span style="color: #008000;">==</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">LocalName</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                            <span style="color: #008000;">&#123;</span>
                                _strDay <span style="color: #008000;">=</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">GetAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;data&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                            <span style="color: #008000;">&#125;</span>
&nbsp;
                            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;low&quot;</span> <span style="color: #008000;">==</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">LocalName</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                            <span style="color: #008000;">&#123;</span>
                                _strLowTemp <span style="color: #008000;">=</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">GetAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;data&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                            <span style="color: #008000;">&#125;</span>
&nbsp;
                            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;high&quot;</span> <span style="color: #008000;">==</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">LocalName</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                            <span style="color: #008000;">&#123;</span>
                                _strHighTemp <span style="color: #008000;">=</span> reader<span style="color: #008000;">.</span><span style="color: #0000FF;">GetAttribute</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;data&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                            <span style="color: #008000;">&#125;</span>
&nbsp;
                            <span style="color: #0600FF; font-weight: bold;">if</span><span style="color: #008000;">&#40;</span>_strCity <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> _strCity<span style="color: #008000;">!=</span> <span style="color: #666666;">&quot;&quot;</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> _strDate <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> _strDate <span style="color: #008000;">!=</span> <span style="color: #666666;">&quot;&quot;</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span>
                                _strCurrentCondition <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> _strCurrentCondition <span style="color: #008000;">!=</span> <span style="color: #666666;">&quot;&quot;</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span>
                                _strCurrentTemp <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> _strCurrentTemp <span style="color: #008000;">!=</span> <span style="color: #666666;">&quot;&quot;</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> _strHumidity <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span>
                                _strHumidity <span style="color: #008000;">!=</span> <span style="color: #666666;">&quot;&quot;</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> _strWindCondition <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> _strWindCondition <span style="color: #008000;">!=</span> <span style="color: #666666;">&quot;&quot;</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span>
                                _strImage <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> _strImage <span style="color: #008000;">!=</span> <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">&#41;</span>
                            <span style="color: #008000;">&#123;</span>
                                OCurrent<span style="color: #008000;">.</span><span style="color: #0000FF;">strCity</span> <span style="color: #008000;">=</span> _strCity<span style="color: #008000;">;</span>
                                _strDate <span style="color: #008000;">=</span> ConvertStringToDate<span style="color: #008000;">&#40;</span>_strDate<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                                OCurrent<span style="color: #008000;">.</span><span style="color: #0000FF;">ODate</span> <span style="color: #008000;">=</span> DateTime<span style="color: #008000;">.</span><span style="color: #0000FF;">Parse</span><span style="color: #008000;">&#40;</span>_strDate<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                                OCurrent<span style="color: #008000;">.</span><span style="color: #0000FF;">strCondition</span> <span style="color: #008000;">=</span> _strCurrentCondition<span style="color: #008000;">;</span>
                                OCurrent<span style="color: #008000;">.</span><span style="color: #0000FF;">intTemp</span> <span style="color: #008000;">=</span> Convert<span style="color: #008000;">.</span><span style="color: #0000FF;">ToInt32</span><span style="color: #008000;">&#40;</span>_strCurrentTemp<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                                OCurrent<span style="color: #008000;">.</span><span style="color: #0000FF;">strHumidity</span> <span style="color: #008000;">=</span> _strHumidity<span style="color: #008000;">;</span>
                                OCurrent<span style="color: #008000;">.</span><span style="color: #0000FF;">strWindCondition</span> <span style="color: #008000;">=</span> _strWindCondition<span style="color: #008000;">;</span>
                                _strImage <span style="color: #008000;">=</span> ConvertToShortPath<span style="color: #008000;">&#40;</span>_strImage<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                                OCurrent<span style="color: #008000;">.</span><span style="color: #0000FF;">strImage</span> <span style="color: #008000;">=</span> _strImage<span style="color: #008000;">;</span>                               
&nbsp;
                                listCurrentList<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>OCurrent<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                                OCurrent <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Current<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                                _strHumidity <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">;</span>
                                <span style="color: #008080; font-style: italic;">//_strCity = &quot;&quot;;</span>
                                _strDate <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">;</span>
                                _strCurrentCondition <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">;</span>
                                _strCondition <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">;</span>
                                _strCurrentTemp <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">;</span>
                                _strWindCondition <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">;</span>
                            <span style="color: #008000;">&#125;</span>
&nbsp;
                            <span style="color: #0600FF; font-weight: bold;">if</span><span style="color: #008000;">&#40;</span>_strCondition <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> _strCondition <span style="color: #008000;">!=</span> <span style="color: #666666;">&quot;&quot;</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> _strLowTemp <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span>
                                _strLowTemp <span style="color: #008000;">!=</span> <span style="color: #666666;">&quot;&quot;</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> _strHighTemp <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> _strHighTemp <span style="color: #008000;">!=</span> <span style="color: #666666;">&quot;&quot;</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span>
                                _strDay <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> _strDay <span style="color: #008000;">!=</span> <span style="color: #666666;">&quot;&quot;</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> _strImage <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">&amp;</span>amp<span style="color: #008000;">;&amp;</span>amp<span style="color: #008000;">;</span> _strImage <span style="color: #008000;">!=</span> <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">&#41;</span>
                            <span style="color: #008000;">&#123;</span>
                                OForecast<span style="color: #008000;">.</span><span style="color: #0000FF;">intHighTemp</span> <span style="color: #008000;">=</span> Convert<span style="color: #008000;">.</span><span style="color: #0000FF;">ToInt32</span><span style="color: #008000;">&#40;</span>_strHighTemp<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                                OForecast<span style="color: #008000;">.</span><span style="color: #0000FF;">intLowTemp</span> <span style="color: #008000;">=</span> Convert<span style="color: #008000;">.</span><span style="color: #0000FF;">ToInt32</span><span style="color: #008000;">&#40;</span>_strLowTemp<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                                OForecast<span style="color: #008000;">.</span><span style="color: #0000FF;">strCondition</span> <span style="color: #008000;">=</span> _strCondition<span style="color: #008000;">;</span>
                                OForecast<span style="color: #008000;">.</span><span style="color: #0000FF;">strDay</span> <span style="color: #008000;">=</span> _strDay<span style="color: #008000;">;</span>
                                _strImage <span style="color: #008000;">=</span> ConvertToShortPath<span style="color: #008000;">&#40;</span>_strImage<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                                OForecast<span style="color: #008000;">.</span><span style="color: #0000FF;">strImage</span> <span style="color: #008000;">=</span> _strImage<span style="color: #008000;">;</span>
&nbsp;
                                listForecastList<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>OForecast<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                                OForecast <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Forecast<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                                _strDay <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">;</span>
                                _strHighTemp <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">;</span>
                                _strLowTemp <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">;</span>
                                _strCondition <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">;</span>
                                _strImage <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">;</span>
                            <span style="color: #008000;">&#125;</span>
                        <span style="color: #008000;">&#125;</span>
                    <span style="color: #008000;">&#125;</span>
                <span style="color: #008000;">&#125;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span></pre></div></div>

<p>Hier sehen sie mehrere Pr&#252;fungen. Wir lassen pr&#252;fen, ob das was wir ben&#246;tigen, z.B. &#8220;City&#8221;, vorhanden ist. Ist dies der Fall wird es in unsere lokale Variable eingetragen. Wenn diese Pr&#252;fungen alle durchlaufen wurden wird noch gepr&#252;ft ob alle Daten vorhanden sind, welche die Klassen &#8220;Current&#8221; und &#8220;Forecast&#8221; ben&#246;tigen. Trifft dies zu werden die Daten an die Verkapselten Variablen &#252;bergeben und direkt danach wird die entsprechende Klasse in ihre Liste eingetragen. Da nicht alle Daten so Formatiert sind, dass sie f&#252;r uns sofort brauchbar sind, brauchen wir noch drei Methoden die uns helfen die Daten in das richtige Format umzuwandeln.<br />
Als erstes brauchen wir die Methode &#8220;ConvertStringToDate()&#8221;, welche uns das &#252;bergebene Datum, z.B. 2011-10-24 in ein f&#252;r uns brauchbares Format bringt z.B. 24.10.2011.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">string</span> ConvertStringToDate<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> _strDate<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
&nbsp;
            <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> arrDateSplitted <span style="color: #008000;">=</span> _strDate<span style="color: #008000;">.</span><span style="color: #0000FF;">Split</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">'-'</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            _strDate <span style="color: #008000;">=</span> arrDateSplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">2</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;.&quot;</span> <span style="color: #008000;">+</span> arrDateSplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;.&quot;</span> <span style="color: #008000;">+</span> arrDateSplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> _strDate<span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span></pre></div></div>

<p>Desweiteren brauchen wir die Methode &#8220;ConvertToShortPath()&#8221;, die uns den von der Google API gegebenen Link f&#252;r das Bild k&#252;rzt. Dies ist notwendig um sp&#228;ter schneller auf die Bilder zugreifen zu k&#246;nnen.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">string</span> ConvertToShortPath<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> _strImage<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> arrPathSplitted <span style="color: #008000;">=</span> _strImage<span style="color: #008000;">.</span><span style="color: #0000FF;">Split</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">'/'</span>, <span style="color: #666666;">'.'</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            _strImage <span style="color: #008000;">=</span> arrPathSplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">4</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> _strImage<span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span></pre></div></div>

<p>Falls Sie wollen, das die Ausgabe der St&#228;dte und Bundesl&#228;nder in deutsch erfolgt, brauchen Sie noch die Methode &#8220;TranslateFerderalState()&#8221;.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">string</span> TranslateFerderalState<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> _strCity<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> arrCitySplitted <span style="color: #008000;">=</span> _strCity<span style="color: #008000;">.</span><span style="color: #0000FF;">Split</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">','</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>       
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot;Munich&quot;</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;München&quot;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
            <span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #0600FF; font-weight: bold;">if</span><span style="color: #008000;">&#40;</span>arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot;Cologne&quot;</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Köln&quot;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
            <span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #0600FF; font-weight: bold;">if</span><span style="color: #008000;">&#40;</span>arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot;Hanover&quot;</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Hannover&quot;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot;Nuremberg&quot;</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Nürnberg&quot;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>arrCitySplitted<span style="color: #008000;">.</span><span style="color: #0000FF;">Length</span> <span style="color: #008000;">==</span> <span style="color: #FF0000;">2</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot; Thuringia&quot;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot; Thüringen&quot;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot; Saxony&quot;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot; Sachsen&quot;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot; Rhineland-Palatinate&quot;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot; Rheinland Pfalz&quot;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot; Saxony-Anhalt&quot;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot; Sachsen Anhalt&quot;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot; Hesse&quot;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot; Hessen&quot;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot; Mecklenburg-West Pommerania&quot;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot; Mecklenburg Vorpommern&quot;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot; North Rhine-Westphalia&quot;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot; Nordrhein-Westfalen&quot;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot; Lower Saxony&quot;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot; Niedersachsen&quot;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">==</span> <span style="color: #666666;">&quot; Bavaria&quot;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot; Bayern&quot;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
                <span style="color: #0600FF; font-weight: bold;">else</span>
                <span style="color: #008000;">&#123;</span>
                    arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">=</span> arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
                _strCity <span style="color: #008000;">=</span> arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;,&quot;</span> <span style="color: #008000;">+</span> arrCitySplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">return</span> _strCity<span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span></pre></div></div>

<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><a name="GUI">Erstellen der GUI</a></span></p>
<p>Nach der Implementierung der Logik m&#252;ssen wir noch die GUI (Grafische Benutzeroberfl&#228;che) entwerfen und daf&#252;r sorgen, dass die Daten auch korrekt &#252;bergeben und angezeigt werden.</p>
<p>Entwerfen wir zuerst die GUI:</p>
<p><img src="http://www.entwicklerforum.org/wp-content/uploads/2011/10/GUI_entwurrf.png" alt="" /></p>
<p>Meinen XAML-Code finden Sie in meiner Projektmappe.</p>
<p>Lassen Sie Ihrer Fantasie freien lauf und gestalten Sie die Oberfl&#228;che so wie Sie es m&#246;chten.</p>
<p>Als Bilder benutze ich die standard Google Weather-Bilder. Um dies ebenfalls zu tun laden sie diese einfach runter und wandeln Sie diese von &#8220;.gif&#8221; zu &#8220;.png&#8221; um, da Silverlight &#8220;.gif&#8221; nicht verwenden kann. Bei mir liegen diese Bilder dann in der Projektmappe in einem separaten Ordner Namens &#8220;GoogleWeatherImages&#8221;.</p>
<p><strong><span style="color: red; text-decoration: underline;">Achtung:</span></strong> sollten Sie sich entschlie&#223;en Ihre GUI anders zu gestalten m&#252;ssen Sie darauf achten, dass die &#220;bergabe der Daten auf die GUI anders aussehen wird als bei meinem Beispiel.</p>
<p>Bevor wir mit der &#220;bergabe der Daten an die GUI beginnen m&#252;ssen wir erst einmal daf&#252;r sorgen, dass unser Projekt beim Start die &#8220;LoadData()&#8221;-Methode der Klasse Data ausf&#252;hrt. Daraufhin soll dann das Event &#8220;FireXMLReaderReady()&#8221; gefeuert werden.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">        Data OData <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Data<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        List listCurrentList <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        List listForecastList <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>              
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">public</span> Weather<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            OData<span style="color: #008000;">.</span><span style="color: #0000FF;">LoadData</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Berlin&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            InitializeComponent<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            OData<span style="color: #008000;">.</span><span style="color: #0000FF;">XMLReaderReady</span> <span style="color: #008000;">+=</span> <span style="color: #008000;">new</span> EventHandler<span style="color: #008000;">&#40;</span>OData_XMLReaderReady<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strImagePath <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;/WeatherApp;component/GoogleWeatherImages/&quot;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> _strDate<span style="color: #008000;">;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"> <span style="color: #6666cc; font-weight: bold;">void</span> OData_XMLReaderReady<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, EventArgs e<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">try</span>
            <span style="color: #008000;">&#123;</span>
                listCurrentList <span style="color: #008000;">=</span> OData<span style="color: #008000;">.</span><span style="color: #0000FF;">listCurrentList</span><span style="color: #008000;">;</span>
                listForecastList <span style="color: #008000;">=</span> OData<span style="color: #008000;">.</span><span style="color: #0000FF;">listForecastList</span><span style="color: #008000;">;</span>
                BuildApp<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
            <span style="color: #0600FF; font-weight: bold;">catch</span> <span style="color: #008000;">&#40;</span>Exception<span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                MessageBox<span style="color: #008000;">.</span><span style="color: #0000FF;">Show</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Bitte eine korrekte Stadt eingeben.&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> BuildApp<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            _strDate <span style="color: #008000;">=</span> listCurrentList<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ODate</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToShortDateString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            _strDate <span style="color: #008000;">=</span> FormateDateString<span style="color: #008000;">&#40;</span>_strDate<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            _lblCityLable<span style="color: #008000;">.</span><span style="color: #0000FF;">Content</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Wetter in &quot;</span> <span style="color: #008000;">+</span> listCurrentList<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">strCity</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;:&quot;</span><span style="color: #008000;">;</span>
            _lblConditionLabel<span style="color: #008000;">.</span><span style="color: #0000FF;">Content</span> <span style="color: #008000;">=</span> listCurrentList<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">strCondition</span><span style="color: #008000;">;</span>
            _lblMinMaxLabel<span style="color: #008000;">.</span><span style="color: #0000FF;">Content</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Min&quot;</span> <span style="color: #008000;">+</span> listForecastList<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">intLowTemp</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;°C&quot;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;|&quot;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;Max&quot;</span> <span style="color: #008000;">+</span> listForecastList<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">intHighTemp</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;°C&quot;</span><span style="color: #008000;">;</span>
            _lblHumidityLabel<span style="color: #008000;">.</span><span style="color: #0000FF;">Content</span> <span style="color: #008000;">=</span> listCurrentList<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">strHumidity</span><span style="color: #008000;">;</span>
            _lblWindConditionLabel<span style="color: #008000;">.</span><span style="color: #0000FF;">Content</span> <span style="color: #008000;">=</span> listCurrentList<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">strWindCondition</span><span style="color: #008000;">;</span>
            _lblCurrentTempLabel<span style="color: #008000;">.</span><span style="color: #0000FF;">Content</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Aktuell: &quot;</span> <span style="color: #008000;">+</span> listCurrentList<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">intTemp</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;°C&quot;</span><span style="color: #008000;">;</span>
            _lblTodayLable<span style="color: #008000;">.</span><span style="color: #0000FF;">Content</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Heute, der &quot;</span> <span style="color: #008000;">+</span> _strDate <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;(&quot;</span> <span style="color: #008000;">+</span> listForecastList<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">strDay</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;)&quot;</span><span style="color: #008000;">;</span>
            _imgTodayImage<span style="color: #008000;">.</span><span style="color: #0000FF;">Source</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> BitmapImage<span style="color: #008000;">&#40;</span><span style="color: #008000;">new</span> Uri<span style="color: #008000;">&#40;</span>_strImagePath <span style="color: #008000;">+</span> listCurrentList<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">strImage</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;.png&quot;</span>, UriKind<span style="color: #008000;">.</span><span style="color: #0000FF;">RelativeOrAbsolute</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            _lblDay1Label<span style="color: #008000;">.</span><span style="color: #0000FF;">Content</span> <span style="color: #008000;">=</span> listForecastList<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">strDay</span><span style="color: #008000;">;</span>
            _lblDay1MinMaxLabel<span style="color: #008000;">.</span><span style="color: #0000FF;">Content</span> <span style="color: #008000;">=</span> listForecastList<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">intLowTemp</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;°|&quot;</span> <span style="color: #008000;">+</span> listForecastList<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">intHighTemp</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;°&quot;</span><span style="color: #008000;">;</span>
            _imgDay1Image<span style="color: #008000;">.</span><span style="color: #0000FF;">Source</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> BitmapImage<span style="color: #008000;">&#40;</span><span style="color: #008000;">new</span> Uri<span style="color: #008000;">&#40;</span>_strImagePath <span style="color: #008000;">+</span> listForecastList<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">strImage</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;.png&quot;</span>, UriKind<span style="color: #008000;">.</span><span style="color: #0000FF;">RelativeOrAbsolute</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            _lblDay2Label<span style="color: #008000;">.</span><span style="color: #0000FF;">Content</span> <span style="color: #008000;">=</span> listForecastList<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">2</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">strDay</span><span style="color: #008000;">;</span>
            _lblDay2MinMaxLabel<span style="color: #008000;">.</span><span style="color: #0000FF;">Content</span> <span style="color: #008000;">=</span> listForecastList<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">2</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">intLowTemp</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;°|&quot;</span> <span style="color: #008000;">+</span> listForecastList<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">2</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">intHighTemp</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;°&quot;</span><span style="color: #008000;">;</span>
            _imgDay2Image<span style="color: #008000;">.</span><span style="color: #0000FF;">Source</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> BitmapImage<span style="color: #008000;">&#40;</span><span style="color: #008000;">new</span> Uri<span style="color: #008000;">&#40;</span>_strImagePath <span style="color: #008000;">+</span> listForecastList<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">2</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">strImage</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;.png&quot;</span>, UriKind<span style="color: #008000;">.</span><span style="color: #0000FF;">RelativeOrAbsolute</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            _lblDay3Label<span style="color: #008000;">.</span><span style="color: #0000FF;">Content</span> <span style="color: #008000;">=</span> listForecastList<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">3</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">strDay</span><span style="color: #008000;">;</span>
            _lblDay3MinMaxLabel<span style="color: #008000;">.</span><span style="color: #0000FF;">Content</span> <span style="color: #008000;">=</span> listForecastList<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">3</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">intLowTemp</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;°|&quot;</span> <span style="color: #008000;">+</span> listForecastList<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">3</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">intHighTemp</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;°&quot;</span><span style="color: #008000;">;</span>
            _imgDay3Image<span style="color: #008000;">.</span><span style="color: #0000FF;">Source</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> BitmapImage<span style="color: #008000;">&#40;</span><span style="color: #008000;">new</span> Uri<span style="color: #008000;">&#40;</span>_strImagePath <span style="color: #008000;">+</span> listForecastList<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">3</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">strImage</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;.png&quot;</span>, UriKind<span style="color: #008000;">.</span><span style="color: #0000FF;">RelativeOrAbsolute</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span></pre></div></div>

<p>Auch hier ben&#246;tigen wir wieder eine Hilfsmethode, die das Datum k&#252;rzt.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> FormateDateString<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> _strDate<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> arrDateSplitted <span style="color: #008000;">=</span> _strDate<span style="color: #008000;">.</span><span style="color: #0000FF;">Split</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">'.'</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            _strDate <span style="color: #008000;">=</span> arrDateSplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;.&quot;</span> <span style="color: #008000;">+</span> arrDateSplitted<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">return</span> _strDate<span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span></pre></div></div>

<p>Wenn Sie nun Ihre Applikation Debuggen ermittelt diese nur f&#252;r die Stadt das Wetter, die sie beim Start der Applikation mit der &#8220;LoadData()&#8221;-Methode &#252;bergeben haben. Um dem Benutzer die M&#246;glichkeit zu bieten das Wetter einer eingegebenen Stadt zu sehen, m&#252;ssen wir das Button Click Event implementieren.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"> <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> _btnCalculateWeather_Click<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, RoutedEventArgs e<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #6666cc; font-weight: bold;">string</span> _strCity <span style="color: #008000;">=</span> _txtCity<span style="color: #008000;">.</span><span style="color: #0000FF;">Text</span><span style="color: #008000;">;</span>           
&nbsp;
            listCurrentList<span style="color: #008000;">.</span><span style="color: #0000FF;">Clear</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            listForecastList<span style="color: #008000;">.</span><span style="color: #0000FF;">Clear</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            _txtCity<span style="color: #008000;">.</span><span style="color: #0000FF;">Text</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;&quot;</span><span style="color: #008000;">;</span>            
&nbsp;
            OData<span style="color: #008000;">.</span><span style="color: #0000FF;">LoadData</span><span style="color: #008000;">&#40;</span>_strCity<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span></pre></div></div>

<p>Nun ist die Applikation fertig und sieht wie folgt aus:</p>
<p><img src="http://www.entwicklerforum.org/wp-content/uploads/2011/10/Fertige_App_Berlin.png" alt="" /></p>
<p>&nbsp;</p>
<p>Meine Projektmappe k&#246;nnen Sie <a href="http://www.entwicklerforum.org/wp-content/uploads/2011/10/WeatherApp.zip">hier</a> herunterladen.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklerforum.org/wetter-app-mit-silverlight-erstellen-uber-google-weather-api-6/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight Demo&#8217;s</title>
		<link>http://www.entwicklerforum.org/silverlight-demos</link>
		<comments>http://www.entwicklerforum.org/silverlight-demos#comments</comments>
		<pubDate>Wed, 22 Jul 2009 13:34:20 +0000</pubDate>
		<dc:creator>Paul Exler</dc:creator>
				<category><![CDATA[.Net / ASP.Net / C#]]></category>
		<category><![CDATA[Silverlight, Flex, Flash]]></category>

		<guid isPermaLink="false">http://www.entwicklerforum.org/?p=640</guid>
		<description><![CDATA[Hier mal ein paar sehr interessante Demo&#8217;s, die mit Silverlight erstellt wurden: Ein kleines &#8220;Windows&#8221; im Browser: http://windows4all.com/ Ein halbfertiges CRM (Beta): http://labs.cas.de/silverlight/CASCRMSL3/ Und hier sieht man den Einsatz vom Deep Zoom Composer von Silverlight: http://memorabilia.hardrock.com/]]></description>
			<content:encoded><![CDATA[<p>Hier mal ein paar sehr interessante Demo&#8217;s, die mit Silverlight erstellt wurden:</p>
<p><br class="spacer_" /></p>
<p>Ein kleines &#8220;Windows&#8221; im Browser:</p>
<p><a href="http://windows4all.com/" target="_blank">http://windows4all.com/</a></p>
<p><span id="more-640"></span><br class="spacer_" /></p>
<p>Ein halbfertiges CRM (Beta):</p>
<p><a href="http://labs.cas.de/silverlight/CASCRMSL3/" target="_blank">http://labs.cas.de/silverlight/CASCRMSL3/</a></p>
<p><br class="spacer_" /></p>
<p>Und hier sieht man den Einsatz vom Deep Zoom Composer von Silverlight:</p>
<p><a href="http://memorabilia.hardrock.com/" target="_blank">http://memorabilia.hardrock.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklerforum.org/silverlight-demos/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight &#8211; DB</title>
		<link>http://www.entwicklerforum.org/silverlight-db</link>
		<comments>http://www.entwicklerforum.org/silverlight-db#comments</comments>
		<pubDate>Tue, 21 Jul 2009 13:19:33 +0000</pubDate>
		<dc:creator>Paul Exler</dc:creator>
				<category><![CDATA[.Net / ASP.Net / C#]]></category>
		<category><![CDATA[Datenbank, SQL]]></category>
		<category><![CDATA[Silverlight, Flex, Flash]]></category>

		<guid isPermaLink="false">http://www.entwicklerforum.org/?p=636</guid>
		<description><![CDATA[Eben entdeckt: http://silverdb.codeplex.com/ Damit lassen sich Daten in einer kleinen Datenbank direkt bei dem jeweiligen Client unter dem Isolation Storage speichern. Nat&#252;rlich mit bequemen Feature&#8217;s wie z.B. lazy loading oder die Komprimierung der Datenbank. Hier die offzielle Projektbeschreibung: &#8220; This project implements a Isolated Storage (IsolatedStorage) based database for Silverlight. The usage of this software [...]]]></description>
			<content:encoded><![CDATA[<p>Eben entdeckt:</p>
<p><a href="http://silverdb.codeplex.com/" target="_blank">http://silverdb.codeplex.com/</a></p>
<p>Damit lassen sich Daten in einer kleinen Datenbank direkt bei dem jeweiligen Client unter dem Isolation Storage speichern. Nat&#252;rlich mit bequemen Feature&#8217;s wie z.B. lazy loading oder die Komprimierung der Datenbank.</p>
<p>Hier die offzielle Projektbeschreibung:</p>
<p><span id="ctl00_ctl00_MasterContent_Content_wikiSourceLabel"><span id="more-636"></span><br />
&#8220;</span></p>
<p>This project implements a Isolated Storage (IsolatedStorage) based database for Silverlight. The usage of this software is very simple. You create a new database by Calling CreateDatabase. You can add tables to the database by calling db.CreateTable&lt;T&gt; where T is the type of entity to be stored in table rows. You can save database by calling Save, and open the database by calling OpenDatabase. This database supports version changes, so you can update your application and still be able to open the database. You can look for basic use of this database by examining test Silverlight application. Encryption and compression have been implemented; just provide a password to use encryption. Compression is based on SharpZipLib &#8211; you will have all the rights specified under that project. See <a class="externalLink" href="http://slsharpziplib.codeplex.com/license">http://slsharpziplib.codeplex.com/license</a> for details. Also lazy loading has been implemented. If you open database with lazy loading flag, tables will be loaded when first accessed. Feel free to look documentation help file under current download for API details. The source code file contains unit test project that you can also examine for usage details.</p>
<p>Here is a list features on the radar:</p>
<p><span id="ctl00_ctl00_MasterContent_Content_wikiSourceLabel"> </span></p>
<ul>
<li>Isolated Storage quota checks, possibly with ability to automatically request more space</li>
</ul>
<p>&#8220;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklerforum.org/silverlight-db/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sorting Algorithms &#8211; wie funktioniert das Ding ?</title>
		<link>http://www.entwicklerforum.org/sorting-algorithms-wie-funktioniert-das-ding</link>
		<comments>http://www.entwicklerforum.org/sorting-algorithms-wie-funktioniert-das-ding#comments</comments>
		<pubDate>Tue, 30 Sep 2008 07:51:06 +0000</pubDate>
		<dc:creator>Michal Sodomka</dc:creator>
				<category><![CDATA[.Net / ASP.Net / C#]]></category>
		<category><![CDATA[Allgemein / Web 2.0]]></category>

		<guid isPermaLink="false">http://www.entwicklerforum.org/?p=406</guid>
		<description><![CDATA[Jeder Entwickler hat schon etwas von Sortierung geh&#246;rt und wei&#223;t dass daf&#252;r auf Algorithmen gibt. Wie w&#228;re es aber wenn man genau erkl&#228;ren soll wie z.B. Quicksort funktioniert ? Auf dieser Seite findet man Antwort&#8230;und zwar in einer Form die wirklich jeder verstehen kann]]></description>
			<content:encoded><![CDATA[<p>Jeder Entwickler hat schon etwas von Sortierung geh&#246;rt und wei&#223;t dass daf&#252;r auf Algorithmen gibt.<br />
 Wie w&#228;re es aber wenn man genau erkl&#228;ren soll wie z.B. Quicksort funktioniert ?</p>
<p>Auf <a title="dieser Seite" href="http://vision.bc.edu/~dmartin/teaching/sorting/anim-html/all.html" target="_blank">dieser Seite</a> findet man Antwort&#8230;und zwar in einer Form die wirklich jeder verstehen kann <img src='http://www.entwicklerforum.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklerforum.org/sorting-algorithms-wie-funktioniert-das-ding/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# Coding Standards &#8211; kleine Erweiterung</title>
		<link>http://www.entwicklerforum.org/c-coding-standards-kleine-erweiterung</link>
		<comments>http://www.entwicklerforum.org/c-coding-standards-kleine-erweiterung#comments</comments>
		<pubDate>Mon, 29 Sep 2008 23:19:59 +0000</pubDate>
		<dc:creator>Michal Sodomka</dc:creator>
				<category><![CDATA[.Net / ASP.Net / C#]]></category>
		<category><![CDATA[Allgemein / Web 2.0]]></category>
		<category><![CDATA[C, C++, Objective-C]]></category>
		<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://www.entwicklerforum.org/?p=399</guid>
		<description><![CDATA[Dieser Beitrag dient als kleine Erweiterung f&#252;r unsere C# Coding Standards 1. Text soll nie hardcodiert sein &#8211; daf&#252;r soll man ResourcenFiles verwenden. 2. ConnectionString nie hardcodieren &#8211; f&#252;r solche F&#228;lle soll man Web.config / App.config verwenden 3. Lange Strings nicht als string sondern mit Hilfe der Klasse StringBuilder erzeugen 4. Leeren String nicht als [...]]]></description>
			<content:encoded><![CDATA[<p>Dieser Beitrag dient als kleine Erweiterung f&#252;r unsere C# Coding Standards</p>
<p><br class="spacer_" /></p>
<p>1. Text soll nie hardcodiert sein &#8211; daf&#252;r soll man <strong>ResourcenFiles</strong> verwenden.</p>
<p><span id="more-399"></span>2. ConnectionString nie hardcodieren &#8211; f&#252;r solche F&#228;lle soll man <strong>Web.config</strong> / <strong>App.config</strong> verwenden</p>
<p>3. Lange Strings nicht als <strong>string </strong>sondern mit Hilfe der Klasse <strong>StringBuilder</strong> erzeugen</p>
<p>4. Leeren String nicht als <strong>string test = &#8221; &#8220;</strong> sondern als <strong>string test = String.Empty</strong> definieren</p>
<p>5. Projekt immer mit <strong>WarningLevel = 4 </strong>builden. (Project -&gt; Properties -&gt; Build -&gt; WarningLevel = 4)</p>
<p>6. Im Release Build alle Warnungen als Fehler betrachten. (Project -&gt; Properties -&gt; Build -&gt; Treat warnings as errors -&gt; all</p>
<p>7. Keine Logik in <strong>AssemlbyInfo.cs </strong>implementieren</p>
<p>8. F&#252;r Code der Generics verwendet soll man nicht zu / von eine System.Object casten, sondern Schl&#252;sselwort <strong>as </strong>verwenden.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklerforum.org/c-coding-standards-kleine-erweiterung/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unterschiede zwischen Actionscript 3 und C#</title>
		<link>http://www.entwicklerforum.org/unterschiede-zwischen-c-und-actionscript-3</link>
		<comments>http://www.entwicklerforum.org/unterschiede-zwischen-c-und-actionscript-3#comments</comments>
		<pubDate>Wed, 10 Sep 2008 16:56:26 +0000</pubDate>
		<dc:creator>m.balzer</dc:creator>
				<category><![CDATA[.Net / ASP.Net / C#]]></category>
		<category><![CDATA[Allgemein / Web 2.0]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[C, C++, Objective-C]]></category>
		<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://www.entwicklerforum.org/?p=297</guid>
		<description><![CDATA[Hier f&#252;hre ich die Unterschiede zwischen  Actionscript 3 und C# auf. Namespace bzw. Package: in Actionscript: package SamplePackage &#123; &#125; in C#: namespace SampleNamespace &#123; &#125; Klassen: in Actionscript: Nur die Klasse: identifer identifier Name {   } public class SampleClass &#123; &#125; Die Klasse im Code: package SamplePackage &#123; public class SampleClass &#123; &#125; [...]]]></description>
			<content:encoded><![CDATA[<p>Hier f&#252;hre ich die Unterschiede zwischen  Actionscript 3 und C# auf.</p>
<p><span id="more-297"></span></p>
<p><span style="text-decoration: underline;"><strong>Namespace bzw. Package:</strong></span></p>
<p><span style="text-decoration: underline;">in Actionscript:</span></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package SamplePackage
<span style="color: #66cc66;">&#123;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p><span style="text-decoration: underline;">in C#:</span></p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">namespace</span> SampleNamespace
<span style="color: #008000;">&#123;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p><span style="text-decoration: underline;"><strong>Klassen:</strong></span></p>
<p><span style="text-decoration: underline;">in Actionscript:</span></p>
<p>Nur die Klasse:</p>
<p><em>identifer identifier Name {   }<br />
 </em></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SampleClass
<span style="color: #66cc66;">&#123;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Die Klasse im Code:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package SamplePackage
<span style="color: #66cc66;">&#123;</span>
   <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SampleClass
   <span style="color: #66cc66;">&#123;</span>
   <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p><span style="text-decoration: underline;">in C#:</span></p>
<p>Nur die Klasse:</p>
<p><em>event-modifier class declaration Name {   }</em></p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> SampleClass
<span style="color: #008000;">&#123;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>Die Klasse im Code:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">namespace</span> SampleNamespace
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> SampleClass
    <span style="color: #008000;">&#123;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p><span style="text-decoration: underline;"><strong>Variablen:</strong></span></p>
<p><span style="text-decoration: underline;">in Actionscript:</span></p>
<p>Nur die Variablen:</p>
<p><em>identifier Parameter-Atribut Name: Operator;<br />
 </em></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> intSample:<span style="color: #0066CC;">int</span>;
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> intSample1:<span style="color: #0066CC;">int</span>;</pre></div></div>

<p>Die Variablen im Code:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package SamplePackage
<span style="color: #66cc66;">&#123;</span>
   <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SampleClass
   <span style="color: #66cc66;">&#123;</span>
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> intSample:<span style="color: #0066CC;">int</span>;
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> intSample1:<span style="color: #0066CC;">int</span>;
   <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p><span style="text-decoration: underline;">in C#:</span></p>
<p>Nur die Variablen:</p>
<p><em>property-modifier </em><em>integral-type Name;</em><em> </em></p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">int</span> intSample<span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">int</span> intSample1<span style="color: #008000;">;</span></pre></div></div>

<p>Die Variablen im Code:</p>
<p><br class="spacer_" /></p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">namespace</span> SampleNamespace
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> SampleClass
    <span style="color: #008000;">&#123;</span>
         <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">int</span> intSample<span style="color: #008000;">;</span>
         <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">int</span> intSample1<span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p><span style="text-decoration: underline;"><strong>Funktionen:</strong></span></p>
<p><span style="text-decoration: underline;">in Actionscript:</span></p>
<p>Nur die Funktion:</p>
<p><em>identifier identifier Name( Parameter) : Operator identifier{}</em></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> SampleFunction<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Die Funktion im Code:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package SamplePackage
<span style="color: #66cc66;">&#123;</span>
   <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SampleClass
   <span style="color: #66cc66;">&#123;</span>
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> intSample:<span style="color: #0066CC;">int</span>;
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> intSample1:<span style="color: #0066CC;">int</span>;
&nbsp;
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> SampleFunction<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
        <span style="color: #66cc66;">&#123;</span>
        <span style="color: #66cc66;">&#125;</span>
   <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p><span style="text-decoration: underline;">in C#:</span></p>
<p>Nur die Funktion:</p>
<p><em>method-modifier </em><em>constant-modifier Name (Parameter){}<br />
 </em></p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> SampleVoid<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>Die Funktion im Code:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">namespace</span> SampleNamespace
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> SampleClass
    <span style="color: #008000;">&#123;</span>
         <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">int</span> intSample<span style="color: #008000;">;</span>
         <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">int</span> intSample1<span style="color: #008000;">;</span> 
&nbsp;
         <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> SampleVoid<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
         <span style="color: #008000;">&#123;</span>
         <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p><span style="text-decoration: underline;"><strong>Befehle</strong></span></p>
<p><span style="text-decoration: underline;">in Actionscript:</span></p>
<p>Nur der Befehl:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"> Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Hallo Welt&quot;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Der Befehl im Code:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package SamplePackage
<span style="color: #66cc66;">&#123;</span>
   <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SampleClass
   <span style="color: #66cc66;">&#123;</span>
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> intSample:<span style="color: #0066CC;">int</span>;
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> intSample1:<span style="color: #0066CC;">int</span>;
&nbsp;
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> SampleFunction<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
        <span style="color: #66cc66;">&#123;</span>
             Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Hallo Welt&quot;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
   <span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p><span style="text-decoration: underline;">in C#:</span></p>
<p>Nur der Befehl:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">MessageBox<span style="color: #008000;">.</span><span style="color: #0000FF;">Show</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Hallo Welt&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>Der Befehl im Code:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">namespace</span> SampleNamespace
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> SampleClass
    <span style="color: #008000;">&#123;</span>
         <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">int</span> intSample<span style="color: #008000;">;</span>
         <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">int</span> intSample1<span style="color: #008000;">;</span> 
&nbsp;
         <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> SampleVoid<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
         <span style="color: #008000;">&#123;</span>
              MessageBox<span style="color: #008000;">.</span><span style="color: #0000FF;">Show</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Hallo Welt&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
         <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>Dieser Artikel wird st&#228;ndig erweiter. Immer mal wieder vorbeischauen lohnt sich. <img src='http://www.entwicklerforum.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklerforum.org/unterschiede-zwischen-c-und-actionscript-3/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# Coding Standards 1/4</title>
		<link>http://www.entwicklerforum.org/c-coding-standards-14</link>
		<comments>http://www.entwicklerforum.org/c-coding-standards-14#comments</comments>
		<pubDate>Mon, 18 Aug 2008 17:07:01 +0000</pubDate>
		<dc:creator>m.balzer</dc:creator>
				<category><![CDATA[.Net / ASP.Net / C#]]></category>
		<category><![CDATA[C, C++, Objective-C]]></category>

		<guid isPermaLink="false">http://www.entwicklerforum.org/?p=201</guid>
		<description><![CDATA[Dies sind die C# Coding Standards der Equitania Software GmbH. Allgemeine Form: hier wird beschrieben wie sie Ihrem Code eine 90-60-90 Figur verpassen. - Bei M&#246;glichkeit vermeiden mehr als eine Klasse pro Namespace zu verwenden namespace Geldverleih &#123; class Class1 &#123; &#160; &#125; &#160; class SomeClass1 &#123; &#160; &#125; &#160; &#125; - Nicht zu viele [...]]]></description>
			<content:encoded><![CDATA[<p>Dies sind die  C# Coding Standards der Equitania Software GmbH.</p>
<p>Allgemeine Form:</p>
<p>hier wird beschrieben wie sie Ihrem Code eine 90-60-90 Figur verpassen.</p>
<p><span id="more-201"></span>- Bei M&#246;glichkeit vermeiden mehr als eine Klasse<br />
pro Namespace zu verwenden</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">namespace</span> Geldverleih
<span style="color: #008000;">&#123;</span>
    <span style="color: #6666cc; font-weight: bold;">class</span> Class1
    <span style="color: #008000;">&#123;</span>
&nbsp;
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #6666cc; font-weight: bold;">class</span> SomeClass1
    <span style="color: #008000;">&#123;</span>
&nbsp;
    <span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>- Nicht zu viele Zeilen (am besten weniger als 500)<br />
- Keine zu langen Methoden (weniger als 25 Zeilen)<br />
- Nicht zu viele Parameter in einer Methode (weniger als 5)<br />
- Keine &#252;berfl&#252;ssigen Kommentare (Code sollte selbsterkl&#228;rend sein)</p>
<p>- Zeilen &#252;bersichtlich gestalten (vor jeder {  } einen Zeilenumbruch)</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"> <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> button1_Click<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, EventArgs e<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>intMyInt <span style="color: #008000;">&amp;</span>gt<span style="color: #008000;">;=</span> <span style="color: #FF0000;">10</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                intMyInt <span style="color: #008000;">-=</span> <span style="color: #008000;">&#40;</span><span style="color: #FF0000;">5</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.entwicklerforum.org/c-coding-standards-14/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# Coding Standards 2/4</title>
		<link>http://www.entwicklerforum.org/c-coding-standards-24</link>
		<comments>http://www.entwicklerforum.org/c-coding-standards-24#comments</comments>
		<pubDate>Mon, 18 Aug 2008 17:04:53 +0000</pubDate>
		<dc:creator>a.laaser</dc:creator>
				<category><![CDATA[.Net / ASP.Net / C#]]></category>
		<category><![CDATA[C, C++, Objective-C]]></category>
		<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://www.entwicklerforum.org/?p=198</guid>
		<description><![CDATA[Schreibweisen In diesem Beitrag beschreibe ich, wie Code, formatiert in Camel- und PascalCase, auszusehen hat. - CamelCase: Als &#8220;CamelCase&#8221; bezeichnet man eine Art von Konvention. Beispiele f&#252;r CamelCase sind &#8220;iPod, MacBook, CloneCd, GameCube&#8221;. Wie man unschwer erkennen kann, ist die Benutzung eines Gro&#223;buchstabens inmitten des Wortes gemeint. (MacBook) CamelCase wird bei lokalen variablen und Methodenparametern [...]]]></description>
			<content:encoded><![CDATA[<p>Schreibweisen</p>
<p>In diesem Beitrag beschreibe ich, wie Code, formatiert in Camel- und PascalCase, auszusehen hat.</p>
<p>- CamelCase:</p>
<p><span id="more-198"></span>Als &#8220;CamelCase&#8221; bezeichnet man eine Art von Konvention.<br />
Beispiele f&#252;r CamelCase sind &#8220;iPod, MacBook, CloneCd, GameCube&#8221;.<br />
Wie man unschwer erkennen kann, ist die Benutzung eines Gro&#223;buchstabens inmitten des Wortes gemeint.<br />
(Mac<span style="text-decoration: underline;"><span style="color: #ff0000;">B</span></span>ook)<br />
CamelCase wird bei lokalen variablen und Methodenparametern benutzt.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">int</span> number<span style="color: #008000;">;</span>
<span style="color: #6666cc; font-weight: bold;">void</span> MyMethod<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> someNumber<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span><span style="color: #008000;">&#125;</span></pre></div></div>

<p>- PascalCase:</p>
<p>PascalCase ist &#228;hnlich wie CamelCase.<br />
W&#228;hrend meistens von &#8220;lowerCamelCase&#8221; die Rede ist, bei der der erste Buchstabe klein geschrieben wird (<span style="text-decoration: underline;"><span style="color: #ff0000;">i</span></span>Pod),<br />
ist PascalCase lediglich eine andere Bezeichnung f&#252;r &#8220;UpperCamelCase&#8221;, in welcher der erste Buchstabe gro&#223; geschrieben wird (<span style="text-decoration: underline;"><span style="color: #ff0000;">M</span></span>acBook)<br />
PascalCase wird bei Typen und Methodennamen sowie bei konstanten Variablen verwendet.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> SomeClass
&nbsp;
<span style="color: #008000;">&#123;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">int</span> DefaultSize <span style="color: #008000;">=</span> <span style="color: #FF0000;">100</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">public</span> SomeMethod<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
&nbsp;
<span style="color: #008000;">&#123;</span><span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #008000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.entwicklerforum.org/c-coding-standards-24/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# Coding Standards 3/4</title>
		<link>http://www.entwicklerforum.org/c-coding-standards-34</link>
		<comments>http://www.entwicklerforum.org/c-coding-standards-34#comments</comments>
		<pubDate>Mon, 18 Aug 2008 16:53:51 +0000</pubDate>
		<dc:creator>m.balzer</dc:creator>
				<category><![CDATA[.Net / ASP.Net / C#]]></category>
		<category><![CDATA[C, C++, Objective-C]]></category>

		<guid isPermaLink="false">http://www.entwicklerforum.org/?p=189</guid>
		<description><![CDATA[Benennung und Strukturierung: &#220;bersichtlichkeit steht ganz oben! Nach diesem Motto gestalten wir unser Formular, damit es auch f&#252;r andere Entwickler leicht zu verstehen ist. Ungarische Notation: Die ungarische Notation bedeutet die Verwendung von aussagekr&#228;ftigen Bezeichnern (z.B. int intZutatenMenge statt int intZM). Es tr&#228;gt dazu bei den Quellcode intuitiver zu gestalten, damit f&#228;llt es anderen Prorammierern [...]]]></description>
			<content:encoded><![CDATA[<p>Benennung und Strukturierung:</p>
<p>&#220;bersichtlichkeit steht ganz oben!<br />
 Nach diesem Motto gestalten wir unser Formular, damit es auch f&#252;r andere Entwickler leicht zu verstehen ist.</p>
<p>Ungarische Notation:</p>
<p>Die ungarische Notation bedeutet die Verwendung von aussagekr&#228;ftigen Bezeichnern<br />
 (z.B.  int intZutatenMenge  statt int intZM).<br />
 Es tr&#228;gt dazu bei den Quellcode intuitiver zu gestalten, damit f&#228;llt es anderen Prorammierern leichter ihn zu lesen.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">int</span> nMyInt<span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">int</span> nSomeInt<span style="color: #008000;">;</span></pre></div></div>

<p>-using Zeilen sinnvoll strukturieren, damit ein<br />
 &#252;bersichtliches Bild entsteht.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Collections.Generic</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Drawing</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Linq</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Text</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Windows.Forms</span><span style="color: #008000;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.entwicklerforum.org/c-coding-standards-34/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C#  Coding Standards 4/4</title>
		<link>http://www.entwicklerforum.org/praefix-tabelle-44</link>
		<comments>http://www.entwicklerforum.org/praefix-tabelle-44#comments</comments>
		<pubDate>Mon, 18 Aug 2008 14:49:35 +0000</pubDate>
		<dc:creator>a.laaser</dc:creator>
				<category><![CDATA[.Net / ASP.Net / C#]]></category>

		<guid isPermaLink="false">http://www.entwicklerforum.org/?p=181</guid>
		<description><![CDATA[Pr&#228;fix Dieser Beitrag erkl&#228;rt, wie es Vorsilben schaffen, anderen Programmieren das Lesen und Verstehen Ihres Codes leichter zu gestalten. Sie dienen z.B. dazu, Variablen zu erkennen, ohne den ganzen Code nach der deklarierung absuchen zu m&#252;ssen, um herauszufinden, um welchen Typ es sich dreht. int someNumber; Pr&#228;fix &#8211; Tabelle Prefix Control/Datatype Allgemein H handle rg [...]]]></description>
			<content:encoded><![CDATA[<p>Pr&#228;fix</p>
<p>Dieser Beitrag erkl&#228;rt, wie es Vorsilben schaffen, anderen Programmieren das Lesen und Verstehen Ihres Codes leichter zu gestalten.</p>
<p>Sie dienen z.B. dazu, Variablen zu erkennen, ohne den ganzen Code nach der deklarierung absuchen zu m&#252;ssen, um herauszufinden, um welchen Typ es sich dreht.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"> <span style="color: #6666cc; font-weight: bold;">int</span> someNumber<span style="color: #008000;">;</span></pre></div></div>

<p><span id="more-181"></span></p>
<p>Pr&#228;fix &#8211; Tabelle</p>
<table style="width: 50%;" border="5">
<tbody>
<tr>
<td>Prefix</td>
<td>Control/Datatype</td>
</tr>
<tr>
<td><strong>Allgemein</strong></td>
</tr>
<tr>
<td>H</td>
<td>handle</td>
</tr>
<tr>
<td>rg</td>
<td>range</td>
</tr>
<tr>
<td>mp</td>
<td>map</td>
</tr>
<tr>
<td>dn</td>
<td>domain</td>
</tr>
<tr>
<td>i</td>
<td>index</td>
</tr>
<tr>
<td>b</td>
<td>base</td>
</tr>
<tr>
<td>e</td>
<td>element</td>
</tr>
<tr>
<td>c</td>
<td>count</td>
</tr>
<tr>
<td>d</td>
<td>difference</td>
</tr>
<tr>
<td>gr</td>
<td>group</td>
</tr>
<tr>
<td>f</td>
<td>flag</td>
</tr>
<tr>
<td>sh</td>
<td>shift amount</td>
</tr>
<tr>
<td>u</td>
<td>union</td>
</tr>
<tr>
<td>a</td>
<td>allcoation</td>
</tr>
<tr>
<td><strong>UI</strong></td>
</tr>
<tr>
<td>lbl</td>
<td>Label</td>
</tr>
<tr>
<td>btn</td>
<td>Button</td>
</tr>
<tr>
<td>img</td>
<td>Image</td>
</tr>
<tr>
<td>grd</td>
<td>GridView</td>
</tr>
<tr>
<td>ddl</td>
<td>DropDownList</td>
</tr>
<tr>
<td>txt</td>
<td>TextBox</td>
</tr>
<tr>
<td>cbx</td>
<td>CheckBox</td>
</tr>
<tr>
<td>rdb</td>
<td>RadioButton</td>
</tr>
<tr>
<td>cbl</td>
<td>CheckBoxList</td>
</tr>
<tr>
<td>dtp</td>
<td>DateTimePicker</td>
</tr>
<tr>
<td>lnk</td>
<td>LinkLabel</td>
</tr>
<tr>
<td>lst</td>
<td>ListBox</td>
</tr>
<tr>
<td>lsv</td>
<td>ListView</td>
</tr>
<tr>
<td>mtb</td>
<td>MaskedTextBox</td>
</tr>
<tr>
<td>mtc</td>
<td>MonthCalender</td>
</tr>
<tr>
<td>not</td>
<td>NotifyIcon</td>
</tr>
<tr>
<td>nud</td>
<td>NummericUpDown</td>
</tr>
<tr>
<td>pct</td>
<td>PictureBox</td>
</tr>
<tr>
<td>prg</td>
<td>ProgressBar</td>
</tr>
<tr>
<td>tot</td>
<td>Tooltip</td>
</tr>
<tr>
<td>trv</td>
<td>TreeView</td>
</tr>
<tr>
<td>grp</td>
<td>GroupBox</td>
</tr>
<tr>
<td>wrk</td>
<td>BackgroundWorker</td>
</tr>
<tr>
<td>dlg</td>
<td>Dialogs</td>
</tr>
<tr>
<td><strong>Variablen</strong></td>
</tr>
<tr>
<td>n</td>
<td>integer</td>
</tr>
<tr>
<td>st</td>
<td>string</td>
</tr>
<tr>
<td>b</td>
<td>Boolean</td>
</tr>
<tr>
<td>sz</td>
<td>string zero terminated</td>
</tr>
<tr>
<td>p</td>
<td>pointer</td>
</tr>
<tr>
<td>a</td>
<td>Array</td>
</tr>
<tr>
<td>ch</td>
<td>char</td>
</tr>
<tr>
<td>dw</td>
<td>Double Word, 32 Bit</td>
</tr>
<tr>
<td>w</td>
<td>Word, 16 Bit</td>
</tr>
<tr>
<td>b</td>
<td>byte</td>
</tr>
<tr>
<td>l</td>
<td>long</td>
</tr>
<tr>
<td>d</td>
<td>double</td>
</tr>
<tr>
<td>v</td>
<td>void</td>
</tr>
<tr>
<td>f</td>
<td>flag</td>
</tr>
<tr>
<td>fn</td>
<td>function</td>
</tr>
<tr>
<td>fl</td>
<td>file</td>
</tr>
<tr>
<td>uw</td>
<td>unsigned word</td>
</tr>
<tr>
<td>ul</td>
<td>unsigned long</td>
</tr>
<tr>
<td>r</td>
<td>real</td>
</tr>
<tr>
<td>env</td>
<td>environment</td>
</tr>
<tr>
<td>sb</td>
<td>segment base</td>
</tr>
<tr>
<td><strong>Sichtbarkeit</strong></td>
</tr>
<tr>
<td>m_</td>
<td>Membervariable</td>
</tr>
<tr>
<td>p_</td>
<td>Methodenparameter</td>
</tr>
<tr>
<td>i_</td>
<td>Interfaceparameter</td>
</tr>
<tr>
<td>s_</td>
<td>statische Variable</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.entwicklerforum.org/praefix-tabelle-44/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

