Language

SideShowGadget.ShowNotification Method (Int32, String, String, Icon, TimeSpan)

Sends a notification from the gadget to all of its connected Windows SideShow-compatible devices.

Namespace: Microsoft.SideShow
Assembly: Microsoft.SideShow (in microsoft.sideshow.dll)

Usage

Syntax

'Declaration
Public Sub ShowNotification ( _
    notificationId As Integer, _
    caption As String, _
    message As String, _
    image As Icon, _
    duration As TimeSpan _
)
public void ShowNotification (
    int notificationId,
    string caption,
    string message,
    Icon image,
    TimeSpan duration
)
public:
void ShowNotification (
    int notificationId, 
    String^ caption, 
    String^ message, 
    Icon^ image, 
    TimeSpan duration
)
public void ShowNotification (
    int notificationId, 
    String caption, 
    String message, 
    Icon image, 
    TimeSpan duration
)
public function ShowNotification (
    notificationId : int, 
    caption : String, 
    message : String, 
    image : Icon, 
    duration : TimeSpan
)

Parameters

  • notificationId
    A Int32 that identifies this notification.
  • caption
    A String that represents this notification's caption.
  • message
    A String that represents this notification's message body.
  • image
    A Icon that represents this notification's icon.
  • duration
    A TimeSpan that indicates how long the device should show the notification before automatically revoking it.

Example

The following example code shows how to send a notification that is cancelled after a specific duration of time.

private static void SampleShowNotification3()
{
    // Set the gadget's GUID.
    Guid gadgetId = new Guid("{0530B726-F6D5-4a66-900E-3C7673316F3B}");

    // Add the gadget's registry subkey and values.
    GadgetRegistration.Register(
        false,                           // Register gadget for current user only
        gadgetId,                        // Guid for the registry subkey
        ScfSideShowGadget.ScfEndpointId, // Endpoints registry value
        "Example SideShow gadget",       // FriendlyName registry value
        null,                            // StartCommand registry value
        null,                            // Icon registry value, this gadget will use the generic gadget icon.
        false,                           // OnlineOnly registry value
        GadgetCachePolicies.KeepNewest,  // CachePolicy registry value
        null);

    // Construct a Simple Content Format SideShow gadget for the gadget's Guid.
    using (ScfSideShowGadget gadget = new ScfSideShowGadget(gadgetId))
    {
        // Display the notification.
        gadget.ShowNotification(100, "New Message", "There is a new message in your inbox.", null, TimeSpan.FromSeconds(5));
        Thread.Sleep(10000);
    }
    // This notification will be cancelled after it is displayed for a duration of 5 seconds.
}

Remarks

A notification will be shown for at least 5 seconds, even if duration specifies a time span of less than 5 seconds.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows Vista Home Premium, Windows Vista Business, Windows Vista Enterprise, Windows Vista Ultimate

Target Platforms

Windows Vista Home Premium, Windows Vista Business, Windows Vista Enterprise, Windows Vista Ultimate

See Also

Reference

SideShowGadget Class
SideShowGadget Members
Microsoft.SideShow Namespace