SideShowGadget.ShowNotification Method (Int32, String, String, Icon, Generic Nullable)

Sends a notification from the gadget to all 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, _
    expiration As Nullable(Of DateTime) _
)
public void ShowNotification (
    int notificationId,
    string caption,
    string message,
    Icon image,
    Nullable<DateTime> expiration
)
public:
void ShowNotification (
    int notificationId, 
    String^ caption, 
    String^ message, 
    Icon^ image, 
    Nullable<DateTime> expiration
)
public void ShowNotification (
    int notificationId, 
    String caption, 
    String message, 
    Icon image, 
    Nullable<DateTime> expiration
)
public function ShowNotification (
    notificationId : int, 
    caption : String, 
    message : String, 
    image : Icon, 
    expiration : Nullable<DateTime>
)

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.
  • expiration
    A DateTime that indicates an absolute day and time when the device should automatically cancel this notification.

Example

The following example code demonstrates how to send a notification that expires after a specified DateTime(link).

private static void SampleShowNotification2()
{
    // 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, DateTime.Now.AddSeconds(10));
        Thread.Sleep(10000);
    }
    // This notification will be cancelled 10 seconds after the current DateTime.
}

Remarks

A notification will be shown for at least 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