Scf.Btn Method
Creates a Simple Content Format Btn element.
Namespace: Microsoft.SideShow.SimpleContentFormat
Assembly: Microsoft.SideShow (in microsoft.sideshow.dll)
Usage
Syntax
'Declaration
Public Shared Function Btn ( _
key As DeviceButton, _
text As String, _
targetId As Integer _
) As ScfElement
public static ScfElement Btn (
DeviceButton key,
string text,
int targetId
)
public:
static ScfElement^ Btn (
DeviceButton key,
String^ text,
int targetId
)
public static ScfElement Btn (
DeviceButton key,
String text,
int targetId
)
public static function Btn (
key : DeviceButton,
text : String,
targetId : int
) : ScfElement
Parameters
- key
Identifies the desired SideShowButton.
- text
Identifies the text of the button.
- targetId
Identifies the ID of the content that should be navigated to when the user presses the button.
Return Value
An ScfElement object that represents a button.
Example
This following example code shows how to create a dialog using the Scf Dialog and Btn methods.
private static void SampleDialog1()
{
// 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;
// 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.
string dialogPage1 = Scf.Body(
Scf.Dialog(dialogPage1Id, "Dialog Page 1 Title",
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);
// 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