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.
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.
private void inputPanel1_EnabledChanged(object sender, System.EventArgs e)
this.ClientRectangle.Height - this.inputPanel1.Bounds.Height;
Serialization support requires Compact Formatter.
I hope you enjoy using Weather Info. Updated versions can be found here.