Share via


SideShowGadget Class

Provides a generic view of a Windows SideShow-compatible device regardless of the endpoint.

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

Usage

Syntax

'Declaration
Public MustInherit Class SideShowGadget
    Inherits Component
public abstract class SideShowGadget : Component
public ref class SideShowGadget abstract : public Component
public abstract class SideShowGadget extends Component
public abstract class SideShowGadget extends Component

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));
    }
} 

Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
     System.ComponentModel.Component
      Microsoft.SideShow.SideShowGadget
         Microsoft.SideShow.SimpleContentFormat.ScfSideShowGadget

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 Members
Microsoft.SideShow Namespace