Click here to Skip to main content
13,095,445 members (61,077 online)
Click here to Skip to main content
Add your own
alternative version


24 bookmarked
Posted 27 May 2004

Weather Info

, 27 May 2004
Rate this:
Please Sign up or sign in to vote.
Weather Info uses Web Services on the .NET Compact Framework to display weather information on the Pocket PC.

Sample Image - weatherinfo.gif


Weather Info came about because another weather program I had been using time bombed and the developer had disappeared. I sought out to learn about using Web Services on the .NET Compact Framework and ended up coming up with what I think is a very useful application for my first.


This project contains a series of classes to implement Web Service calls and the caching of data for offline use. WeatherInfoMain.cs contains all of the main code to implement the user interface. WeatherItem.cs contains the information for storing and serializing a web service response. WeatherCache.cs provides the mechanism for caching and retrieving WeatherItems, and Registry.cs contains the code for manipulating the Pocket PC registry.

Web Service Setup

Weather Info uses the weather data provided by EJSE. (Sorry to the non-US users, but this service only supports the United States.) I was actually pleasantly surprised at how simple it was to set up the web service request and to retrieve data from the service. One note: proxy configurations on the Pocket PC are problematic at best, so the application does not support the use of a proxy.

Pocket PC Registry

The application uses PInvoke to call the native Pocket PC registry handlers. I used the registry to store the ZIP code that the web service uses to retrieve the weather info.

Scrolling Forms

The other big challenge I faced in the application was developing a scrolling mechanism for when the user displayed the soft input panel and for the extended forecast. When the soft input panel is displayed, the viewable area shrinks by whatever the size of the selected input method is. To handle this, I developed all of the data as a series of panels and then dropped the panels into the main tab control. The scroll bars are displayed as necessary to allow the user to view the entire contents of the panel.

/// <summary>
/// Handles setting scroll bars and viewable areas
/// when the soft input panel is enabled or disabled
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void inputPanel1_EnabledChanged(object sender, System.EventArgs e)
        //subtract SIP height from tab control height
          this.ClientRectangle.Height - this.inputPanel1.Bounds.Height;
    int iCurrent=this.panelCurrent.Height-this.tabCurrent.Height;
    int iExtended=this.panelExtended.Height-this.tabExtended.Height;
    int iAbout=this.panelAbout.Height-this.tabAbout.Height;

Required Libraries

Serialization support requires Compact Formatter.


I hope you enjoy using Weather Info. Updated versions can be found here.


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


About the Author

Shane Church
Software Developer (Senior) Aquent Technologies
United States United States
Shane Church is Technical Lead at EffectiveUI, where he designs and develops key mobile and Web applications for major client engagements such as Boeing and Cartegraph. Drawing upon his more than ten years of experience developing in the Microsoft .NET Framework with a focus on ASP.NET and Microsoft mobile technologies, Shane contributes to and guides a core development group to execute new mobile Web and native applications.

Prior to joining EffectiveUI, Shane was a senior software engineer at CNSI. In this role, he contributed to public-facing portals for the Mine Safety and Health Administration and created an original online tool for mine rescue teams to better respond to mine emergencies. Throughout his career in senior software engineer and systems architect roles, Shane has developed important mobile and Web projects for clients, including the Department of Energy’s Rocky Flats Environmental Technology Site, Visa and TimeCentre. Shane earned his B.S. in Computer Science from the University of Colorado at Boulder.

You may also be interested in...

Comments and Discussions

GeneralMy vote of 2 Pin
FlavioAR21-Nov-12 23:47
memberFlavioAR21-Nov-12 23:47 
QuestionHow to take zip code??? Pin
Member 608740330-Apr-09 3:39
memberMember 608740330-Apr-09 3:39 
QuestionHow to compile weather info. Pin
Member 608740327-Apr-09 3:32
memberMember 608740327-Apr-09 3:32 
AnswerRe: How to compile weather info. Pin
CUShane27-Apr-09 4:45
memberCUShane27-Apr-09 4:45 
The Compact Formatter is downloadable as a binary from the link above. This article is almost 5 years old now and is based on the .NET Compact Framework 1.0. The .NET Compact Framework 3.5 is the current version and contains a number of serialization formatters that the 1.0 version did not have. At this point, I would retool this code to use the built in serialization as opposed to the Compact Formatter.
GeneralWeb Service Pin
scott_d17-Jun-05 9:33
memberscott_d17-Jun-05 9:33 
GeneralRe: Web Service Pin
CUShane17-Jun-05 13:38
memberCUShane17-Jun-05 13:38 
GeneralRe: Web Service Pin
samsacheti6-Mar-07 0:57
membersamsacheti6-Mar-07 0:57 
GeneralRe: Web Service Pin
CUShane6-Mar-07 2:28
memberCUShane6-Mar-07 2:28 
GeneralRe: Web Service Pin
samsacheti6-Mar-07 6:01
membersamsacheti6-Mar-07 6:01 
GeneralRe: Web Service Pin
CUShane6-Mar-07 7:04
memberCUShane6-Mar-07 7:04 
GeneralBuild Error! Pin
jcynion24-Jun-04 20:31
memberjcynion24-Jun-04 20:31 
GeneralRe: Build Error! Pin
CUShane28-Jun-04 3:13
memberCUShane28-Jun-04 3:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170813.1 | Last Updated 28 May 2004
Article Copyright 2004 by Shane Church
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid