Language

SideShowGadget Constructor (Guid, Guid)

Initializes a new instance of the SideShowGadget class by using the specified endpoint and gadgetId Guid objects.

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

Usage

Syntax

'Declaration
Protected Sub New ( _
    endpointId As Guid, _
    gadgetId As Guid _
)
protected SideShowGadget (
    Guid endpointId,
    Guid gadgetId
)
protected:
SideShowGadget (
    Guid endpointId, 
    Guid gadgetId
)
protected SideShowGadget (
    Guid endpointId, 
    Guid gadgetId
)
protected function SideShowGadget (
    endpointId : Guid, 
    gadgetId : Guid
)

Parameters

  • endpointId
    A Guid that identifies the type of data expected by the Windows SideShow-compatible device.
  • gadgetId
    A Guid that identifies the gadget that is communicating with the Windows SideShow-compatible device.

Example

This example code shows how to send content to connected Windows SideShow-compatible devices.

private static void SampleAddContent()
{
    // 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))
    {
        // Create Simple Content Format XML strings and send them to connected SideShow devices.
        // Add Glance content showing the date/time of the last update.
        gadget.AddGlanceContent(
        String.Format("Content updated on {0}{1:D}.", Environment.NewLine, DateTime.Now));

        // Menu
        gadget.AddContent(
            // This Simple Content Format Menu page navigates to text and image content.
            Scf.Menu(ScfSideShowGadget.HomePageContentId, "Simple Gadget Menu", ScfSelectAction.Target,
                Scf.Item(2, "See text"),
                Scf.Item(3, "See image")));

        // This is the text content page that the menu item 2 links to.
        gadget.AddContent(
            Scf.Content(2, "This is the Text Page",
            Scf.Txt(ScfAlign.Left, true, Color.Red, "This is some text")));

        // This is the image page that the menu item 3 links to.
        gadget.AddContent(
             Scf.Content(3, "This is the Image Page",
             Scf.Img(1000, ScfAlign.Center, ScfImageFit.Auto, "alt picture text")));

        // Add the image HungerForce.jpg to the image page.
        Stream imageStream = Assembly.GetEntryAssembly().GetManifestResourceStream("CodeSampleSideShow.HungerForce.jpg");
        gadget.AddContent(1000, ImageContentTransforms.KeepAspectRatio,
           Image.FromStream(imageStream));
    }
} 

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