VB.NET tutorial example

Jan 4, 2010 at 7:26 AM

Hi!

When I try to build this example, I have got an error:

Module Module1

    Sub Main()
        Dim wD As Animaonline.WeatherAPI.WeatherData = New Animaonline.WeatherAPI.WeatherData(Animaonline.WeatherAPI.LanguageCode.en_US, "Phoenix, AZ")
        Console.WriteLine("Condition:{0} Temperature:{1}°F {2}°C", wD.condition, wD.temp_f, wD.temp_c)
    End Sub

End Module

Type 'Animaonline.WeatherAPI.WeatherData' is not defined, and suggest to change it to Animaonline.Weather.GoogleWeatherAPI, Animaonline.Weather.Interfaces.IGoogleWeatherData or Animaonline.Weather.WeatherData.GoogleWeatherData.

How can I resolve this?

Thanks, and sorry for my English! I'm a Hungarian... :)

Coordinator
Jan 4, 2010 at 7:30 AM

Hi! The example you are trying to compile is written in an earlier version of awAPI (2.0.3.0) BETA

We updated awAPI to 2.5.0.0

Unfortunately I didn't have time to update the documentation.

You can check out my blog @ (http://animaonline.blogspot.com/) for some examples of awAPI 2.5.0.0 usage.

Thank you :)

And don't hesitate to ask, if you have any other questions :)

/Roman

Jan 4, 2010 at 8:21 AM

Thanks!

It work wery well!

One more question...

Is there any way to download data in Hungarian language?

Like this: http://www.google.com/ig/api?hl=hu&weather=pecs

 

Coordinator
Jan 4, 2010 at 9:22 AM

Take a look at LanguageCode.cs 

Try and add hu or hu_HU


Cheers!

Jan 4, 2010 at 12:26 PM

Unfortunately not works...

hu_HU is selectable now, but the received data is still in English.

Another thing... is this .dll compatible with Compact Framework 3.5?

I want to run it on PocketPC.

Coordinator
Jan 4, 2010 at 12:31 PM

You will have to take a closer look at the code which handles language code parsing...

The previous version of the api was compatible with Compact Framework , I'm not sure about 2.5.0.0 , because the core was rewritten to utilize LINQ

Why don't you try to compile the api as a Windows Mobile Class Library?

Keep me updated!


Cheers! :)

 

Jan 5, 2010 at 12:06 PM

Hi!

Now, the weather data is downloaded in Hungarian... :)

Function.cs

namespace Animaonline.Weather
{
    public static class Functions
    {
        public static Uri GoogleWeatherFeedUrl(CultureInfo cultureInfo)
        {
            switch (cultureInfo.TwoLetterISOLanguageName.ToUpper())
            {
                .
                .
                .
                case "RU":
                    return GoogleWeatherFeedUrl(LanguageCode.ru_RU);
                case "HU":
                    return GoogleWeatherFeedUrl(LanguageCode.hu_HU);
                default:
                    return GoogleWeatherFeedUrl((LanguageCode)(-1));
            }
        }

        public static Uri GoogleWeatherFeedUrl(LanguageCode languageCode)
        {
            switch (languageCode)
            {
                .
                .
                .
                case LanguageCode.ru_RU:
                    return new Uri(@"http://www.google.ru/ig/api?weather=");
                case LanguageCode.hu_HU:
                    return new Uri(@"http://www.google.hu/ig/api?weather=");
                default:
                    return new Uri(@"http://www.google.com/ig/api?weather=");
            }
        }
    }
}


LanguageCode.cs

namespace Animaonline.Globals
{
    #region Enums
    /// <summary>
    /// Language Codes
    /// </summary>
    public enum LanguageCode
    {
        /// <summary>
        /// English US
        /// </summary>
        en_US,
        /// <summary>
        /// Hungarian HU
        /// </summary>
        hu_HU,
        .
        .
        .
    }
    #endregion
}

 

Coordinator
Jan 5, 2010 at 12:12 PM

Alright!! :D

Congrats :)

Jan 6, 2010 at 8:38 AM

Unfortunately the v2.5.0.0 not works on PPC...

I used the previous version, I rewrite it to support the Hungarian language. Its works, but Unicode characters are not supported.

I try to add a System.Text.Encoding.Unicode parameter to the StreamReader, but its generates an XML Reader error.

Data at root level is invalid. Line1, Position 1

I try the UTF8 encoding, but still no Unicode characters in data.

 

Jan 8, 2010 at 5:27 PM

Please forget my last reply! It use UTF7 Encoding.

Coordinator
Jan 8, 2010 at 6:24 PM

What error message do you get when you try to compile 2.5.0.0 for PPC platform?

I will update the encoding to UTF7 in all later versions.

Thank you

Jan 10, 2010 at 1:35 PM

The fist error is in the Network.cs

WebClient is not a member of System.Net

Its OK because Windows Mobile uses the HttpWebRequest and HttpWebRespons.

simply delete those rows what WindowsMobileDownloader does not use?

Coordinator
Jan 10, 2010 at 1:39 PM

Alright! I know that... You have to use WindowsMobileDownloader on PPC.