DeviceButton Enumeration
Specifies a device's buttons.
Namespace: Microsoft.SideShow
Assembly: Microsoft.SideShow (in microsoft.sideshow.dll)
Usage
Syntax
'Declaration
Public Enumeration DeviceButton
public enum DeviceButton
public enum class DeviceButton
public enum DeviceButton
public enum DeviceButton
Members
Member name | Description |
---|---|
Back | The Back key. |
Down | The Down key. |
Enter | The Enter Key |
FastForward | The Fast Forward key. |
Left | The Left key. |
Menu | The Menu key. |
None | A constant that represents no key. |
Pause | The Pause key. |
Play | The Play key. |
Rewind | The Rewind key. |
Right | The Right key. |
Stop | The Stop key. |
Up | The Up key. |
Example
This example code demonstrates how to create a basic SideShow gadget using the SideShowGadget class, which sends content to connected devices using static methods from the Scf class. The same result can be obtained using SCF XML in an external .xml file.
private static void SampleScf()
{
// 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 Strings and send them to connected SideShow devices.
// Add Glance content showing date/time of last update
gadget.AddGlanceContent(
String.Format("Content updated on {0}{1:D}.", Environment.NewLine, DateTime.Now));
// Set ids.
int dialogPageId = 2;
int mainMenuId = ScfSideShowGadget.HomePageContentId;
int textPageId = 4;
int imagePageId = 5;
int contextMenuId = 6;
int backgroundImageId = 7;
// Create the main menu page.
string content = Scf.Body(
Scf.Menu(mainMenuId, "Simple Gadget Menu", ScfSelectAction.Target,
Scf.Item(dialogPageId, "See the dialog page"),
Scf.Div(),
Scf.Item(textPageId, "See the text Page")));
// Send the menu page to connected SideShow devices.
gadget.AddContent(content);
// Create the dialog page.
content = Scf.Body(
Scf.Dialog(dialogPageId, "Dialog Page Title",
Scf.Txt(ScfAlign.Center, true, Color.Violet, "A very long line of wrapping centered violet text."),
// Set the device buttons.
Scf.Btn(DeviceButton.Up, "Back to Menu", mainMenuId),
Scf.Btn(DeviceButton.Right, "Text page", textPageId),
Scf.Btn(DeviceButton.Down, "Image page", imagePageId),
Scf.Txt(ScfAlign.Right, false, Color.Yellow, "A long line of non-wrapping right aligned yellow text."),
Scf.Div(),
Scf.Txt(ScfAlign.Left, false, Color.Red, "A long line of non-wrapping left aligned red text.")));
// Send the dialog page to connected SideShow devices.
gadget.AddContent(content);
// Create the text page.
content = Scf.Body(
Scf.Content(textPageId, "This is the Text Page",
Scf.Div(),
Scf.Txt(ScfAlign.Left, true, Color.Blue, "This is some blue text")));
// Send the text page to connected SideShow devices.
gadget.AddContent(content);
// Create the image page.
content = Scf.Body(
Scf.Content(imagePageId, "Image", contextMenuId, backgroundImageId, ScfBackgroundImageFit.Center,
Scf.Txt(ScfAlign.Center, true, Color.Red, "Centered Red text"),
Scf.Br(),
Scf.Txt(ScfAlign.Right, false, Color.Green, "Right Green text")));
// Send the image page to connected SideShow devices.
gadget.AddContent(content);
// Add the image ExcelSaga.jpg to the image page.
Stream imageStream = Assembly.GetEntryAssembly().GetManifestResourceStream("CodeSampleSideShow.ExcelSaga.jpg");
gadget.AddContent(backgroundImageId, 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