I was tasked with building a little plug-in for our SharePoint portal. This plug-in was supposed to display the local time at our various offices and also basic weather information.
My choice was Silverlight, of course. This is how I did it.
Server
Here, I am actually doing 3 different HttpRequests to 3 different web sites to pull:
- Current Local Time
- Current Temperature
- Current weather condition
- Sunrise and Sunset
Model
Client
On the client I am using MVVM as my architecture. With that I am to use data-binding for the entire UI. The “Sun”, “Sun cloudy”, “Moon rain”, objects are all different user controls. On the main view, I am binding a simple string built out of “Weather condition” + “AM or PM”. Then, I am using a simple IValueConverter to return the correct user control for the current time of the day and the current weather condition.
SharePoint
Now, in SharePoint, I am not showing all offices at once. I am simple using a Page Viewer Web Part along
with parameters for LocationID, WeatherID, and OfficeName to display the correct plug-in.
--tolga