Scf.Dialog Method (Int32, String, Int32, ScfElement )

Creates a Simple Content Format Dialog element.

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

Usage

Syntax

'Declaration
Public Shared Function Dialog ( _
    id As Integer, _
    pageTitle As String, _
    imageId As Integer, _
    ParamArray content As ScfElement() _
) As ScfElement
public static ScfElement Dialog (
    int id,
    string pageTitle,
    int imageId,
    params ScfElement[] content
)
public:
static ScfElement^ Dialog (
    int id, 
    String^ pageTitle, 
    int imageId, 
    ... array<ScfElement^>^ content
)
public static ScfElement Dialog (
    int id, 
    String pageTitle, 
    int imageId, 
    ScfElement[] content
)
public static function Dialog (
    id : int, 
    pageTitle : String, 
    imageId : int, 
    ... content : ScfElement[]
) : ScfElement

Parameters

  • id
    Identifies the content's ID.
  • pageTitle
    Identifies the title of the content's page.
  • imageId
    Identifies the ID of page's image.
  • content
    An array of ScfElement objects that make up this content element's content.

Return Value

An ScfElement object that represents the specified dialog box.

Example

This following example demonstrates how to create a dialog page that contains an image.

private static void SampleDialog2()
{

    // 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))
    {
        // Add Glance content.
        gadget.AddGlanceContent(
           String.Format("Some glance content"));

        // Set the element ids.
        int mainMenuPageId = 1;
        int dialogPage1Id = 2;
        int textPage1Id = 3;
        int textPage2Id = 4;
        int image1Id = 5;

        // The main menu.
        string content =
            Scf.Body(
                Scf.Menu(mainMenuPageId, "Main Menu", ScfSelectAction.Target,
            // This item navigates to the dialog page.
                    Scf.Item(null, null, dialogPage1Id, "Displays dialog page 1."),
            // These 2 items navigate to Txt content pages.
                    Scf.Item(textPage1Id, "Navigate to text page 1."),
                    Scf.Item(textPage2Id, "Navigate to text page 2.")
                    )
                );
        gadget.AddContent(content);

        // Construct the dialog page and give it an image using the 2nd Dialog method overload.
        string dialogPage1 = Scf.Body(
         Scf.Dialog(dialogPage1Id, "Dialog Page 1 Title", image1Id, 
         Scf.Txt(ScfAlign.Left, true, Color.Black, "Do you want to go to page 1?"),
         // If the user selects the enter they will navigate to textPage1.
         Scf.Btn(DeviceButton.Enter, "Yes", textPage1Id),
         // If the user selects menu they will navigate to the main menu.
         Scf.Btn(DeviceButton.Menu, "No", mainMenuPageId)));
        // Send the dialog page to connected SideShow devices.
        gadget.AddContent(dialogPage1);

        // The image that the dialog page contains.
        string imageLocation = @"C:\Users\Public\SideShowGadget\HungerForce.jpg";
        gadget.AddContent(image1Id, ImageContentTransforms.KeepAspectRatio, new Bitmap(imageLocation));

        // Text page 1.
        string textPage1 = Scf.Body(
            Scf.Content(textPage1Id, "Text Page 1 Title",
            Scf.Txt(ScfAlign.Left, true, Color.Black, "Some text.")));
        gadget.AddContent(textPage1);

        // Text page 2.
        string textPage2 = Scf.Body(
            Scf.Content(textPage2Id, "Text Page 2 Title",
            Scf.Txt(ScfAlign.Left, true, Color.Black, "Some text.")));
        gadget.AddContent(textPage1);

    }
}

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

Scf Class
Scf Members
Microsoft.SideShow.SimpleContentFormat Namespace