Sounds
If your gadget needs to play system sounds or sound files, use the
System.Sound object.
The beep() method generates a simple beep tone on the system's speakers, while the playSound() method plays a specified sound file:
System.Sound.beep();
System.Sound.playSound(
"\\windows\\media\\Windows Critical Stop.wav");
Time and Time Zones
You can obtain information about the different time zones using the following objects:
- System.Time
- System.Time.TimeZone
System.Time
The
System.Time object enables you to obtain time information for the current system. It exposes a
System.Time.timezones collection of
System.Time.TimeZone objects.
Here's how you can obtain the collection of System.Time.TimeZone objects:
var timeZones = System.Time.timeZones;
The
System.Time object has only one method,
getLocalTime(), which returns the local time based on the specified time zone. It also has only one property,
currentTimeZone, which returns the current time zone as a
System.Time.TimeZone object.
The following example shows you how you can display the current time in the current time zone:
var result = document.getElementById("result");
var timeZone = System.Time.currentTimeZone;
result.innerHTML = "Local Time: " +
System.Time.getLocalTime(timeZone);
 | |
Figure 4. Time Zones: Retrieving all the details of the various time zones available. |
System.Time.TimeZone
The System.Time.TimeZone object contains detailed information about a specific time zone. The following example shows you how to retrieve all the details of the various time zones available (see Figure 4 for the output):
var result = document.getElementById("result");
var timeZones = System.Time.timeZones;
for (var i=0; i<timeZones.count; i++) {
var oTimeZone = timeZones.item(i);
result.innerHTML +=
"Name: " + oTimeZone.name + "<br/>" +
"Bias: " + oTimeZone.bias + "<br/>" +
"Display Name: " + oTimeZone.displayName + "<br/>" +
"DST Bias: " + oTimeZone.DSTBias + "<br/>" +
"DST Date: " + oTimeZone.DSTDate + "<br/>" +
"Standard Bias: " + oTimeZone.standardBias + "<br/>" +
"Standard Date: " + oTimeZone.standardDate + "<br/>" +
"Standard Display Name: " +
oTimeZone.standardDisplayName + "<br/>";
}
Vista's Potential
Now that you've examined the various objects exposed by Windows Sidebar, your gadget should be capable of harnessing all the additional functionalities available in Windows Vista.